summaryrefslogtreecommitdiffstats
path: root/apps/plugins/pacbox/pacbox.h
diff options
context:
space:
mode:
authorSebastian Leonhardt <sebastian.leonhardt@web.de>2016-04-11 23:13:35 +0200
committerSebastian Leonhardt <sebastian.leonhardt@web.de>2018-04-02 20:29:01 +0200
commit96335a7eb2e9cf1e452feac0c8ae0c489197500f (patch)
tree4b324ed3c75d91aebf4b6caf6e68879445a2cff1 /apps/plugins/pacbox/pacbox.h
parentd5847e8cb2cf6eb5bc6929a13c95a1c563df8bc6 (diff)
downloadrockbox-96335a7eb2e9cf1e452feac0c8ae0c489197500f.tar.gz
rockbox-96335a7eb2e9cf1e452feac0c8ae0c489197500f.tar.bz2
rockbox-96335a7eb2e9cf1e452feac0c8ae0c489197500f.zip
pacbox: clean-up screen size code
removes the code duplication for lcd scaling in pacbox.h/pacbox_lcd.h Change-Id: Ib0aeacc9934351c5e32cd4b7576cdc840e6ff7da
Diffstat (limited to 'apps/plugins/pacbox/pacbox.h')
-rw-r--r--apps/plugins/pacbox/pacbox.h37
1 files changed, 30 insertions, 7 deletions
diff --git a/apps/plugins/pacbox/pacbox.h b/apps/plugins/pacbox/pacbox.h
index bb132f7c4c..77a107bec4 100644
--- a/apps/plugins/pacbox/pacbox.h
+++ b/apps/plugins/pacbox/pacbox.h
@@ -373,22 +373,42 @@
#endif
#endif
-#if (LCD_HEIGHT >= 288)
+/* Calculate scaling and screen offset/clipping.
+ Put native portrait mode before landscape, if a screen resulution allows both.
+ */
+#if (LCD_WIDTH >= 224) && (LCD_HEIGHT >= 288)
+#define LCD_SCALE 100
+#define LCD_ROTATE 0
#define XOFS ((LCD_WIDTH-224)/2)
#define YOFS ((LCD_HEIGHT-288)/2)
-#elif (LCD_WIDTH >= 288)
+
+#elif (LCD_WIDTH >= 288) && (LCD_HEIGHT >= 224)
+#define LCD_SCALE 100
+#define LCD_ROTATE 1
#define XOFS ((LCD_WIDTH-288)/2)
#define YOFS ((LCD_HEIGHT-224)/2)
-#elif (LCD_WIDTH >= 220)
-#define XOFS ((LCD_WIDTH-(288*3/4))/2)
-#define YOFS ((LCD_HEIGHT-(224*3/4))/2)
+
#elif (LCD_WIDTH >= 168) && (LCD_HEIGHT >= 216)
+#define LCD_SCALE 75
+#define LCD_ROTATE 0
#define XOFS ((LCD_WIDTH-(224*3/4))/2)
#define YOFS ((LCD_HEIGHT-(288*3/4))/2)
-#elif (LCD_WIDTH >= 144)
+
+#elif (LCD_WIDTH >= 216) && (LCD_HEIGHT >= 168)
+#define LCD_SCALE 75
+#define LCD_ROTATE 1
+#define XOFS ((LCD_WIDTH-(288*3/4))/2)
+#define YOFS ((LCD_HEIGHT-(224*3/4))/2)
+
+#elif (LCD_WIDTH >= 144) && (LCD_HEIGHT >= 112)
+#define LCD_SCALE 50
+#define LCD_ROTATE 1
#define XOFS ((LCD_WIDTH-288/2)/2)
#define YOFS ((LCD_HEIGHT-224/2)/2)
-#elif (LCD_WIDTH >= 128)
+
+#elif (LCD_WIDTH >= 112) && (LCD_HEIGHT >= 128)
+#define LCD_SCALE 50
+#define LCD_ROTATE 0
#define XOFS ((LCD_WIDTH-224/2)/2)
#if LCD_HEIGHT < 144
#define YCLIP ((288-2*LCD_HEIGHT)/2)
@@ -397,6 +417,9 @@
#define YCLIP 0
#define YOFS ((LCD_HEIGHT-288/2)/2)
#endif
+
+#else
+#error "unsupported screen resolution"
#endif
/* How many video frames (out of a possible 60) we display each second.