summaryrefslogtreecommitdiffstats
path: root/firmware/export/lcd-remote.h
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-10-31 00:18:57 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-10-31 01:11:30 -0400
commit60f642ba4f6a9bf2d976f133b85b8f6a7502c14c (patch)
treea37547c0972899968a4a2ff148ded098d40f0f36 /firmware/export/lcd-remote.h
parent202f9df0c1e6132631e9e1372d50fe8dc8e87f20 (diff)
downloadrockbox-60f642ba4f6a9bf2d976f133b85b8f6a7502c14c.tar.gz
rockbox-60f642ba4f6a9bf2d976f133b85b8f6a7502c14c.tar.bz2
rockbox-60f642ba4f6a9bf2d976f133b85b8f6a7502c14c.zip
lcd_framebuffer bugfixes, sanity checks
several issues I saw that could pontentially cause problems scroll engine doesn't take text height into account when checking bounds NBELEMS was one whole row too large hopefully I got them right this time Change-Id: If303da8320429c3964fc675351cb088d46303745
Diffstat (limited to 'firmware/export/lcd-remote.h')
-rw-r--r--firmware/export/lcd-remote.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index 030b01c736..93ca1fac7e 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -63,13 +63,13 @@
#define LCD_REMOTE_STRIDE(w, h) (h)
#define LCD_REMOTE_FBSTRIDE(w, h) ((h+7)/8)
#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_FBSTRIDE(LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT)
-#define LCD_REMOTE_NBELEMS(w, h) (((w*LCD_REMOTE_FBSTRIDE(w, h)) + h) / sizeof(fb_remote_data))
+#define LCD_REMOTE_NBELEMS(w, h) ((((w-1)*LCD_REMOTE_FBSTRIDE(w, h)) + h) / sizeof(fb_remote_data))
#elif LCD_REMOTE_DEPTH == 2
#if LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED
#define LCD_REMOTE_STRIDE(w, h) (h)
#define LCD_REMOTE_FBSTRIDE(w, h) ((h+7)/8)
#define LCD_REMOTE_FBHEIGHT LCD_REMOTE_FBSTRIDE(LCD_REMOTE_WIDTH, LCD_REMOTE_HEIGHT)
-#define LCD_REMOTE_NBELEMS(w, h) (((w*LCD_REMOTE_FBSTRIDE(w, h)) + h) / sizeof(fb_remote_data))
+#define LCD_REMOTE_NBELEMS(w, h) ((((w-1)*LCD_REMOTE_FBSTRIDE(w, h)) + h) / sizeof(fb_remote_data))
#endif
#endif /* LCD_REMOTE_DEPTH */
@@ -84,7 +84,7 @@
#ifndef LCD_REMOTE_NBELEMS
/* At this time (2020) known remote screens only have vertical stride */
-#define LCD_REMOTE_NBELEMS(w, h) ((w*STRIDE_REMOTE(w, h)) + h) / sizeof(fb_remote_data))
+#define LCD_REMOTE_NBELEMS(w, h) (((w-1)*STRIDE_REMOTE(w, h)) + h) / sizeof(fb_remote_data))
#define LCD_REMOTE_STRIDE(w, h) STRIDE_REMOTE(w, h)
#define LCD_REMOTE_FBSTRIDE(w, h) STRIDE_REMOTE(w, h)
#endif