Merge pull request #5 from dpavlin/gamma

Change gamma using keypresses, still needs cache invalidation
pull/2/merge
HW 13 years ago
commit 4f888ca267

@ -195,6 +195,7 @@ function show(no)
rcount = rcount + 1
fb:refresh(1)
end
slot_visible = slot;
end
function goto(no)
@ -209,6 +210,21 @@ function goto(no)
end
end
function modify_gamma(offset)
local slot = slot_visible
local gamma = cache[slot].dc:getGamma();
if gamma == -1 then
gamma = 1
end
print("modify_gamma slot="..slot.." gamma="..gamma.." offset="..offset)
gamma = gamma + offset;
cache[slot].dc:setGamma( gamma );
optarg["G"] = gamma; -- for next page
cache[slot].page:draw(cache[slot].dc, cache[slot].bb, 0, 0)
fb:blitFullFrom(cache[slot].bb)
fb:refresh(0)
end
function mainloop()
while 1 do
local ev = input.waitForEvent()
@ -224,6 +240,10 @@ function mainloop()
print(cache)
elseif ev.code == KEY_BACK then
return
elseif ev.code == KEY_UP then
modify_gamma( 0.2 )
elseif ev.code == KEY_DOWN then
modify_gamma( -0.2 )
end
local nsecs, nusecs = util.gettime()
local dur = (nsecs - secs) * 1000000 + nusecs - usecs

Loading…
Cancel
Save