[U-Boot] [PATCH v3] Add 16bpp BMP support

Wolfgang Denk
2009-01-29T10:56:36Z

Dear Mark Jackson,

In message <49817E75.7060907@mimc.co.uk> you wrote:
> >> + bmap += (padded_line - width) * 2;
> >> + fb -= (width * 2 + lcd_line_length);
> >
> > Is it intentional that you reverse padded_line and width here, i.e.
> > you are sure it's not
> >
> > bmap += (width - padded_line) * 2;
> > ?
>
> The "bmap += ..." line is to step forward to the start of the next line of bmp
> data, taking into account any padding bytes.
>
> If I read the code correct, padded_line is defined as ...
>
> padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
>
> ... so it will always be >= width. Correct ?
>
> If so, then ...
>
> bmap += (width - padded_line) * 2;
>
> ... will be <= 0, and so will actually step bmap back into the data you've
> just used, whereas ...
>
> bmap += (padded_line - width) * 2;
>
> ... will be >= 0, and will step forward to the start of the next line as required.
>
> Or have I misunderstood the bmp format and the existing code ?

I don't know - I'm just asking because the 16 bpp case is different
from the 1 and 8 bpp cases where the operands are swapped.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Genius doesn't work on an assembly line basis. You can't simply say,
"Today I will be brilliant."
-- Kirk, "The Ultimate Computer", stardate 4731.3