summaryrefslogtreecommitdiff
path: root/apps/plugins/lib
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-12-11 18:54:50 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-12-11 18:54:50 +0000
commita7d08774dccec1b078ff953be57ac7b5b19bf7e3 (patch)
tree2668af5668fc80d92eafcc8defe787ec496ba7c1 /apps/plugins/lib
parent303cf259d99b66c9c2d21e476f6ca77b99ef0743 (diff)
downloadrockbox-a7d08774dccec1b078ff953be57ac7b5b19bf7e3.zip
rockbox-a7d08774dccec1b078ff953be57ac7b5b19bf7e3.tar.gz
rockbox-a7d08774dccec1b078ff953be57ac7b5b19bf7e3.tar.bz2
rockbox-a7d08774dccec1b078ff953be57ac7b5b19bf7e3.tar.xz
PictureFlow fixes and improvements:
* Reduced popping effect (FS#8303) * Scale the empty slide to average album width * Introduced some visual settings * Fix FS#8298 but make the criteria a screen height of less than 100 px so that only the c200 gets 50x50 slides The scaling code is added as a lib function with a basic test plugin that's not compiled by default. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15913 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r--apps/plugins/lib/bmp.c33
-rw-r--r--apps/plugins/lib/bmp.h6
2 files changed, 39 insertions, 0 deletions
diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c
index dc8432f..03bdc73 100644
--- a/apps/plugins/lib/bmp.c
+++ b/apps/plugins/lib/bmp.c
@@ -82,3 +82,36 @@ int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb )
rb->close( fh );
return 1;
}
+
+/**
+ Very simple image scale from src to dst (nearest neighbour).
+ Source and destination dimensions are read from the struct bitmap.
+*/
+void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst)
+{
+ 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);
+
+ const long xrstep = ((srcw-1) << 8) / (dstw-1);
+ const long yrstep = ((srch-1) << 8) / (dsth-1);
+ 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];
+ for (xr=0,dst_x=0; dst_x < dstw; dst_x++)
+ {
+ src_x = (xr >> 8);
+ dst_row[dst_x] = src_row[src_x];
+ xr += xrstep;
+ }
+ yr += yrstep;
+ }
+}
diff --git a/apps/plugins/lib/bmp.h b/apps/plugins/lib/bmp.h
index dc26e80..e35c1ec 100644
--- a/apps/plugins/lib/bmp.h
+++ b/apps/plugins/lib/bmp.h
@@ -27,4 +27,10 @@
*/
int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb );
+/**
+ Very simple image scale from src to dst (nearest neighbour).
+ Source and destination dimensions are read from the struct bitmap.
+*/
+void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst);
+
#endif