public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] video: Fix line padding calculation for 16 and 24 BPP bitmaps
       [not found] <CGME20201201113117eucas1p18b5d1379afd4146731a26b9cb922dbc1@eucas1p1.samsung.com>
@ 2020-12-01 11:30 ` Sylwester Nawrocki
  2020-12-01 21:59   ` Jaehoon Chung
  2021-04-11 19:08   ` Anatolij Gustschin
  0 siblings, 2 replies; 3+ messages in thread
From: Sylwester Nawrocki @ 2020-12-01 11:30 UTC (permalink / raw)
  To: u-boot

Each row in the pixel array in the bitmap file is padded
if necessary so the row size is always a multiple of 4 bytes.
In current code the complement of row size to a multiple of
4 bytes is further unnecessarily multiplied by the pixel size.
This results in incorrect displaying of bitmaps having row size
that is not a multiple of 4 bytes. Fix this by removing
the unnecessary multiplication.

Tested with 24BPP bitmap and XRGB32 display.

Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
---
 drivers/video/video_bmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 5a4d12c68d..5537378781 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -328,7 +328,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 			for (j = 0; j < width; j++)
 				fb_put_word(&fb, &bmap);
 
-			bmap += (padded_width - width) * 2;
+			bmap += (padded_width - width);
 			fb -= width * 2 + priv->line_length;
 		}
 		break;
@@ -352,7 +352,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
 				}
 			}
 			fb -= priv->line_length + width * (bpix / 8);
-			bmap += (padded_width - width) * 3;
+			bmap += (padded_width - width);
 		}
 		break;
 #endif /* CONFIG_BMP_24BPP */
-- 
2.17.1

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

* [PATCH] video: Fix line padding calculation for 16 and 24 BPP bitmaps
  2020-12-01 11:30 ` [PATCH] video: Fix line padding calculation for 16 and 24 BPP bitmaps Sylwester Nawrocki
@ 2020-12-01 21:59   ` Jaehoon Chung
  2021-04-11 19:08   ` Anatolij Gustschin
  1 sibling, 0 replies; 3+ messages in thread
From: Jaehoon Chung @ 2020-12-01 21:59 UTC (permalink / raw)
  To: u-boot

On 12/1/20 8:30 PM, Sylwester Nawrocki wrote:
> Each row in the pixel array in the bitmap file is padded
> if necessary so the row size is always a multiple of 4 bytes.
> In current code the complement of row size to a multiple of
> 4 bytes is further unnecessarily multiplied by the pixel size.
> This results in incorrect displaying of bitmaps having row size
> that is not a multiple of 4 bytes. Fix this by removing
> the unnecessary multiplication.
> 
> Tested with 24BPP bitmap and XRGB32 display.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>

Tested-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> ---
>  drivers/video/video_bmp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
> index 5a4d12c68d..5537378781 100644
> --- a/drivers/video/video_bmp.c
> +++ b/drivers/video/video_bmp.c
> @@ -328,7 +328,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
>  			for (j = 0; j < width; j++)
>  				fb_put_word(&fb, &bmap);
>  
> -			bmap += (padded_width - width) * 2;
> +			bmap += (padded_width - width);
>  			fb -= width * 2 + priv->line_length;
>  		}
>  		break;
> @@ -352,7 +352,7 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
>  				}
>  			}
>  			fb -= priv->line_length + width * (bpix / 8);
> -			bmap += (padded_width - width) * 3;
> +			bmap += (padded_width - width);
>  		}
>  		break;
>  #endif /* CONFIG_BMP_24BPP */
> 

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

* [PATCH] video: Fix line padding calculation for 16 and 24 BPP bitmaps
  2020-12-01 11:30 ` [PATCH] video: Fix line padding calculation for 16 and 24 BPP bitmaps Sylwester Nawrocki
  2020-12-01 21:59   ` Jaehoon Chung
@ 2021-04-11 19:08   ` Anatolij Gustschin
  1 sibling, 0 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2021-04-11 19:08 UTC (permalink / raw)
  To: u-boot

On Tue,  1 Dec 2020 12:30:50 +0100
Sylwester Nawrocki s.nawrocki at samsung.com wrote:

> Each row in the pixel array in the bitmap file is padded
> if necessary so the row size is always a multiple of 4 bytes.
> In current code the complement of row size to a multiple of
> 4 bytes is further unnecessarily multiplied by the pixel size.
> This results in incorrect displaying of bitmaps having row size
> that is not a multiple of 4 bytes. Fix this by removing
> the unnecessary multiplication.
> 
> Tested with 24BPP bitmap and XRGB32 display.
> 
> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> ---
>  drivers/video/video_bmp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-video/master, thanks!

--
Anatolij

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

end of thread, other threads:[~2021-04-11 19:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20201201113117eucas1p18b5d1379afd4146731a26b9cb922dbc1@eucas1p1.samsung.com>
2020-12-01 11:30 ` [PATCH] video: Fix line padding calculation for 16 and 24 BPP bitmaps Sylwester Nawrocki
2020-12-01 21:59   ` Jaehoon Chung
2021-04-11 19:08   ` Anatolij Gustschin

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