Images: handle rowstride != width*bytes_per_pixel
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 Images: handle rowstride != width*bytes_per_pixel
From 0793aa7daf4b594fae1b412ab16a7d42d8c8560b Mon Sep 17 00:00:00 2001
From: Olaf Mandel <[email protected]>
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 <[email protected]>
--- ChangeLog | 7 +++++++ psplash-fb.c | 13 +++++++------ psplash-fb.h | 1 + psplash.c | 2 ++ 4 files changed, 17 insertions(+), 6 deletions(-)
ChangeLog +7 -0
@@ -1,3 +1,10 @@ +2014-10-07 Olaf Mandel <[email protected]> + + * psplash-fb.c: + * psplash-fb.h: + * psplash.c: + Images: handle rowstride != width*bytes_per_pixel + 2009-05-28 Richard Purdie <[email protected]> * psplash-fb.c:
psplash-fb.c +7 -6
@@ -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);
psplash-fb.h +1 -0
@@ -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
psplash.c +2 -0
@@ -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 );
Signature · 1 line
1.7.10.4