diff options
author | Tom Wai-Hong Tam <waihong@google.com> | 2011-01-06 17:52:52 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 10:00:12 -0700 |
commit | 67d2730cd01b43defddda8ec572df4a0042424d5 (patch) | |
tree | a2fa54c86af08301b594a014193cebb98fcd714d /common/lcd.c | |
parent | 100755c35aa3b644d8fbd2ec9b6feab6d5d5d6fe (diff) |
Fix BMP rendering bug, wrong fb offset calculation for bpix == 16.
For bpix == 16, each pixel is 2-byte. fb offset should shift more x bytes.
BUG=chromium-os:10499
TEST=build, boot, and "bmp display BMP_ADDR 100 100" to see the right offset.
Change-Id: I72fe585d0d8d6f44c66b1a379e575c8f00f1a91d
Review URL: http://codereview.chromium.org/6110001
Diffstat (limited to 'common/lcd.c')
-rw-r--r-- | common/lcd.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/common/lcd.c b/common/lcd.c index 39a01561a3a..cdeb21afadc 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -729,9 +729,11 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) if ((y + height)>panel_info.vl_row) 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); + bmap = (uchar *)bmp + le32_to_cpu(bmp->header.data_offset); + 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 */ |