
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