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.tar.gz rockbox-745adad22a3803e7d7f3c14ba7ae2f8d3accb75a.zip |
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 d33bd8ccac..d15dbba888 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, | |||
216 | } | 216 | } |
217 | 217 | ||
218 | /* load the image */ | 218 | /* load the image */ |
219 | ret = read_bmp_file(imgname, &data->img[n].w, | 219 | data->img[n].bm.data = data->img_buf_ptr; |
220 | &data->img[n].h, data->img_buf_ptr, | 220 | ret = read_bmp_file(imgname, &data->img[n].bm, |
221 | data->img_buf_free); | 221 | data->img_buf_free, |
222 | FORMAT_ANY); | ||
222 | if (ret > 0) | 223 | if (ret > 0) |
223 | { | 224 | { |
224 | data->img[n].ptr = data->img_buf_ptr; | ||
225 | data->img_buf_ptr += ret; | 225 | data->img_buf_ptr += ret; |
226 | data->img_buf_free -= ret; | 226 | data->img_buf_free -= ret; |
227 | data->img[n].loaded = true; | 227 | data->img[n].loaded = true; |
@@ -785,7 +785,7 @@ static void clear_image_pos(struct gui_wps *gwps, int n) | |||
785 | struct wps_data *data = gwps->data; | 785 | struct wps_data *data = gwps->data; |
786 | gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | 786 | gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); |
787 | gwps->display->fillrect(data->img[n].x, data->img[n].y, | 787 | gwps->display->fillrect(data->img[n].x, data->img[n].y, |
788 | data->img[n].w, data->img[n].h); | 788 | data->img[n].bm.width, data->img[n].bm.height); |
789 | gwps->display->set_drawmode(DRMODE_SOLID); | 789 | gwps->display->set_drawmode(DRMODE_SOLID); |
790 | } | 790 | } |
791 | #endif | 791 | #endif |
@@ -827,12 +827,13 @@ static const char* skip_conditional(struct gui_wps *gwps, const char* fmt, | |||
827 | if(n >= 'A' && n <= 'Z') | 827 | if(n >= 'A' && n <= 'Z') |
828 | n = n - 'A' + 26; | 828 | n = n - 'A' + 26; |
829 | if(last_x != data->img[n].x || last_y != data->img[n].y | 829 | if(last_x != data->img[n].x || last_y != data->img[n].y |
830 | || last_w != data->img[n].w || last_h != data->img[n].h) | 830 | || last_w != data->img[n].bm.width |
831 | || last_h != data->img[n].bm.height) | ||
831 | { | 832 | { |
832 | last_x = data->img[n].x; | 833 | last_x = data->img[n].x; |
833 | last_y = data->img[n].y; | 834 | last_y = data->img[n].y; |
834 | last_w = data->img[n].w; | 835 | last_w = data->img[n].bm.width; |
835 | last_h = data->img[n].h; | 836 | last_h = data->img[n].bm.height; |
836 | clear_image_pos(gwps,n); | 837 | clear_image_pos(gwps,n); |
837 | } | 838 | } |
838 | } | 839 | } |
@@ -1243,9 +1244,19 @@ static void wps_draw_image(struct gui_wps *gwps, int n) | |||
1243 | else | 1244 | else |
1244 | display->set_drawmode(DRMODE_SOLID); | 1245 | display->set_drawmode(DRMODE_SOLID); |
1245 | 1246 | ||
1246 | display->mono_bitmap(data->img[n].ptr, data->img[n].x, | 1247 | #if LCD_DEPTH > 1 |
1247 | data->img[n].y, data->img[n].w, | 1248 | if(data->img[n].bm.format == FORMAT_MONO) { |
1248 | data->img[n].h); | 1249 | #endif |
1250 | display->mono_bitmap(data->img[n].bm.data, data->img[n].x, | ||
1251 | data->img[n].y, data->img[n].bm.width, | ||
1252 | data->img[n].bm.height); | ||
1253 | #if LCD_DEPTH > 1 | ||
1254 | } else { | ||
1255 | display->bitmap((fb_data *)data->img[n].bm.data, data->img[n].x, | ||
1256 | data->img[n].y, data->img[n].bm.width, | ||
1257 | data->img[n].bm.height); | ||
1258 | } | ||
1259 | #endif | ||
1249 | } | 1260 | } |
1250 | static void wps_display_images(struct gui_wps *gwps, bool always) | 1261 | static void wps_display_images(struct gui_wps *gwps, bool always) |
1251 | { | 1262 | { |
diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index eb976c9220..8cd4c8f63e 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h | |||
@@ -255,11 +255,9 @@ extern bool keys_locked; | |||
255 | 255 | ||
256 | #ifdef HAVE_LCD_BITMAP | 256 | #ifdef HAVE_LCD_BITMAP |
257 | struct gui_img{ | 257 | struct gui_img{ |
258 | unsigned char* ptr; /* pointer */ | 258 | struct bitmap bm; |
259 | int x; /* x-pos */ | 259 | int x; /* x-pos */ |
260 | int y; /* y-pos */ | 260 | int y; /* y-pos */ |
261 | int w; /* width */ | ||
262 | int h; /* height */ | ||
263 | bool loaded; /* load state */ | 261 | bool loaded; /* load state */ |
264 | bool display; /* is to be displayed */ | 262 | bool display; /* is to be displayed */ |
265 | bool always_display; /* not using the preload/display mechanism */ | 263 | bool always_display; /* not using the preload/display mechanism */ |
@@ -274,7 +272,7 @@ struct align_pos { | |||
274 | 272 | ||
275 | #ifdef HAVE_LCD_BITMAP | 273 | #ifdef HAVE_LCD_BITMAP |
276 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ | 274 | #define MAX_IMAGES (26*2) /* a-z and A-Z */ |
277 | #define IMG_BUFSIZE (LCD_HEIGHT * LCD_WIDTH * MAX_IMAGES/10) / 8 | 275 | #define IMG_BUFSIZE (LCD_HEIGHT * LCD_WIDTH * MAX_IMAGES/10) |
278 | #define WPS_MAX_LINES (LCD_HEIGHT/5+1) | 276 | #define WPS_MAX_LINES (LCD_HEIGHT/5+1) |
279 | #define FORMAT_BUFFER_SIZE 3072 | 277 | #define FORMAT_BUFFER_SIZE 3072 |
280 | #else | 278 | #else |