From 96335a7eb2e9cf1e452feac0c8ae0c489197500f Mon Sep 17 00:00:00 2001 From: Sebastian Leonhardt Date: Mon, 11 Apr 2016 23:13:35 +0200 Subject: pacbox: clean-up screen size code removes the code duplication for lcd scaling in pacbox.h/pacbox_lcd.h Change-Id: Ib0aeacc9934351c5e32cd4b7576cdc840e6ff7da --- apps/plugins/pacbox/pacbox.h | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'apps/plugins/pacbox/pacbox.h') 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. -- cgit