projects
/
platform
/
upstream
/
gummiboot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
30030cb
)
graphics: splash - correct rounding in alpha blending
author
Terje Gundersen
<terje.gundersen@appeartv.com>
Tue, 24 Dec 2013 09:51:57 +0000
(10:51 +0100)
committer
Tom Gundersen
<teg@jklm.no>
Tue, 24 Dec 2013 10:05:25 +0000
(11:05 +0100)
"(X >> 8)" always rounds down, but "(X + 0x80) >> 8)" rounds to
the nearest integer.
src/efi/graphics.c
patch
|
blob
|
history
diff --git
a/src/efi/graphics.c
b/src/efi/graphics.c
index
d3f674b
..
062ce27
100644
(file)
--- a/
src/efi/graphics.c
+++ b/
src/efi/graphics.c
@@
-222,8
+222,8
@@
static void pixel_blend(UINT32 *dst, const UINT32 source) {
dst_g = (*dst & 0x00ff00);
/* blend */
- rb = ((((src_rb - dst_rb) * alpha) >> 8) + dst_rb) & 0xff00ff;
- g = ((((src_g - dst_g) * alpha) >> 8) + dst_g) & 0x00ff00;
+ rb = ((((src_rb - dst_rb) * alpha
+ 0x800080
) >> 8) + dst_rb) & 0xff00ff;
+ g = ((((src_g - dst_g) * alpha
+ 0x008000
) >> 8) + dst_g) & 0x00ff00;
*dst = (rb | g);
}