From 539c513fe60f9277105edb1916685594338ac671 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Mon, 16 Apr 2007 23:55:19 +0000 Subject: Temporary fix for remote bitmap functions in the multi-screen API. Fixed icon.c to use this. Also fixed crash due to missing assignment of lcd_bitmap[_part] for monochrome main LCDs. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13187 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/icon.c | 33 +++++++++++---------------------- apps/screen_access.c | 26 +++++++++++++++++--------- apps/screen_access.h | 13 +++++++++---- 3 files changed, 37 insertions(+), 35 deletions(-) (limited to 'apps') diff --git a/apps/gui/icon.c b/apps/gui/icon.c index 93b1643cd9..cc92b96c27 100644 --- a/apps/gui/icon.c +++ b/apps/gui/icon.c @@ -116,16 +116,14 @@ void screen_put_icon_with_offset(struct screen * display, } /* x,y in pixels */ -typedef void (*lcd_draw_func)(const fb_data *src, int src_x, int src_y, - int stride, int x, int y, int width, int height); -void screen_put_iconxy(struct screen * display, +void screen_put_iconxy(struct screen * display, int xpos, int ypos, enum themable_icons icon) { - fb_data *data; + const void *data; int screen = display->screen_type; int width = ICON_WIDTH(screen); int height = ICON_HEIGHT(screen); - lcd_draw_func draw_func = NULL; + screen_bitmap_part_func *draw_func = NULL; if (icon == Icon_NOICON) { @@ -148,37 +146,28 @@ void screen_put_iconxy(struct screen * display, screen_clear_area(display, xpos, ypos, width, height); return; } - data = (fb_data *)viewer_iconset[screen].data; + data = viewer_iconset[screen].data; } else if (custom_icons_loaded[screen]) { - data = (fb_data *)user_iconset[screen].data; + data = user_iconset[screen].data; } else { - data = (fb_data *)inbuilt_icons[screen]; + data = inbuilt_icons[screen]; } /* add some left padding to the icons if they are on the edge */ if (xpos == 0) xpos++; -#ifdef HAVE_REMOTE_LCD - if (display->screen_type == SCREEN_REMOTE) - { - /* Quick and Dirty hack untill lcd bitmap drawing is fixed */ - draw_func = (lcd_draw_func)lcd_remote_bitmap_part; - } +#if (LCD_DEPTH == 16) || (LCD_REMOTE_DEPTH == 16) + if (display->depth == 16) + draw_func = display->transparent_bitmap_part; else #endif -#if LCD_DEPTH == 16 - draw_func = display->transparent_bitmap_part; -#else /* LCD_DEPTH < 16 */ draw_func = display->bitmap_part; -#endif /* LCD_DEPTH == 16 */ - - draw_func( (const fb_data *)data, - 0, height * icon, width, xpos, ypos, - width, height); + + draw_func(data, 0, height * icon, width, xpos, ypos, width, height); } void screen_put_cursorxy(struct screen * display, int x, int y, bool on) diff --git a/apps/screen_access.c b/apps/screen_access.c index 03687a3dbb..a642b65d20 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c @@ -52,7 +52,15 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->setfont(FONT_UI); screen->mono_bitmap=&lcd_remote_mono_bitmap; screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part; + screen->bitmap=(screen_bitmap_func*)&lcd_remote_bitmap; + screen->bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part; screen->set_drawmode=&lcd_remote_set_drawmode; +#if LCD_DEPTH <= 2 + /* No transparency yet for grayscale and mono lcd */ + screen->transparent_bitmap=(screen_bitmap_func*)&lcd_remote_bitmap; + screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_remote_bitmap_part; + /* No colour remotes yet */ +#endif #if LCD_REMOTE_DEPTH > 1 #if defined(HAVE_LCD_COLOR) screen->color_to_native=&lcd_remote_color_to_native; @@ -122,17 +130,17 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->mono_bitmap=&lcd_mono_bitmap; screen->mono_bitmap_part=&lcd_mono_bitmap_part; screen->set_drawmode=&lcd_set_drawmode; -#if LCD_DEPTH > 1 - screen->bitmap=&lcd_bitmap; - screen->bitmap_part=&lcd_bitmap_part; -#if LCD_DEPTH == 2 - /* No transparency yet for grayscale lcd */ - screen->transparent_bitmap=&lcd_bitmap; - screen->transparent_bitmap_part=&lcd_bitmap_part; + screen->bitmap=(screen_bitmap_func*)&lcd_bitmap; + screen->bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part; +#if LCD_DEPTH <= 2 + /* No transparency yet for grayscale and mono lcd */ + screen->transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap; + screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_part; #else - screen->transparent_bitmap=&lcd_bitmap_transparent; - screen->transparent_bitmap_part=&lcd_bitmap_transparent_part; + screen->transparent_bitmap=(screen_bitmap_func*)&lcd_bitmap_transparent; + screen->transparent_bitmap_part=(screen_bitmap_part_func*)&lcd_bitmap_transparent_part; #endif +#if LCD_DEPTH > 1 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1 screen->color_to_native=&lcd_color_to_native; #endif diff --git a/apps/screen_access.h b/apps/screen_access.h index bc5fdf3f55..e40943f003 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h @@ -46,6 +46,11 @@ enum screen_type { #define MAX_LINES_ON_SCREEN 2 #endif +typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y, + int stride, int x, int y, int width, int height); +typedef void screen_bitmap_func(const void *src, int x, int y, int width, + int height); + struct screen { int width, height; @@ -79,13 +84,13 @@ struct screen int x, int y, int width, int height); void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y, int stride, int x, int y, int width, int height); - void (*bitmap)(const fb_data *src, + void (*bitmap)(const void *src, int x, int y, int width, int height); - void (*bitmap_part)(const fb_data *src, int src_x, int src_y, + void (*bitmap_part)(const void *src, int src_x, int src_y, int stride, int x, int y, int width, int height); - void (*transparent_bitmap)(const fb_data *src, + void (*transparent_bitmap)(const void *src, int x, int y, int width, int height); - void (*transparent_bitmap_part)(const fb_data *src, int src_x, int src_y, + void (*transparent_bitmap_part)(const void *src, int src_x, int src_y, int stride, int x, int y, int width, int height); void (*set_drawmode)(int mode); #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1 -- cgit v1.2.3