From 0793aa7daf4b594fae1b412ab16a7d42d8c8560b Mon Sep 17 00:00:00 2001 From: Olaf Mandel <o.man...@menlosystems.com> Date: Tue, 7 Oct 2014 15:12:08 +0200 Subject: [PATCH 1/2] Images: handle rowstride != width*bytes_per_pixel
Up till now, image data with a rowstride larger than the value expected from width and bytes_per_pixel caused a trapezoid distortion of the displayed image. Signed-off-by: Olaf Mandel <o.man...@menlosystems.com> --- ChangeLog | 7 +++++++ psplash-fb.c | 13 +++++++------ psplash-fb.h | 1 + psplash.c | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8cf2156..f4fd0ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-10-07 Olaf Mandel <o.man...@menlosystems.com> + + * psplash-fb.c: + * psplash-fb.h: + * psplash.c: + Images: handle rowstride != width*bytes_per_pixel + 2009-05-28 Richard Purdie <rpur...@linux.intel.com> * psplash-fb.c: diff --git a/psplash-fb.c b/psplash-fb.c index 71740cd..bd9cd9d 100644 --- a/psplash-fb.c +++ b/psplash-fb.c @@ -370,13 +370,14 @@ psplash_fb_draw_image (PSplashFB *fb, int img_width, int img_height, int img_bytes_per_pixel, + int img_rowstride, uint8 *rle_data) { uint8 *p = rle_data; int dx = 0, dy = 0, total_len; unsigned int len; - total_len = img_width * img_height * img_bytes_per_pixel; + total_len = img_rowstride * img_height; /* FIXME: Optimise, check for over runs ... */ while ((p - rle_data) < total_len) @@ -391,11 +392,11 @@ psplash_fb_draw_image (PSplashFB *fb, do { - if (img_bytes_per_pixel < 4 || *(p+3)) + if ((img_bytes_per_pixel < 4 || *(p+3)) && dx < img_width) psplash_fb_plot_pixel (fb, x+dx, y+dy, *(p), *(p+1), *(p+2)); - if (++dx >= img_width) { dx=0; dy++; } + if (++dx * img_bytes_per_pixel >= img_rowstride) { dx=0; dy++; } } - while (--len && (p - rle_data) < total_len); + while (--len); p += img_bytes_per_pixel; } @@ -405,9 +406,9 @@ psplash_fb_draw_image (PSplashFB *fb, do { - if (img_bytes_per_pixel < 4 || *(p+3)) + if ((img_bytes_per_pixel < 4 || *(p+3)) && dx < img_width) psplash_fb_plot_pixel (fb, x+dx, y+dy, *(p), *(p+1), *(p+2)); - if (++dx >= img_width) { dx=0; dy++; } + if (++dx * img_bytes_per_pixel >= img_rowstride) { dx=0; dy++; } p += img_bytes_per_pixel; } while (--len && (p - rle_data) < total_len); diff --git a/psplash-fb.h b/psplash-fb.h index ef5b39e..42592ed 100644 --- a/psplash-fb.h +++ b/psplash-fb.h @@ -82,6 +82,7 @@ psplash_fb_draw_image (PSplashFB *fb, int img_width, int img_height, int img_bytes_pre_pixel, + int img_rowstride, uint8 *rle_data); void diff --git a/psplash.c b/psplash.c index 09cf0d0..543f67e 100644 --- a/psplash.c +++ b/psplash.c @@ -274,6 +274,7 @@ main (int argc, char** argv) POKY_IMG_WIDTH, POKY_IMG_HEIGHT, POKY_IMG_BYTES_PER_PIXEL, + POKY_IMG_ROWSTRIDE, POKY_IMG_RLE_PIXEL_DATA); /* Draw progress bar border */ @@ -283,6 +284,7 @@ main (int argc, char** argv) BAR_IMG_WIDTH, BAR_IMG_HEIGHT, BAR_IMG_BYTES_PER_PIXEL, + BAR_IMG_ROWSTRIDE, BAR_IMG_RLE_PIXEL_DATA); psplash_draw_progress (fb, 0); -- 1.7.10.4
signature.asc
Description: OpenPGP digital signature
-- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core