From 184dff93b13e4303f9637901bd72c7fb1e092a23 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Wed, 12 Apr 2023 20:19:07 +0200 Subject: [PATCH] ili9341: fix Size() for mirrored rotation --- ili9341/ili9341.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ili9341/ili9341.go b/ili9341/ili9341.go index 72f9423..2b6f58c 100644 --- a/ili9341/ili9341.go +++ b/ili9341/ili9341.go @@ -138,10 +138,12 @@ func (d *Device) Configure(config Config) { // Size returns the current size of the display. func (d *Device) Size() (x, y int16) { - if d.rotation == 1 || d.rotation == 3 { + switch d.rotation { + case Rotation90, Rotation270, Rotation90Mirror, Rotation270Mirror: return d.height, d.width + default: // Rotation0, Rotation180, etc + return d.width, d.height } - return d.width, d.height } // SetPixel modifies the internal buffer.