summaryrefslogtreecommitdiff
path: root/common/lcd.c
diff options
context:
space:
mode:
authorHannes Petermaier <oe5hpm@oevsv.at>2014-07-15 16:28:46 +0200
committerAnatolij Gustschin <agust@denx.de>2014-08-11 18:07:09 +0200
commita305fb155ea3d9c3c3859bd04737e3e260344e4c (patch)
treedb48cda4bcbc02361a932e567c7232c173caf1f7 /common/lcd.c
parent072f210a0d394ba9083323b8bbce6822f1cc2ecb (diff)
downloadu-boot-imx-a305fb155ea3d9c3c3859bd04737e3e260344e4c.zip
u-boot-imx-a305fb155ea3d9c3c3859bd04737e3e260344e4c.tar.gz
u-boot-imx-a305fb155ea3d9c3c3859bd04737e3e260344e4c.tar.bz2
lcd: support displaying 24bpp BMPs on >= 24bpp LCDs
most todays LCDs support 32bpp e.g. the framebuffer memory is 32bpp organized. To support 24bpp BMPs we need to take only 3 byte from the bpp and set one byte from the FB to 0. Signed-off-by: Hannes Petermaier <oe5hpm@oevsv.at>
Diffstat (limited to 'common/lcd.c')
-rw-r--r--common/lcd.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/common/lcd.c b/common/lcd.c
index c4634fe..217ec9d 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -942,8 +942,13 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
return 1;
}
- /* We support displaying 8bpp BMPs on 16bpp LCDs */
- if (bpix != bmp_bpix && !(bmp_bpix == 8 && bpix == 16)) {
+ /*
+ * We support displaying 8bpp BMPs on 16bpp LCDs
+ * and displaying 24bpp BMPs on 32bpp LCDs
+ * */
+ if (bpix != bmp_bpix &&
+ !(bmp_bpix == 8 && bpix == 16) &&
+ !(bmp_bpix == 24 && bpix == 32)) {
printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
bpix, get_unaligned_le16(&bmp->header.bit_count));
return 1;
@@ -1064,7 +1069,19 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
}
break;
#endif /* CONFIG_BMP_16BPP */
-
+#if defined(CONFIG_BMP_24BMP)
+ case 24:
+ for (i = 0; i < height; ++i) {
+ for (j = 0; j < width; j++) {
+ *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
+ *(fb++) = *(bmap++);
+ *(fb++) = 0;
+ }
+ fb -= lcd_line_length + width * (bpix / 8);
+ }
+ break;
+#endif /* CONFIG_BMP_24BMP */
#if defined(CONFIG_BMP_32BPP)
case 32:
for (i = 0; i < height; ++i) {