mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-22 07:32:03 +00:00
video: Drop #ifdefs from video_bmp
Convert the current preprocessor macros to C code. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
4ea1548210
commit
cd4fb0f054
1 changed files with 51 additions and 50 deletions
|
@ -66,7 +66,6 @@ static void write_pix8(u8 *fb, uint bpix, struct bmp_color_table_entry *palette,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_VIDEO_BMP_RLE8
|
|
||||||
static void draw_unencoded_bitmap(u8 **fbp, uint bpix, uchar *bmap,
|
static void draw_unencoded_bitmap(u8 **fbp, uint bpix, uchar *bmap,
|
||||||
struct bmp_color_table_entry *palette,
|
struct bmp_color_table_entry *palette,
|
||||||
int cnt)
|
int cnt)
|
||||||
|
@ -183,7 +182,6 @@ static void video_display_rle8_bitmap(struct udevice *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* video_splash_align_axis() - Align a single coordinate
|
* video_splash_align_axis() - Align a single coordinate
|
||||||
|
@ -294,16 +292,19 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
|
||||||
|
|
||||||
switch (bmp_bpix) {
|
switch (bmp_bpix) {
|
||||||
case 1:
|
case 1:
|
||||||
case 8: {
|
case 8:
|
||||||
#ifdef CONFIG_VIDEO_BMP_RLE8
|
if (IS_ENABLED(CONFIG_VIDEO_BMP_RLE8)) {
|
||||||
u32 compression = get_unaligned_le32(&bmp->header.compression);
|
u32 compression = get_unaligned_le32(
|
||||||
debug("compressed %d %d\n", compression, BMP_BI_RLE8);
|
&bmp->header.compression);
|
||||||
if (compression == BMP_BI_RLE8) {
|
debug("compressed %d %d\n", compression, BMP_BI_RLE8);
|
||||||
video_display_rle8_bitmap(dev, bmp, bpix, palette, fb,
|
if (compression == BMP_BI_RLE8) {
|
||||||
x, y, width, height);
|
video_display_rle8_bitmap(dev, bmp, bpix, palette, fb,
|
||||||
break;
|
x, y, width, height);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
/* Not compressed */
|
||||||
byte_width = width * (bpix / 8);
|
byte_width = width * (bpix / 8);
|
||||||
if (!byte_width)
|
if (!byte_width)
|
||||||
byte_width = width;
|
byte_width = width;
|
||||||
|
@ -319,56 +320,56 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y,
|
||||||
fb -= byte_width + priv->line_length;
|
fb -= byte_width + priv->line_length;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
#if defined(CONFIG_BMP_16BPP)
|
|
||||||
case 16:
|
case 16:
|
||||||
for (i = 0; i < height; ++i) {
|
if (IS_ENABLED(CONFIG_BMP_16BPP)) {
|
||||||
WATCHDOG_RESET();
|
for (i = 0; i < height; ++i) {
|
||||||
for (j = 0; j < width; j++) {
|
WATCHDOG_RESET();
|
||||||
*fb++ = *bmap++;
|
for (j = 0; j < width; j++) {
|
||||||
*fb++ = *bmap++;
|
|
||||||
}
|
|
||||||
bmap += (padded_width - width);
|
|
||||||
fb -= width * 2 + priv->line_length;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif /* CONFIG_BMP_16BPP */
|
|
||||||
#if defined(CONFIG_BMP_24BPP)
|
|
||||||
case 24:
|
|
||||||
for (i = 0; i < height; ++i) {
|
|
||||||
for (j = 0; j < width; j++) {
|
|
||||||
if (bpix == 16) {
|
|
||||||
/* 16bit 565RGB format */
|
|
||||||
*(u16 *)fb = ((bmap[2] >> 3) << 11) |
|
|
||||||
((bmap[1] >> 2) << 5) |
|
|
||||||
(bmap[0] >> 3);
|
|
||||||
bmap += 3;
|
|
||||||
fb += 2;
|
|
||||||
} else {
|
|
||||||
*fb++ = *bmap++;
|
*fb++ = *bmap++;
|
||||||
*fb++ = *bmap++;
|
*fb++ = *bmap++;
|
||||||
*fb++ = *bmap++;
|
|
||||||
*fb++ = 0;
|
|
||||||
}
|
}
|
||||||
|
bmap += (padded_width - width);
|
||||||
|
fb -= width * 2 + priv->line_length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 24:
|
||||||
|
if (IS_ENABLED(CONFIG_BMP_24BPP)) {
|
||||||
|
for (i = 0; i < height; ++i) {
|
||||||
|
for (j = 0; j < width; j++) {
|
||||||
|
if (bpix == 16) {
|
||||||
|
/* 16bit 565RGB format */
|
||||||
|
*(u16 *)fb = ((bmap[2] >> 3)
|
||||||
|
<< 11) |
|
||||||
|
((bmap[1] >> 2) << 5) |
|
||||||
|
(bmap[0] >> 3);
|
||||||
|
bmap += 3;
|
||||||
|
fb += 2;
|
||||||
|
} else {
|
||||||
|
*fb++ = *bmap++;
|
||||||
|
*fb++ = *bmap++;
|
||||||
|
*fb++ = *bmap++;
|
||||||
|
*fb++ = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fb -= priv->line_length + width * (bpix / 8);
|
||||||
|
bmap += (padded_width - width);
|
||||||
}
|
}
|
||||||
fb -= priv->line_length + width * (bpix / 8);
|
|
||||||
bmap += (padded_width - width);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BMP_24BPP */
|
|
||||||
#if defined(CONFIG_BMP_32BPP)
|
|
||||||
case 32:
|
case 32:
|
||||||
for (i = 0; i < height; ++i) {
|
if (IS_ENABLED(CONFIG_BMP_32BPP)) {
|
||||||
for (j = 0; j < width; j++) {
|
for (i = 0; i < height; ++i) {
|
||||||
*fb++ = *bmap++;
|
for (j = 0; j < width; j++) {
|
||||||
*fb++ = *bmap++;
|
*fb++ = *bmap++;
|
||||||
*fb++ = *bmap++;
|
*fb++ = *bmap++;
|
||||||
*fb++ = *bmap++;
|
*fb++ = *bmap++;
|
||||||
|
*fb++ = *bmap++;
|
||||||
|
}
|
||||||
|
fb -= priv->line_length + width * (bpix / 8);
|
||||||
}
|
}
|
||||||
fb -= priv->line_length + width * (bpix / 8);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_BMP_32BPP */
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue