public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andre Renaud <andre@bluewatersys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix bitmap offsets for non 8-bit LCDs
Date: Thu, 14 Feb 2013 16:48:00 +1300	[thread overview]
Message-ID: <1360813680-20508-1-git-send-email-andre@bluewatersys.com> (raw)

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

Signed-off-by: Andre Renaud <andre@bluewatersys.com>
---
 common/lcd.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 66d4f94..ee47712 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -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)];
-- 
1.7.9.5

             reply	other threads:[~2013-02-14  3:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-14  3:48 Andre Renaud [this message]
2013-03-29 11:08 ` [U-Boot] [PATCH] Fix bitmap offsets for non 8-bit LCDs Anatolij Gustschin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360813680-20508-1-git-send-email-andre@bluewatersys.com \
    --to=andre@bluewatersys.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox