Add stride defines to support vertical strides

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22546 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Karl Kurbjun 2009-08-29 19:31:29 +00:00
parent 47541e5f2f
commit 7bb7c5f0cc
5 changed files with 29 additions and 10 deletions

View file

@ -124,6 +124,7 @@ void screen_put_iconxy(struct screen * display,
int screen = display->screen_type; int screen = display->screen_type;
int width = ICON_WIDTH(screen); int width = ICON_WIDTH(screen);
int height = ICON_HEIGHT(screen); int height = ICON_HEIGHT(screen);
int stride;
screen_bitmap_part_func *draw_func = NULL; screen_bitmap_part_func *draw_func = NULL;
if (icon == Icon_NOICON) if (icon == Icon_NOICON)
@ -143,14 +144,19 @@ void screen_put_iconxy(struct screen * display,
return; return;
} }
data = viewer_iconset[screen].data; data = viewer_iconset[screen].data;
stride = STRIDE( viewer_iconset[screen].width,
viewer_iconset[screen].height);
} }
else if (custom_icons_loaded[screen]) else if (custom_icons_loaded[screen])
{ {
data = user_iconset[screen].data; data = user_iconset[screen].data;
stride = STRIDE( user_iconset[screen].width,
user_iconset[screen].height);
} }
else else
{ {
data = inbuilt_icons[screen]; data = inbuilt_icons[screen];
stride = STRIDE(BMPWIDTH_default_icons, BMPHEIGHT_default_icons);
} }
/* add some left padding to the icons if they are on the edge */ /* add some left padding to the icons if they are on the edge */
if (xpos == 0) if (xpos == 0)
@ -163,7 +169,7 @@ void screen_put_iconxy(struct screen * display,
#endif #endif
draw_func = display->bitmap_part; draw_func = display->bitmap_part;
draw_func(data, 0, height * icon, width, xpos, ypos, width, height); draw_func(data, 0, height * icon, stride, xpos, ypos, width, height);
} }
void screen_put_cursorxy(struct screen * display, int x, int y, bool on) void screen_put_cursorxy(struct screen * display, int x, int y, bool on)

View file

@ -202,7 +202,8 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm, int x,
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
else else
screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0, screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0,
bm.width, x + start, y, size, height); STRIDE(bm.width, bm.height),
x + start, y, size, height);
#endif #endif
} else { } else {
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
@ -213,7 +214,8 @@ void gui_bitmap_scrollbar_draw(struct screen * screen, struct bitmap bm, int x,
#if LCD_DEPTH > 1 #if LCD_DEPTH > 1
else else
screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0, screen->transparent_bitmap_part((fb_data *)bm.data, 0, 0,
bm.width, x, y + start, width, size); STRIDE(bm.width, bm.height),
x, y + start, width, size);
#endif #endif
} }
} }

View file

@ -232,8 +232,8 @@ static void wps_draw_image(struct gui_wps *gwps, struct gui_img *img, int subima
} else { } else {
display->transparent_bitmap_part((fb_data *)img->bm.data, display->transparent_bitmap_part((fb_data *)img->bm.data,
0, img->subimage_height * subimage, 0, img->subimage_height * subimage,
img->bm.width, img->x, STRIDE(img->bm.width, img->bm.height),
img->y, img->bm.width, img->x, img->y, img->bm.width,
img->subimage_height); img->subimage_height);
} }
#endif #endif

View file

@ -206,6 +206,10 @@
#define RGB565 565 #define RGB565 565
#define RGB565SWAPPED 3553 #define RGB565SWAPPED 3553
/* LCD_STRIDEFORMAT */
#define VERTICAL_STRIDE 1
#define HORIZONTAL_STRIDE 2
/* CONFIG_ORIENTATION */ /* CONFIG_ORIENTATION */
#define SCREEN_PORTRAIT 0 #define SCREEN_PORTRAIT 0
#define SCREEN_LANDSCAPE 1 #define SCREEN_LANDSCAPE 1

View file

@ -306,6 +306,13 @@ static inline unsigned lcd_color_to_native(unsigned color)
#endif /* HAVE_LCD_COLOR */ #endif /* HAVE_LCD_COLOR */
/* Frame buffer stride */
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
#define STRIDE(w, h) (h)
#else
#define STRIDE(w, h) (w)
#endif
/* Frame buffer dimensions */ /* Frame buffer dimensions */
#if LCD_DEPTH == 1 #if LCD_DEPTH == 1
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING #if LCD_PIXELFORMAT == HORIZONTAL_PACKING