From 5e5b2bd18de6f25c5c959f272cf2e9aacdc4c0f5 Mon Sep 17 00:00:00 2001 From: Hans-Werner Hilse Date: Tue, 11 Nov 2014 15:39:10 +0100 Subject: [PATCH] calculate proper refresh coordinates when using viewport The viewport offset used by refresh() was not properly adapted when the screen was rotated. --- frontend/device/screen.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/device/screen.lua b/frontend/device/screen.lua index 95f4ae264..3bce2bad4 100644 --- a/frontend/device/screen.lua +++ b/frontend/device/screen.lua @@ -80,9 +80,14 @@ end function Screen:refresh(refresh_type, waveform_mode, wait_for_marker, x, y, w, h) if self.viewport and x and y then - -- adapt to viewport - x = x + self.viewport.x - y = y + self.viewport.y + -- adapt to viewport, depending on rotation + if self.cur_rotation_mode == 0 or self.cur_rotation_mode == 2 then + x = x + self.viewport.x + y = y + self.viewport.y + else + x = x + self.viewport.y + y = y + self.viewport.x + end end self.fb:refresh(refresh_type, waveform_mode, wait_for_marker, x, y, w, h) end