From e8d576f99fd7fdae109cafa47ecbf2172bd4e4f7 Mon Sep 17 00:00:00 2001 From: Hans-Werner Hilse Date: Sat, 15 Nov 2014 22:01:04 +0100 Subject: [PATCH] fix bug in viewport offset calculation for refreshes The calculation did not correctly calculate the offset in rotated modes when the rotation was 90 or 270 degrees. Under these circumstances, getWidth() and getHeight() did return rotated values for the framebuffer, while Device.viewport did return not rotated values. --- frontend/device/screen.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/device/screen.lua b/frontend/device/screen.lua index e628012f4..cf382af1b 100644 --- a/frontend/device/screen.lua +++ b/frontend/device/screen.lua @@ -87,7 +87,7 @@ function Screen:refresh(refresh_type, waveform_mode, wait_for_marker, x, y, w, h y = y + self.viewport.y elseif self.cur_rotation_mode == 1 then -- (0,0) is at bottom left of screen - x = x + (self.fb.bb:getHeight()-self.viewport.h) + x = x + (self.fb.bb:getWidth()-self.viewport.h) y = y + self.viewport.x elseif self.cur_rotation_mode == 2 then -- (0,0) is at bottom right of screen @@ -96,7 +96,7 @@ function Screen:refresh(refresh_type, waveform_mode, wait_for_marker, x, y, w, h else -- (0,0) is at top right of screen x = x + self.viewport.y - y = y + (self.fb.bb:getWidth()-self.viewport.w) + y = y + (self.fb.bb:getHeight()-self.viewport.w) end end self.fb:refresh(refresh_type, waveform_mode, wait_for_marker, x, y, w, h)