diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2008-12-26 07:05:13 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2008-12-26 07:05:13 +0000 |
commit | 9058620849c080a404fb156915856f9d0b06e71c (patch) | |
tree | 004590b20a5ea0fa6b099f5332af162896e44098 /apps/plugins/lib | |
parent | f7fa7e5ad537415f1f75b3a9c1a58eb925e10d04 (diff) |
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/lib')
-rw-r--r-- | apps/plugins/lib/grey.h | 1 | ||||
-rw-r--r-- | apps/plugins/lib/grey_draw.c | 19 |
2 files changed, 20 insertions, 0 deletions
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 +}; |