summaryrefslogtreecommitdiffstats
path: root/apps/plugins
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2008-12-26 07:05:13 +0000
committerAndrew Mahone <andrew.mahone@gmail.com>2008-12-26 07:05:13 +0000
commit9058620849c080a404fb156915856f9d0b06e71c (patch)
tree004590b20a5ea0fa6b099f5332af162896e44098 /apps/plugins
parentf7fa7e5ad537415f1f75b3a9c1a58eb925e10d04 (diff)
downloadrockbox-9058620849c080a404fb156915856f9d0b06e71c.tar.gz
rockbox-9058620849c080a404fb156915856f9d0b06e71c.tar.bz2
rockbox-9058620849c080a404fb156915856f9d0b06e71c.zip
Make scaler output truly pluggable, add an 8-bit greyscale output to
pluginlib for use with greylib, and add source for a test scaled bmp viewer using greylib. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19593 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/CATEGORIES1
-rw-r--r--apps/plugins/lib/grey.h1
-rw-r--r--apps/plugins/lib/grey_draw.c19
-rw-r--r--apps/plugins/pictureflow.c2
-rw-r--r--apps/plugins/rockpaint.c2
-rw-r--r--apps/plugins/sliding_puzzle.c3
-rw-r--r--apps/plugins/test_resize.c2
-rw-r--r--apps/plugins/viewers.config1
8 files changed, 27 insertions, 4 deletions
diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES
index 750d149aeb..09a4476db0 100644
--- a/apps/plugins/CATEGORIES
+++ b/apps/plugins/CATEGORIES
@@ -92,6 +92,7 @@ test_sampr,apps
test_scanrate,apps
test_touchscreen,apps
test_viewports,apps
+test_greylib_bitmap_scale,viewers
text_editor,apps
vbrfix,viewers
video,viewers
diff --git a/apps/plugins/lib/grey.h b/apps/plugins/lib/grey.h
index 8f8de9db99..8c9d40ab8d 100644
--- a/apps/plugins/lib/grey.h
+++ b/apps/plugins/lib/grey.h
@@ -106,6 +106,7 @@ void grey_ub_gray_bitmap_part(const unsigned char *src, int src_x, int src_y,
int stride, int x, int y, int width, int height);
void grey_ub_gray_bitmap(const unsigned char *src, int x, int y, int width,
int height);
+extern const struct custom_format format_grey;
/* Text */
void grey_putsxyofs(int x, int y, int ofs, const unsigned char *str);
diff --git a/apps/plugins/lib/grey_draw.c b/apps/plugins/lib/grey_draw.c
index e9812b6784..51d340dd7f 100644
--- a/apps/plugins/lib/grey_draw.c
+++ b/apps/plugins/lib/grey_draw.c
@@ -669,3 +669,22 @@ void grey_ub_gray_bitmap(const unsigned char *src, int x, int y, int width,
{
grey_ub_gray_bitmap_part(src, 0, 0, width, x, y, width, height);
}
+
+static void output_row_grey(uint32_t row, void * row_in, struct scaler_context *ctx)
+{
+ int col;
+ uint32_t *qp = (uint32_t*)row_in;
+ uint8_t *dest = (uint8_t*)ctx->bm->data + ctx->bm->width * row;
+ for (col = 0; col < ctx->bm->width; col++)
+ *dest++ = ((*qp++) + ctx->round) * (uint64_t)ctx->divisor >> 32;
+}
+
+static unsigned int get_size_grey(struct bitmap *bm)
+{
+ return bm->width * bm->height;
+}
+
+const struct custom_format format_grey = {
+ .output_row = output_row_grey,
+ .get_size = get_size_grey
+};
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c
index 150d88212f..0dd9f924d7 100644
--- a/apps/plugins/pictureflow.c
+++ b/apps/plugins/pictureflow.c
@@ -636,7 +636,7 @@ bool create_albumart_cache(bool force)
input_bmp.data = (char *)input_bmp_buffer;
ret = rb->read_bmp_file(arlbumart_file, &input_bmp,
sizeof(fb_data)*MAX_IMG_WIDTH*MAX_IMG_HEIGHT,
- FORMAT_NATIVE);
+ FORMAT_NATIVE, NULL);
if (ret <= 0) {
rb->splash(HZ, "Could not read bmp");
continue; /* skip missing/broken files */
diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c
index 300821b3a4..40d19101fc 100644
--- a/apps/plugins/rockpaint.c
+++ b/apps/plugins/rockpaint.c
@@ -2967,7 +2967,7 @@ static int load_bitmap( const char *file )
bm.data = (char*)save_buffer;
ret = rb->read_bmp_file( file, &bm, ROWS*COLS*sizeof( fb_data ),
- FORMAT_NATIVE );
+ FORMAT_NATIVE, NULL );
if((bm.width > COLS ) || ( bm.height > ROWS ))
return -1;
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index fa9e093c3c..8a607c9272 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -340,7 +340,8 @@ static bool load_resize_bitmap(void)
rc = rb->read_bmp_file( filename, &main_bitmap,
sizeof(img_buf),
- FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER);
+ FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_DITHER,
+ NULL);
if( rc > 0 )
{
puzzle_bmp_ptr = (const fb_data *)img_buf;
diff --git a/apps/plugins/test_resize.c b/apps/plugins/test_resize.c
index b0ef787d36..a608005c10 100644
--- a/apps/plugins/test_resize.c
+++ b/apps/plugins/test_resize.c
@@ -78,7 +78,7 @@ enum plugin_status plugin_start(const struct plugin_api* api, const void* parame
output_bmp.data = (char*)output_bmp_data;
int ret = rb->read_bmp_file("/test.bmp", &input_bmp, sizeof(input_bmp_data),
- FORMAT_NATIVE);
+ FORMAT_NATIVE, NULL);
if (ret < 0) {
rb->splash(HZ, "Could not load /test.bmp");
diff --git a/apps/plugins/viewers.config b/apps/plugins/viewers.config
index e2babf6134..2ec8fe9299 100644
--- a/apps/plugins/viewers.config
+++ b/apps/plugins/viewers.config
@@ -25,6 +25,7 @@ wav,viewers/mp3_encoder,-
wav,viewers/wavplay,9
wav,viewers/wavview,10
wav,viewers/test_codec,-
+bmp,viewers/test_greylib_bitmap_scale,-
bmp,apps/rockpaint,11
bmp,games/sliding_puzzle,11
mpg,viewers/mpegplayer,4