1
0
Fork 0
forked from len0rd/rockbox

Fix FS#11526 - %Vf(<hex>) was acceptable on grey remotes with colour main

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27768 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jonathan Gordon 2010-08-10 14:15:03 +00:00
parent a547fc1b35
commit 489962dc4e
4 changed files with 29 additions and 13 deletions

View file

@ -400,7 +400,7 @@ static int parse_viewportcolour(struct skin_element *element,
} }
else else
{ {
if (!parse_color(param->data.text, &colour->colour)) if (!parse_color(curr_screen, param->data.text, &colour->colour))
return -1; return -1;
} }
colour->vp = &curr_vp->vp; colour->vp = &curr_vp->vp;

View file

@ -655,10 +655,14 @@ static void gwps_enter_wps(void)
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
if (display->depth > 1) if (display->depth > 1)
{ {
struct viewport *vp = &find_viewport(VP_DEFAULT_LABEL, struct skin_viewport *svp = find_viewport(VP_DEFAULT_LABEL,
false, gwps->data)->vp; false, gwps->data);
vp->fg_pattern = display->get_foreground(); if (svp)
vp->bg_pattern = display->get_background(); {
struct viewport *vp = &svp->vp;
vp->fg_pattern = display->get_foreground();
vp->bg_pattern = display->get_background();
}
} }
#endif #endif
/* make the backdrop actually take effect */ /* make the backdrop actually take effect */

View file

@ -930,20 +930,31 @@ int hex_to_rgb(const char* hex, int* color)
/* '0'-'3' are ASCII 0x30 to 0x33 */ /* '0'-'3' are ASCII 0x30 to 0x33 */
#define is0123(x) (((x) & 0xfc) == 0x30) #define is0123(x) (((x) & 0xfc) == 0x30)
bool parse_color(char *text, int *value) bool parse_color(enum screen_type screen, char *text, int *value)
{ {
(void)text; (void)value; /* silence warnings on mono bitmap */ (void)text; (void)value; /* silence warnings on mono bitmap */
int depth = screens[screen].depth;
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
if (hex_to_rgb(text, value) < 0) if (depth > 2)
return false; {
if (hex_to_rgb(text, value) < 0)
return false;
else
return true;
}
#endif #endif
#if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2) #if LCD_DEPTH == 2 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH == 2)
if (text[1] != '\0' || !is0123(*text)) if (depth == 2)
return false; {
*value = *text - '0'; if (text[1] != '\0' || !is0123(*text))
return false;
*value = *text - '0';
return true;
}
#endif #endif
return true; return false;
} }
/* only used in USB HID and set_time screen */ /* only used in USB HID and set_time screen */

View file

@ -25,6 +25,7 @@
#include <inttypes.h> #include <inttypes.h>
#include "config.h" #include "config.h"
#include "system.h" #include "system.h"
#include "screen_access.h"
extern const unsigned char * const byte_units[]; extern const unsigned char * const byte_units[];
extern const unsigned char * const * const kbyte_units; extern const unsigned char * const * const kbyte_units;
@ -92,7 +93,7 @@ char* skip_whitespace(char* const str);
char *strip_extension(char* buffer, int buffer_size, const char *filename); char *strip_extension(char* buffer, int buffer_size, const char *filename);
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
bool parse_color(char *text, int *value); bool parse_color(enum screen_type screen, char *text, int *value);
/* only used in USB HID and set_time screen */ /* only used in USB HID and set_time screen */
#if defined(USB_ENABLE_HID) || (CONFIG_RTC != 0) #if defined(USB_ENABLE_HID) || (CONFIG_RTC != 0)