check dimension restraint on regional refresh request

This commit is contained in:
chrox
2013-10-16 20:52:32 +08:00
parent 9cec8a035a
commit aac1509c21
2 changed files with 5 additions and 4 deletions

View File

@@ -75,8 +75,8 @@ end
function Screen:refresh(refesh_type, waveform_mode, x, y, w, h)
if x then x = x < 0 and 0 or math.floor(x) end
if y then y = y < 0 and 0 or math.floor(y) end
if w then w = w > self.width and self.width or math.ceil(w) end
if h then h = h > self.height and self.height or math.ceil(h) end
if w then w = w + x > self.width and self.width - x or math.ceil(w) end
if h then h = h + y > self.height and self.height - y or math.ceil(h) end
if self.native_rotation_mode == self.cur_rotation_mode then
self.fb.bb:blitFrom(self.bb, 0, 0, 0, 0, self.width, self.height)
elseif self.native_rotation_mode == 0 and self.cur_rotation_mode == 1 then

View File

@@ -247,9 +247,10 @@ function UIManager:run()
end
if self.update_region_func then
local update_region = self.update_region_func()
-- in some rare cases update region has 1 pixel offset
Screen:refresh(refresh_type, waveform_mode,
update_region.x, update_region.y,
update_region.w, update_region.h)
update_region.x-1, update_region.y-1,
update_region.w+2, update_region.h+2)
else
Screen:refresh(refresh_type, waveform_mode)
end