浏览代码

video: fix bug in logo_plot

If logo_plot() should ever be called with x starting
position other than zero and for pixel depths greater
than 8bpp, logo colors distortion will be observed.
This patch fixes the issue.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Anatolij Gustschin 16 年之前
父节点
当前提交
d9015f6a50
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      drivers/video/cfb_console.c

+ 3 - 1
drivers/video/cfb_console.c

@@ -1071,7 +1071,9 @@ void logo_plot (void *screen, int width, int x, int y)
 	int ycount = VIDEO_LOGO_HEIGHT;
 	unsigned char r, g, b, *logo_red, *logo_blue, *logo_green;
 	unsigned char *source;
-	unsigned char *dest = (unsigned char *)screen + ((y * width * VIDEO_PIXEL_SIZE) + x);
+	unsigned char *dest = (unsigned char *)screen +
+			      ((y * width * VIDEO_PIXEL_SIZE) +
+			       x * VIDEO_PIXEL_SIZE);
 
 #ifdef CONFIG_VIDEO_BMP_LOGO
 	source = bmp_logo_bitmap;