From aac1509c218f6ea7fec7e442c8457f7e47f2fd90 Mon Sep 17 00:00:00 2001 From: chrox Date: Wed, 16 Oct 2013 20:52:32 +0800 Subject: [PATCH] check dimension restraint on regional refresh request --- frontend/ui/screen.lua | 4 ++-- frontend/ui/uimanager.lua | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/ui/screen.lua b/frontend/ui/screen.lua index b6ef58033..d0e867b9d 100644 --- a/frontend/ui/screen.lua +++ b/frontend/ui/screen.lua @@ -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 diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 2f5a037ea..ad5298037 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -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