From 603f87fe3c0557cb31386fb89c0a49fb72102735 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sun, 26 Feb 2006 02:48:05 +0000 Subject: Foreground/Background colour settings. Based on patch #3050 by Jonathan Gordon, extended my me. The principle of the patch is that the three sliders contain the native ranges (currently 0..31, 0..63, 0..31), and the equivalent RGB888 colour is displayed underneath. The config block (and global_settings struct) contain the native value for the fg/bg colours (either RGB565 or RGB565SWAPPED), but the text .cfg files contain the RGB888 value written as 6 hex digits. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8840 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/lcd.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'firmware') diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index ba0e216990..6f7fef94ee 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -150,6 +150,9 @@ typedef void lcd_fastpixelfunc_type(fb_data *address); #define LCD_MAX_RED 31 #define LCD_MAX_GREEN 63 #define LCD_MAX_BLUE 31 +#define _RGB_UNPACK_RED(x) ((((x) >> 8) & 0xf8) | ((x) >> 13)) +#define _RGB_UNPACK_GREEN(x) ((((x) >> 3) & 0xfc) | (((x) >> 9) & 0x03)) +#define _RGB_UNPACK_BLUE(x) ((((x) << 3) & 0xf8) | (((x) >> 2) & 0x07)) #define _RGBPACK(r, g, b) ( ((((r) * (31*257) + (127*257)) >> 16) << 11) \ |((((g) * (63*257) + (127*257)) >> 16) << 5) \ | (((b) * (31*257) + (127*257)) >> 16)) @@ -158,8 +161,14 @@ typedef void lcd_fastpixelfunc_type(fb_data *address); #if (LCD_PIXELFORMAT == RGB565SWAPPED) #define LCD_RGBPACK(r, g, b) ( ((_RGBPACK((r), (g), (b)) & 0xff00) >> 8) \ |((_RGBPACK((r), (g), (b)) & 0x00ff) << 8)) +#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(swap16(x)) +#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(swap16(x)) +#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(swap16(x)) #else #define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b)) +#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x) +#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x) +#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x) #endif #elif LCD_DEPTH == 18 #define LCD_MAX_RED 63 -- cgit v1.2.3