Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] Images: handle rowstride != width*bytes_per_pixel
       [not found] <5433FB82.5010106@menlosystems.com>
@ 2014-10-07 16:43 ` Olaf Mandel
  0 siblings, 0 replies; 2+ messages in thread
From: Olaf Mandel @ 2014-10-07 16:43 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton


[-- Attachment #1.1: Type: text/plain, Size: 2 bytes --]



[-- Attachment #1.2: 0001-Images-handle-rowstride-width-bytes_per_pixel.patch --]
[-- Type: text/plain, Size: 3591 bytes --]

From 0793aa7daf4b594fae1b412ab16a7d42d8c8560b Mon Sep 17 00:00:00 2001
From: Olaf Mandel <o.mandel@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.mandel@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.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);
-- 
1.7.10.4



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] Images: handle rowstride != width*bytes_per_pixel
       [not found] <mailman.3924.1412700227.1406.openembedded-core@lists.openembedded.org>
@ 2014-10-07 16:57 ` Olaf Mandel
  0 siblings, 0 replies; 2+ messages in thread
From: Olaf Mandel @ 2014-10-07 16:57 UTC (permalink / raw)
  To: openembedded-core; +Cc: Paul Eggleton

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Am 07.10.2014 18:43, schrieb Olaf Mandel:
> 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>
-Snipp-

Hi,

my apologies: I should have said that this patch and the next are
against the psplash repository:

http://git.yoctoproject.org/cgit/cgit.cgi/psplash

This is why I CCed the pslash maintainer.

Best regards,
Olaf Mandel


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 499 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-07 16:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5433FB82.5010106@menlosystems.com>
2014-10-07 16:43 ` [PATCH 1/2] Images: handle rowstride != width*bytes_per_pixel Olaf Mandel
     [not found] <mailman.3924.1412700227.1406.openembedded-core@lists.openembedded.org>
2014-10-07 16:57 ` Olaf Mandel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox