diff options
| author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-01-28 12:12:42 +0000 |
|---|---|---|
| committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-01-28 12:12:42 +0000 |
| commit | 745adad22a3803e7d7f3c14ba7ae2f8d3accb75a (patch) | |
| tree | 644ae59e3b53daf9b534893763d2d0d7610f91fa /apps/gui | |
| parent | 9bd06032a37c60b17ae1643677ddc9a56a46d67f (diff) | |
| download | rockbox-745adad22a3803e7d7f3c14ba7ae2f8d3accb75a.zip rockbox-745adad22a3803e7d7f3c14ba7ae2f8d3accb75a.tar.gz rockbox-745adad22a3803e7d7f3c14ba7ae2f8d3accb75a.tar.bz2 rockbox-745adad22a3803e7d7f3c14ba7ae2f8d3accb75a.tar.xz | |
Color BMP support
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8472 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
| -rw-r--r-- | apps/gui/gwps-common.c | 33 | ||||
| -rw-r--r-- | apps/gui/gwps.h | 6 |
2 files changed, 24 insertions, 15 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index d33bd8c..d15dbba 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -216,12 +216,12 @@ bool wps_data_preload_tags(struct wps_data *data, char *buf, } /* load the image */ - ret = read_bmp_file(imgname, &data->img[n].w, - &data->img[n].h, data->img_buf_ptr, - data->img_buf_free); + data->img[n].bm.data = data->img_buf_ptr; + ret = read_bmp_file(imgname, &data->img[n].bm, + data->img_buf_free, + FORMAT_ANY); if (ret > 0) { - data->img[n].ptr = data->img_buf_ptr; data->img_buf_ptr += ret; data->img_buf_free -= ret; data->img[n].loaded = true; @@ -785,7 +785,7 @@ 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].w, data->img[n].h); + data->img[n].bm.width, data->img[n].bm.height); gwps->display->set_drawmode(DRMODE_SOLID); } #endif @@ -827,12 +827,13 @@ static const char* skip_conditional(struct gui_wps *gwps, const char* fmt, if(n >= 'A' && n <= 'Z') n = n - 'A' + 26; if(last_x != data->img[n].x || last_y != data->img[n].y - || last_w != data->img[n].w || last_h != data->img[n].h) + || last_w != data->img[n].bm.width + || last_h != data->img[n].bm.height) { last_x = data->img[n].x; last_y = data->img[n].y; - last_w = data->img[n].w; - last_h = data->img[n].h; + last_w = data->img[n].bm.width; + last_h = data->img[n].bm.height; clear_image_pos(gwps,n); } } @@ -1243,9 +1244,19 @@ static void wps_draw_image(struct gui_wps *gwps, int n) else display->set_drawmode(DRMODE_SOLID); - display->mono_bitmap(data->img[n].ptr, data->img[n].x, - data->img[n].y, data->img[n].w, - data->img[n].h); +#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); +#if LCD_DEPTH > 1 + } else { + display->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); + } +#endif } static void wps_display_images(struct gui_wps *gwps, bool always) { diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index eb976c9..8cd4c8f 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -255,11 +255,9 @@ extern bool keys_locked; #ifdef HAVE_LCD_BITMAP struct gui_img{ - unsigned char* ptr; /* pointer */ + struct bitmap bm; int x; /* x-pos */ int y; /* y-pos */ - int w; /* width */ - int h; /* height */ bool loaded; /* load state */ bool display; /* is to be displayed */ bool always_display; /* not using the preload/display mechanism */ @@ -274,7 +272,7 @@ struct align_pos { #ifdef HAVE_LCD_BITMAP #define MAX_IMAGES (26*2) /* a-z and A-Z */ -#define IMG_BUFSIZE (LCD_HEIGHT * LCD_WIDTH * MAX_IMAGES/10) / 8 +#define IMG_BUFSIZE (LCD_HEIGHT * LCD_WIDTH * MAX_IMAGES/10) #define WPS_MAX_LINES (LCD_HEIGHT/5+1) #define FORMAT_BUFFER_SIZE 3072 #else |