From: Wolfgang Denk Date: Thu, 29 Jan 2009 11:56:36 +0100 Subject: [U-Boot] [PATCH v3] Add 16bpp BMP support In-Reply-To: <49817E75.7060907@mimc.co.uk> References: <497F1732.6050901@mimc.co.uk> <20090128211134.A88C2832E416@gemini.denx.de> <49817E75.7060907@mimc.co.uk> Message-ID: <20090129105636.8AC18832E416@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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