From 86ff74acd6beb83fad05d8e9f47aade622cf816c Mon Sep 17 00:00:00 2001 From: HW Date: Mon, 12 Mar 2012 20:48:46 +0100 Subject: [PATCH] prepare for more elaborate caching policy we allow for bigger render buffers, so the cache now returns the ID (hash) of the relevant cashed tile PLUS offsets into that tile, pointing to the coordinates where the requested frame has its origin. --- unireader.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/unireader.lua b/unireader.lua index 435f0d1aa..d3ea6bc07 100644 --- a/unireader.lua +++ b/unireader.lua @@ -189,7 +189,7 @@ function UniReader:draworcache(no, zoom, offset_x, offset_y, width, height, gamm -- so give it more ttl. self.cache[hash].ttl = self.cache_max_ttl end - return hash + return hash, 0, 0 end -- calculate a hash for our current state @@ -358,12 +358,14 @@ end -- render and blit a page function UniReader:show(no) local slot + local offset_x -- resulting display offset + local offset_y if self.globalzoommode ~= self.ZOOM_BY_VALUE then - slot = self:draworcache(no,self.globalzoommode,self.offset_x,self.offset_y,width,height,self.globalgamma,self.globalrotate) + slot, offset_x, offset_y = self:draworcache(no,self.globalzoommode,self.offset_x,self.offset_y,width,height,self.globalgamma,self.globalrotate) else - slot = self:draworcache(no,self.globalzoom,self.offset_x,self.offset_y,width,height,self.globalgamma,self.globalrotate) + slot, offset_x, offset_y = self:draworcache(no,self.globalzoom,self.offset_x,self.offset_y,width,height,self.globalgamma,self.globalrotate) end - fb.bb:blitFullFrom(self.cache[slot].bb) + fb.bb:blitFrom(self.cache[slot].bb, 0, 0, offset_x, offset_y, width, height) if self.rcount == self.rcountmax then print("full refresh") self.rcount = 1