LCD: drawing 32bpp uncompressed bitmap image
PATCH 1/2 LCD: drawing 32bpp uncompressed bitmap image
This patch supports drawing 32bpp uncompressed bitmap image.
--- common/lcd.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-)
common/lcd.c +22 -4
@@ -645,14 +645,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 +669,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
@@ -739,8 +739,14 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) height = panel_info.vl_row - y; bmap = (uchar *)bmp +le32_to_cpu (bmp->header.data_offset); + +#ifndef CONFIG_EXYNOS_FB fb = (uchar *) (lcd_base + (y + height -1 ) * lcd_line_length + x * bpix /8 ); +#else + fb = (uchar *) (lcd_base + (y + height) * + (panel_info.vl_col * (bpix /8 )) + x * (bpix /8 )); +#endif switch (bmp_bpix) {case 1 :/* pass through */
@@ -788,9 +794,21 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) bmap += (padded_line - width) *2 ; fb -= (width * 2 + lcd_line_length); } +break ;#endif /* CONFIG_BMP_16BPP */ - +case 32 : +for (i =0 ; i < height; ++i) { +for (j =0 ; j < width; j++) { + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + } + fb -= ((panel_info.vl_col * + (bpix /8 )) + width * (bpix /8 )); + } +break ;default :break ; };
Signature · 1 line
1.7.4.1
PATCH 1/2 LCD: drawing 32bpp uncompressed bitmap image
Hi,
Quoted 12 lines · On Mon, 23 Apr 2012 10:47:07 +0900 Donghwa Lee <[email protected]> wrote:
This patch supports drawing 32bpp uncompressed bitmap image.
Signed-off-by Donghwa Lee <[email protected]>Signed-off-by Kyungmin.park <[email protected]>--- common/lcd.c | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-)common/lcd.c +0
-0
...
common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 749
Quoted 12 lines
common/lcd.c +6
-0@@ -739,8 +739,14 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) height = panel_info.vl_row - y; bmap = (uchar *)bmp +le32_to_cpu (bmp->header.data_offset); + +#ifndef CONFIG_EXYNOS_FB fb = (uchar *) (lcd_base + (y + height -1 ) * lcd_line_length + x * bpix /8 ); +#else + fb = (uchar *) (lcd_base + (y + height) * + (panel_info.vl_col * (bpix /8 )) + x * (bpix /8 )); +#endif
This ifndef shouldn't be needed. Better pass needed 'y' position to the lcd_display_bitmap() function.
common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 797
Quoted 8 lines
common/lcd.c +1
-0switch (bmp_bpix) {case 1 :/* pass through */ @@ -788,9 +794,21 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y) bmap += (padded_line - width) *2 ; fb -= (width *2 + lcd_line_length); } +
Please do not add this empty line here.
common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 809
Quoted 13 lines
common/lcd.c +10
-1break ;#endif /* CONFIG_BMP_16BPP */ - +case 32 : +for (i =0 ; i < height; ++i) { +for (j =0 ; j < width; j++) { + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + *(fb++) = *(bmap++); + } + fb -= ((panel_info.vl_col * + (bpix /8 )) + width * (bpix /8 ));
you can use lcd_line_lenght instead of (panel_info.vl_col * (bpix / 8)) here, i think.
common/lcd.c int lcd_display_bitmap(ulong bmp_image, int x, int y) · line 811
Quoted 2 lines
common/lcd.c +2
-0+ } +break ;
Please surround by
#ifdef CONFIG_BMP_32BPP
...
#endif
so that boards not using 32bpp do not suffer from code size increase.
Thanks,
Anatolij