[PATCH] bmp: honor alpha channel bits
Enrico Scholz
enrico.scholz at sigma-chemnitz.de
Tue Mar 6 13:41:22 EST 2012
Some displays might use RGBA formats. The 'A' component must be set
there to make image opaque.
Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
commands/bmp.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/commands/bmp.c b/commands/bmp.c
index 644a977..2be6fe0 100644
--- a/commands/bmp.c
+++ b/commands/bmp.c
@@ -10,13 +10,14 @@
#include <bmp_layout.h>
#include <asm/byteorder.h>
-static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, int b)
+static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, int b, int a)
{
u32 px;
px = (r >> (8 - info->red.length)) << info->red.offset |
(g >> (8 - info->green.length)) << info->green.offset |
- (b >> (8 - info->blue.length)) << info->blue.offset;
+ (b >> (8 - info->blue.length)) << info->blue.offset |
+ (a >> (8 - info->transp.length)) << info->transp.offset;
switch (info->bits_per_pixel) {
case 8:
@@ -148,7 +149,7 @@ static int do_bmp(struct command *cmdtp, int argc, char *argv[])
set_pixel(&info, adr, color_table[pixel].red,
color_table[pixel].green,
- color_table[pixel].blue);
+ color_table[pixel].blue, 255);
adr += info.bits_per_pixel >> 3;
image += bits_per_pixel >> 3;
@@ -169,7 +170,7 @@ static int do_bmp(struct command *cmdtp, int argc, char *argv[])
pixel = image;
set_pixel(&info, adr, pixel[2], pixel[1],
- pixel[0]);
+ pixel[0], 255);
adr += info.bits_per_pixel >> 3;
image += bits_per_pixel >> 3;
--
1.7.7.6
More information about the barebox
mailing list