diff options
author | Dave Chapman <dave@dchapman.com> | 2008-03-23 20:31:00 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-03-23 20:31:00 +0000 |
commit | 15ddd7a7ec2aa92767234e37907904309943a27b (patch) | |
tree | 5dff9b41fe0b8948c85c3eda66c62ffe780cb4a7 /apps/gui/gwps-common.c | |
parent | b8b03370e4a3e1ec20324e9055065c77873e30f7 (diff) |
Add the ability to use bitmap strips (a single .bmp file containing many images of the same dimensions, tiled vertically - similar to icon strips) in the WPS. The %xl tag now has an optional "number of subimages" parameter, and the %xd tag has an optional "subimage to display" parameter (a-z,A-Z - allowing up to 52 sub-images). So for example, a bitmap with 10 subimages is loaded with %xl|M|volume.bmp|134|153|10| and then this can be used in a conditional as %?pv<%xdMa|%xdMb|%xdMc|%xdMd|%xdMe|%xdMf|%xdMg|%xdMh|%xdMi|%xdMj>.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16764 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r-- | apps/gui/gwps-common.c | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 744f86e42a..37b2b7c5d1 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -516,11 +516,11 @@ static void clear_image_pos(struct gui_wps *gwps, int n) struct wps_data *data = gwps->data; gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); gwps->display->fillrect(data->img[n].x, data->img[n].y, - data->img[n].bm.width, data->img[n].bm.height); + data->img[n].bm.width, data->img[n].subimage_height); gwps->display->set_drawmode(DRMODE_SOLID); } -static void wps_draw_image(struct gui_wps *gwps, int n) +static void wps_draw_image(struct gui_wps *gwps, int n, int subimage) { struct screen *display = gwps->display; struct wps_data *data = gwps->data; @@ -532,15 +532,18 @@ static void wps_draw_image(struct gui_wps *gwps, int n) #if LCD_DEPTH > 1 if(data->img[n].bm.format == FORMAT_MONO) { #endif - display->mono_bitmap(data->img[n].bm.data, data->img[n].x, - data->img[n].y, data->img[n].bm.width, - data->img[n].bm.height); + display->mono_bitmap_part(data->img[n].bm.data, + 0, data->img[n].subimage_height * subimage, + data->img[n].bm.width, data->img[n].x, + data->img[n].y, data->img[n].bm.width, + data->img[n].subimage_height); #if LCD_DEPTH > 1 } else { - display->transparent_bitmap((fb_data *)data->img[n].bm.data, - data->img[n].x, - data->img[n].y, data->img[n].bm.width, - data->img[n].bm.height); + display->transparent_bitmap_part((fb_data *)data->img[n].bm.data, + 0, data->img[n].subimage_height * subimage, + data->img[n].bm.width, data->img[n].x, + data->img[n].y, data->img[n].bm.width, + data->img[n].subimage_height); } #endif } @@ -556,11 +559,15 @@ static void wps_display_images(struct gui_wps *gwps, struct viewport* vp) for (n = 0; n < MAX_IMAGES; n++) { - if (data->img[n].loaded && - (data->img[n].display || - (data->img[n].always_display && data->img[n].vp == vp))) + if (data->img[n].loaded) { - wps_draw_image(gwps, n); + if (data->img[n].display >= 0) + { + wps_draw_image(gwps, n, data->img[n].display); + } else if (data->img[n].always_display && data->img[n].vp == vp) + { + wps_draw_image(gwps, n, 0); + } } } display->set_drawmode(DRMODE_SOLID); @@ -1449,7 +1456,7 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index) #ifdef HAVE_LCD_BITMAP /* clear all pictures in the conditional and nested ones */ if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY) - clear_image_pos(gwps, data->tokens[i].value.i); + clear_image_pos(gwps, data->tokens[i].value.i & 0xFF); #endif #ifdef HAVE_ALBUMART if (data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY) @@ -1515,9 +1522,11 @@ static bool get_line(struct gui_wps *gwps, case WPS_TOKEN_IMAGE_PRELOAD_DISPLAY: { struct gui_img *img = data->img; - int n = data->tokens[i].value.i; + int n = data->tokens[i].value.i & 0xFF; + int subimage = data->tokens[i].value.i >> 8; + if (n >= 0 && n < MAX_IMAGES && img[n].loaded) - img[n].display = true; + img[n].display = subimage; break; } #endif @@ -1944,7 +1953,7 @@ bool gui_wps_refresh(struct gui_wps *gwps, /* Set images to not to be displayed */ for (i = 0; i < MAX_IMAGES; i++) { - data->img[i].display = false; + data->img[i].display = -1; } #endif |