diff options
author | Thomas Martitz <kugel@rockbox.org> | 2011-11-11 19:05:11 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2011-11-11 19:05:11 +0000 |
commit | 312b2a2de7a35f8c4b0dc355b7b291085a9a5ea4 (patch) | |
tree | 922fc139712760cd89c0caa7c3724b5a5020765c /apps/recorder/resize.c | |
parent | 158e14a8c696b29ec7fa21da5b1a801c31c473e9 (diff) |
Document the internal alpha channel format better, and fixes for 32bit alpha bitmaps.
For images, rows need to be even (this is not true for anti-aliased font files).
Fix stride and size calculation. This makes images that have odd pixel rows display properly and fixes buffer overflows.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30966 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/resize.c')
-rw-r--r-- | apps/recorder/resize.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apps/recorder/resize.c b/apps/recorder/resize.c index a68a5f2e9f..dd1f3edf88 100644 --- a/apps/recorder/resize.c +++ b/apps/recorder/resize.c @@ -775,7 +775,7 @@ static void output_row_32_native(uint32_t row, void * row_in, if (ctx->bm->alpha_offset > 0) bm_alpha = ctx->bm->data + ctx->bm->alpha_offset; if (bm_alpha) - bm_alpha += ctx->bm->width*row/2; + bm_alpha += ALIGN_UP(ctx->bm->width, 2)*row/2; for (col = 0; col < ctx->bm->width; col++) { if (ctx->dither) @@ -791,7 +791,7 @@ static void output_row_32_native(uint32_t row, void * row_in, dest += STRIDE_MAIN(1, ctx->bm->height); if (bm_alpha) { /* pack alpha channel for 2 pixels into 1 byte */ - unsigned alpha = 255-SC_OUT(q0.a, ctx); + unsigned alpha = SC_OUT(q0.a, ctx); if (col%2) *bm_alpha++ |= alpha&0xf0; else |