[U-Boot] [PATCH 5/7] lcd: Fix fb offset calculation for bpix == 16 in BMP display

Simon Glass sjg at chromium.org
Sat Sep 29 03:11:15 CEST 2012


From: Tom Wai-Hong Tam <waihong at chromium.org>

For bpix == 16, each pixel is 2-byte. fb offset should shift more x bytes.

Signed-off-by: Tom Wai-Hong Tam <waihong at chromium.org>
Signed-off-by: Simon Glass <sjg at chromium.org>
---
 common/lcd.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 7c6cb09..004a6be 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -775,8 +775,10 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		height = panel_info.vl_row - y;
 
 	bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset);
-	fb   = (uchar *) (lcd_base +
-		(y + height - 1) * lcd_line_length + x * bpix / 8);
+	fb   = (uchar *) (lcd_base + (y + height - 1) * lcd_line_length + x);
+	/* additional fb shift for bpix == 16 since each pixel is 2-byte */
+	if (bpix == 16)
+		fb += x;
 
 	switch (bmp_bpix) {
 	case 1: /* pass through */
-- 
1.7.7.3



More information about the U-Boot mailing list