* [PATCH] bmp: honor alpha channel bits
@ 2012-03-06 18:41 Enrico Scholz
0 siblings, 0 replies; only message in thread
From: Enrico Scholz @ 2012-03-06 18:41 UTC (permalink / raw)
To: barebox; +Cc: Enrico Scholz
Some displays might use RGBA formats. The 'A' component must be set
there to make image opaque.
Signed-off-by: Enrico Scholz <enrico.scholz@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
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-03-06 18:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-06 18:41 [PATCH] bmp: honor alpha channel bits Enrico Scholz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox