aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlaf Mandel <o.mandel@menlosystems.com>2014-10-07 15:12:08 +0200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2014-10-31 15:24:47 +0000
commitbea784ad25deef6e7d5ed50450d0b347f30f180b (patch)
tree7141add3def825ef4277ff06419cc508ad3a653c
parentafd4e228c606a9998feae44a3fed4474803240b7 (diff)
downloadpsplash-bea784ad25deef6e7d5ed50450d0b347f30f180b.tar.gz
psplash-bea784ad25deef6e7d5ed50450d0b347f30f180b.tar.bz2
psplash-bea784ad25deef6e7d5ed50450d0b347f30f180b.zip
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.mandel@menlosystems.com>
-rw-r--r--ChangeLog7
-rw-r--r--psplash-fb.c13
-rw-r--r--psplash-fb.h1
-rw-r--r--psplash.c2
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.mandel@menlosystems.com>
+
+ * psplash-fb.c:
+ * psplash-fb.h:
+ * psplash.c:
+ Images: handle rowstride != width*bytes_per_pixel
+
2009-05-28 Richard Purdie <rpurdie@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);