From 0d9de559445dda6e7e9bedc7297254bc7581d53d Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sun, 20 Nov 2011 00:30:33 +0100 Subject: [PATCH] modify_gamma now use cache correctly This exposed small bug in checkcache which checked just page no which didn't get invalidated when closing page, so we now check if page is also not nil --- reader.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/reader.lua b/reader.lua index 9f24c53e7..872839cc5 100755 --- a/reader.lua +++ b/reader.lua @@ -117,7 +117,7 @@ function freecache() end function checkcache(no) for i = 1, #cache do - if cache[i].no == no then + if cache[i].no == no and cache[i].page ~= nil then print("cache hit: slot="..i.." page="..no) return i end @@ -216,13 +216,12 @@ function modify_gamma(offset) if gamma == -1 then gamma = 1 end - print("modify_gamma slot="..slot.." gamma="..gamma.." offset="..offset) + local no = cache[slot].no + print("modify_gamma "..no.." 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) + freecache() + goto(no) end function mainloop()