From: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
To: barebox@lists.infradead.org
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Subject: [PATCH] bmp: honor alpha channel bits
Date: Tue, 6 Mar 2012 19:41:22 +0100 [thread overview]
Message-ID: <1331059282-10824-1-git-send-email-enrico.scholz@sigma-chemnitz.de> (raw)
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
reply other threads:[~2012-03-06 18:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1331059282-10824-1-git-send-email-enrico.scholz@sigma-chemnitz.de \
--to=enrico.scholz@sigma-chemnitz.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox