Skip to contentSkip to conversation

Fix bitmap offsets for non 8-bit LCDs

PATCH New Andre Renaud 2 participants 2 messages Feb 14, 2013 – Mar 29, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bitmap offsets for non 8-bit LCDs

Currently bitmap logos don't interpret the X coordinate correctly if the bpp is anything other than 8.

---
 common/lcd.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
common/lcd.c +4 -3
index 66d4f94..ee47712 100644
@@ -589,15 +589,16 @@ void bitmap_plot(int x, int y)
 	immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
 	cpm8xx_t *cp = &(immr->im_cpm);
 #endif
+	unsigned bpix = NBITS(panel_info.vl_bpix);
 
 	debug("Logo: width %d  height %d  colors %d  cmap %d\n",
 		BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
 		ARRAY_SIZE(bmp_logo_palette));
 
 	bmap = &bmp_logo_bitmap[0];
-	fb   = (uchar *)(lcd_base + y * lcd_line_length + x);
+	fb   = (uchar *)(lcd_base + y * lcd_line_length + x * bpix / 8);
 
-	if (NBITS(panel_info.vl_bpix) < 12) {
+	if (bpix < 12) {
 		/* Leave room for default color map
 		 * default case: generic system with no cmap (most likely 16bpp)
 		 * cmap was set to the source palette, so no change is done.
@@ -648,7 +649,7 @@ void bitmap_plot(int x, int y)
 	}
 	else { /* true color mode */
 		u16 col16;
-		fb16 = (ushort *)(lcd_base + y * lcd_line_length + x);
+		fb16 = (ushort *)fb;
 		for (i = 0; i < BMP_LOGO_HEIGHT; ++i) {
 			for (j = 0; j < BMP_LOGO_WIDTH; j++) {
 				col16 = bmp_logo_palette[(bmap[j]-16)];
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 Fix bitmap offsets for non 8-bit LCDs

Hello,

Quoted 7 lines · On Thu, 14 Feb 2013 16:48:00 +1300 Andre Renaud <[email protected]> wrote:

Currently bitmap logos don't interpret the X coordinate correctly if the bpp is anything other than 8.

---
 common/lcd.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

applied, thanks!

Anatolij