From: Simon Glass <sjg@chromium.org> When the pixel colour matches the transparency colour, skip writing it to the display. Signed-off-by: Simon Glass <sjg@chromium.org> --- drivers/video/video_bmp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c index 88a327e4a6d..9c9d9b2091b 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -388,6 +388,15 @@ static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, u8 red = bmap[0]; u8 green = bmap[1]; u8 blue = bmap[2]; + u32 pixel_color = (red << 16) | + (green << 8) | blue; + + bmap += 3; + /* Skip transparent pixels if alpha enabled */ + if (alpha && pixel_color == acolour) { + fb += bpix / 8; + continue; + } if (bpix == 16) { /* 16bit 565RGB format */ @@ -423,7 +432,6 @@ static int draw_bmp(struct udevice *dev, ulong bmp_image, int x, int y, *fb++ = blue; *fb++ = 0; } - bmap += 3; } fb -= priv->line_length + width * (bpix / 8); bmap += (padded_width - width); -- 2.43.0