mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-10 13:45:10 -05:00
store the image label instead of a number so debug output is actually useful when %xd is used witout a coresponding %xl
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22404 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
36ca4967e0
commit
dab7e16176
4 changed files with 16 additions and 22 deletions
|
|
@ -478,13 +478,13 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
struct gui_img* find_image(int n, struct wps_data *data)
|
struct gui_img* find_image(char label, struct wps_data *data)
|
||||||
{
|
{
|
||||||
struct skin_token_list *list = data->images;
|
struct skin_token_list *list = data->images;
|
||||||
while (list)
|
while (list)
|
||||||
{
|
{
|
||||||
struct gui_img *img = (struct gui_img *)list->token->value.data;
|
struct gui_img *img = (struct gui_img *)list->token->value.data;
|
||||||
if (img->id == n)
|
if (img->label == label)
|
||||||
return img;
|
return img;
|
||||||
list = list->next;
|
list = list->next;
|
||||||
}
|
}
|
||||||
|
|
@ -555,7 +555,7 @@ static bool get_line(struct gui_wps *gwps,
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
|
case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
|
||||||
{
|
{
|
||||||
int n = data->tokens[i].value.i & 0xFF;
|
char n = data->tokens[i].value.i & 0xFF;
|
||||||
int subimage = data->tokens[i].value.i >> 8;
|
int subimage = data->tokens[i].value.i >> 8;
|
||||||
struct gui_img *img = find_image(n, data);
|
struct gui_img *img = find_image(n, data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -482,19 +482,17 @@ static int parse_image_display(const char *wps_bufptr,
|
||||||
struct wps_token *token,
|
struct wps_token *token,
|
||||||
struct wps_data *wps_data)
|
struct wps_data *wps_data)
|
||||||
{
|
{
|
||||||
int n = get_image_id(wps_bufptr[0]);
|
char label = wps_bufptr[0];
|
||||||
int subimage;
|
int subimage;
|
||||||
struct gui_img *img;;
|
struct gui_img *img;;
|
||||||
|
|
||||||
if (n == -1)
|
/* sanity check */
|
||||||
|
img = find_image(label, wps_data);
|
||||||
|
if (!img)
|
||||||
{
|
{
|
||||||
/* invalid picture display tag */
|
token->value.i = label; /* do debug works */
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
}
|
}
|
||||||
/* sanity check */
|
|
||||||
img = find_image(n, wps_data);
|
|
||||||
if (!img)
|
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
|
||||||
|
|
||||||
if ((subimage = get_image_id(wps_bufptr[1])) != -1)
|
if ((subimage = get_image_id(wps_bufptr[1])) != -1)
|
||||||
{
|
{
|
||||||
|
|
@ -502,10 +500,10 @@ static int parse_image_display(const char *wps_bufptr,
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
/* Store sub-image number to display in high bits */
|
/* Store sub-image number to display in high bits */
|
||||||
token->value.i = n | (subimage << 8);
|
token->value.i = label | (subimage << 8);
|
||||||
return 2; /* We have consumed 2 bytes */
|
return 2; /* We have consumed 2 bytes */
|
||||||
} else {
|
} else {
|
||||||
token->value.i = n;
|
token->value.i = label;
|
||||||
return 1; /* We have consumed 1 byte */
|
return 1; /* We have consumed 1 byte */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -514,7 +512,6 @@ static int parse_image_load(const char *wps_bufptr,
|
||||||
struct wps_token *token,
|
struct wps_token *token,
|
||||||
struct wps_data *wps_data)
|
struct wps_data *wps_data)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
const char *ptr = wps_bufptr;
|
const char *ptr = wps_bufptr;
|
||||||
const char *pos;
|
const char *pos;
|
||||||
const char* filename;
|
const char* filename;
|
||||||
|
|
@ -540,11 +537,8 @@ static int parse_image_load(const char *wps_bufptr,
|
||||||
if (*ptr != '|')
|
if (*ptr != '|')
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
||||||
/* get the image ID */
|
|
||||||
n = get_image_id(*id);
|
|
||||||
|
|
||||||
/* check the image number and load state */
|
/* check the image number and load state */
|
||||||
if(n < 0 || find_image(n, wps_data))
|
if(find_image(*id, wps_data))
|
||||||
{
|
{
|
||||||
/* Invalid image ID */
|
/* Invalid image ID */
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
|
|
@ -554,7 +548,7 @@ static int parse_image_load(const char *wps_bufptr,
|
||||||
return WPS_ERROR_INVALID_PARAM;
|
return WPS_ERROR_INVALID_PARAM;
|
||||||
/* save a pointer to the filename */
|
/* save a pointer to the filename */
|
||||||
img->bm.data = (char*)filename;
|
img->bm.data = (char*)filename;
|
||||||
img->id = n;
|
img->label = *id;
|
||||||
img->x = x;
|
img->x = x;
|
||||||
img->y = y;
|
img->y = y;
|
||||||
img->num_subimages = 1;
|
img->num_subimages = 1;
|
||||||
|
|
|
||||||
|
|
@ -113,8 +113,8 @@ static char *get_token_desc(struct wps_token *token, struct wps_data *data,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
|
case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY:
|
||||||
snprintf(buf, bufsize, "display preloaded image %d",
|
snprintf(buf, bufsize, "display preloaded image '%c'",
|
||||||
token->value.i);
|
token->value.i&0xFF);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WPS_TOKEN_IMAGE_DISPLAY:
|
case WPS_TOKEN_IMAGE_DISPLAY:
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
struct gui_img {
|
struct gui_img {
|
||||||
short int id;
|
char label;
|
||||||
struct bitmap bm;
|
struct bitmap bm;
|
||||||
struct viewport* vp; /* The viewport to display this image in */
|
struct viewport* vp; /* The viewport to display this image in */
|
||||||
short int x; /* x-pos */
|
short int x; /* x-pos */
|
||||||
|
|
@ -346,7 +346,7 @@ const char *get_token_value(struct gui_wps *gwps,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct gui_img* find_image(int n, struct wps_data *data);
|
struct gui_img* find_image(char label, struct wps_data *data);
|
||||||
struct skin_viewport* find_viewport(char label, struct wps_data *data);
|
struct skin_viewport* find_viewport(char label, struct wps_data *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue