[U-Boot] [PATCH 5/7] lcd: Fix fb offset calculation for bpix == 16 in BMP display
Nikita Kiryanov
nikita at compulab.co.il
Thu Oct 4 10:48:01 CEST 2012
Hi Simon,
On 09/29/2012 03:11 AM, Simon Glass wrote:
> 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;
>
Why is this change necessary? if bpix == 16 then x * bpix / 8 == 2 * x
anyway.
> switch (bmp_bpix) {
> case 1: /* pass through */
>
More information about the U-Boot
mailing list