diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2010-09-29 20:38:08 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2010-09-29 20:38:08 +0000 |
commit | 289e862695a6194ade9f7782cab63a7cbc19c066 (patch) | |
tree | 70f02b68d2f1fea7b1ccb72aaf9469e353776ae9 /apps/plugins/lib/pluginlib_bmp.c | |
parent | 717f0bd982004a3df0445d7747f04ab46ea3f6d5 (diff) |
fix bitmap scallers smooth_resize_bitmap() and simple_resize_bitmap() to properly handle LCD_STRIDEFORMAT == VERTICAL_STRIDE case
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28185 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib/pluginlib_bmp.c')
-rw-r--r-- | apps/plugins/lib/pluginlib_bmp.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/apps/plugins/lib/pluginlib_bmp.c b/apps/plugins/lib/pluginlib_bmp.c index 148aa8e1de..708abfa4a4 100644 --- a/apps/plugins/lib/pluginlib_bmp.c +++ b/apps/plugins/lib/pluginlib_bmp.c @@ -86,31 +86,45 @@ int save_bmp_file( char* filename, struct bitmap *bm ) rb->close( fh ); return 1; } -#endif +#endif /* HAVE_LCD_COLOR */ /** Very simple image scale from src to dst (nearest neighbour). Source and destination dimensions are read from the struct bitmap. + + FB_DATA define is to properly scale with greylib */ +#if LCD_DEPTH > 8 +#define FB_DATA fb_data +#else +#define FB_DATA unsigned char +#endif void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) { +#if defined(LCD_STRIDEFORMAT) && \ + (LCD_STRIDEFORMAT == VERTICAL_STRIDE) + const int srcw = src->height; + const int srch = src->width; + const int dstw = dst->height; + const int dsth = dst->width; +#else const int srcw = src->width; const int srch = src->height; const int dstw = dst->width; const int dsth = dst->height; - const fb_data *srcd = (fb_data*)(src->data); - const fb_data *dstd = (fb_data*)(dst->data); - +#endif + const FB_DATA *srcd = (FB_DATA *)(src->data); + const FB_DATA *dstd = (FB_DATA *)(dst->data); const long xrstep = ((srcw-1) << 8) / (dstw-1); const long yrstep = ((srch-1) << 8) / (dsth-1); - fb_data *src_row, *dst_row; + FB_DATA *src_row, *dst_row; long xr, yr = 0; int src_x, src_y, dst_x, dst_y; for (dst_y=0; dst_y < dsth; dst_y++) { src_y = (yr >> 8); - src_row = (fb_data*)&srcd[src_y * srcw]; - dst_row = (fb_data*)&dstd[dst_y * dstw]; + src_row = (FB_DATA *)&srcd[src_y * srcw]; + dst_row = (FB_DATA *)&dstd[dst_y * dstw]; for (xr=0,dst_x=0; dst_x < dstw; dst_x++) { src_x = (xr >> 8); @@ -120,7 +134,6 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) yr += yrstep; } } - #endif /* LCD_DEPTH > 1 */ #include "wrappers.h" |