From 440aaa92b3954854f0735f36135e6d04a659b42f Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Wed, 25 Nov 2020 12:13:12 +0100 Subject: [PATCH] video: Fix line padding calculation for 16 and 24 bpp bitmaps The line size in the bitmap file is 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 result in incorrect displaying of bitmaps with image width which is not multiple of 4 pixels. Fix this by removing the unnecessary multiplication. Tested with 24BPP bitmap and XRGB32 display. Change-Id: I9bd307780e388a70f47823444fe3ecdf910d08fb Signed-off-by: Sylwester Nawrocki --- 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.34.1