From 13209604c1512658e729d0bd9f1c54cf3e53568d Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Tue, 8 Nov 2011 21:34:46 +0000 Subject: Add new lcd_bmp and lcd_bmp_part APIs. This new APIs wrap around lcd_[mono|transparent]_bitmap/_part calls and handle all kinds bitmaps. The intended use is to draw bitmaps that come from read_bmp_fd/_file. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30936 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/icon.c | 14 +-------- apps/gui/scrollbar.c | 13 +-------- apps/gui/skin_engine/skin_display.c | 58 +++++-------------------------------- 3 files changed, 9 insertions(+), 76 deletions(-) (limited to 'apps/gui') diff --git a/apps/gui/icon.c b/apps/gui/icon.c index c171da5b44..4c006f947a 100644 --- a/apps/gui/icon.c +++ b/apps/gui/icon.c @@ -109,14 +109,11 @@ void screen_put_icon_with_offset(struct screen * display, void screen_put_iconxy(struct screen * display, int xpos, int ypos, enum themable_icons icon) { - const void *data; const int screen = display->screen_type; const int width = ICON_WIDTH(screen); const int height = ICON_HEIGHT(screen); const int is_rtl = lang_is_rtl(); - int stride; const struct bitmap *iconset; - screen_bitmap_part_func *draw_func = NULL; if (icon == Icon_NOICON) { @@ -145,9 +142,6 @@ void screen_put_iconxy(struct screen * display, { iconset = &inbuilt_iconset[screen]; } - data = iconset->data; - stride = STRIDE(display->screen_type, iconset->width, iconset->height); - /* add some left padding to the icons if they are on the edge */ if (xpos == 0) xpos++; @@ -155,14 +149,8 @@ void screen_put_iconxy(struct screen * display, if (is_rtl) xpos = display->getwidth() - xpos - width; -#if (LCD_DEPTH == 16) || defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH == 16) - if (display->depth == 16) - draw_func = display->transparent_bitmap_part; - else -#endif - draw_func = display->bitmap_part; - draw_func(data, 0, height * icon, stride, xpos, ypos, width, height); + display->bmp_part(iconset, 0, height * icon, xpos, ypos, width, height); } void screen_put_cursorxy(struct screen * display, int x, int y, bool on) diff --git a/apps/gui/scrollbar.c b/apps/gui/scrollbar.c index 70d34176e1..aafd4b093a 100644 --- a/apps/gui/scrollbar.c +++ b/apps/gui/scrollbar.c @@ -234,18 +234,7 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap *bm, int x, else if (bm->height < starty + height) height = bm->height - starty; -#if LCD_DEPTH > 1 - if (bm->format == FORMAT_MONO) -#endif - screen->mono_bitmap_part(bm->data, startx, starty, - bm->width, x, y, width, height); -#if LCD_DEPTH > 1 - else - screen->transparent_bitmap_part((fb_data *)bm->data, startx, starty, - STRIDE(screen->screen_type, - bm->width, bm->height), - x, y, width, height); -#endif + screen->bmp_part(bm, startx, starty, x, y, width, height); } void show_busy_slider(struct screen *s, int x, int y, int width, int height) diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 95e4310de9..d2dbb56f64 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c @@ -248,22 +248,8 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) if (pb->backdrop) { struct gui_img *img = pb->backdrop; - char *img_data = core_get_data(img->buflib_handle); -#if LCD_DEPTH > 1 - if(img->bm.format == FORMAT_MONO) { -#endif - display->mono_bitmap_part(img_data, - 0, 0, img->bm.width, - x, y, width, height); -#if LCD_DEPTH > 1 - } else { - display->transparent_bitmap_part((fb_data *)img_data, - 0, 0, - STRIDE(display->screen_type, - img->bm.width, img->bm.height), - x, y, width, height); - } -#endif + img->bm.data = core_get_data(img->buflib_handle); + display->bmp_part(&img->bm, 0, 0, x, y, width, height); flags |= DONT_CLEAR_EXCESS; } @@ -287,7 +273,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) int xoff = 0, yoff = 0; int w = width, h = height; struct gui_img *img = pb->slider; - char *img_data = core_get_data(img->buflib_handle); + img->bm.data = core_get_data(img->buflib_handle); if (flags&HORIZONTAL) { @@ -305,21 +291,7 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) yoff = height - yoff; yoff -= h / 2; } -#if LCD_DEPTH > 1 - if(img->bm.format == FORMAT_MONO) { -#endif - display->mono_bitmap_part(img_data, - 0, 0, img->bm.width, - x + xoff, y + yoff, w, h); -#if LCD_DEPTH > 1 - } else { - display->transparent_bitmap_part((fb_data *)img_data, - 0, 0, - STRIDE(display->screen_type, - img->bm.width, img->bm.height), - x + xoff, y + yoff, w, h); - } -#endif + display->bmp_part(&img->bm, 0, 0, x + xoff, y + yoff, w, h); } if (pb->type == SKIN_TOKEN_PROGRESSBAR) @@ -357,30 +329,14 @@ void clear_image_pos(struct gui_wps *gwps, struct gui_img *img) void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subimage) { struct screen *display = gwps->display; - char *img_data = core_get_data(img->buflib_handle); + img->bm.data = core_get_data(img->buflib_handle); if(img->always_display) display->set_drawmode(DRMODE_FG); else display->set_drawmode(DRMODE_SOLID); -#if LCD_DEPTH > 1 - if(img->bm.format == FORMAT_MONO) { -#endif - display->mono_bitmap_part(img_data, - 0, img->subimage_height * subimage, - img->bm.width, img->x, - img->y, img->bm.width, - img->subimage_height); -#if LCD_DEPTH > 1 - } else { - display->transparent_bitmap_part((fb_data *)img_data, - 0, img->subimage_height * subimage, - STRIDE(display->screen_type, - img->bm.width, img->bm.height), - img->x, img->y, img->bm.width, - img->subimage_height); - } -#endif + display->bmp_part(&img->bm, 0, img->subimage_height * subimage, + img->x, img->y, img->bm.width, img->subimage_height); } -- cgit v1.2.3