Skip to contentSkip to conversation

LCD: display 32bpp decompressed bitmap image

PATCH Superseded Donghwa Lee 1 participant 1 message Apr 30, 2012

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 LCD: display 32bpp decompressed bitmap image

This patch supports drawing 32bpp decompressed bitmap image.

---
Changes for v1/v2:
- use lcd_line_length variable
- convert RGB to BGR because BMP data format aligned BGR.

 common/lcd.c |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)
common/lcd.c +24 -3
index bf1a6a9..460442d 100644
@@ -616,6 +616,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 #if !defined(CONFIG_MCC200)
 	ushort *cmap = NULL;
 #endif
+#if defined(CONFIG_BMP_32BPP)
+	uchar r, g, b, a;
+#endif
 	ushort *cmap_base = NULL;
 	ushort i, j;
 	uchar *fb;
@@ -645,14 +648,14 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 
 	bpix = NBITS(panel_info.vl_bpix);
 
-	if ((bpix != 1) && (bpix != 8) && (bpix != 16)) {
+	if ((bpix != 1) && (bpix != 8) && (bpix != 16) && (bpix != 32)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
 			bpix, bmp_bpix);
 		return 1;
 	}
 
 	/* We support displaying 8bpp BMPs on 16bpp LCDs */
-	if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16)) {
+	if (bpix != bmp_bpix && (bmp_bpix != 8 || bpix != 16 || bpix != 32)) {
 		printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
 			bpix,
 			le16_to_cpu(bmp->header.bit_count));
@@ -669,7 +672,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		cmap = (ushort *)fbi->palette;
 #elif defined(CONFIG_MPC823)
 		cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
-#elif !defined(CONFIG_ATMEL_LCD)
+#elif !defined(CONFIG_ATMEL_LCD) && !defined(CONFIG_EXYNOS_FB)
 		cmap = panel_info.cmap;
 #endif
 
@@ -791,6 +794,24 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		break;
 #endif /* CONFIG_BMP_16BPP */
 
+#if defined(CONFIG_BMP_32BPP)
+	case 32:
+		for (i = 0; i < height; ++i) {
+			for (j = 0; j < width; j++) {
+				b = *(bmap++);
+				g = *(bmap++);
+				r = *(bmap++);
+				a = *(bmap++);
+
+				*(fb++) = r;
+				*(fb++) = g;
+				*(fb++) = b;
+				*(fb++) = a;
+			}
+			fb  -= (lcd_line_length + width * (bpix / 8));
+		}
+		break;
+#endif /* CONFIG_BMP_32BPP */
 	default:
 		break;
 	};
Signature · 1 line
1.7.4.1