aboutsummaryrefslogtreecommitdiffstats
path: root/drv_generic_graphic.c
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2008-12-27 06:44:47 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2008-12-27 06:44:47 +0000
commit1c01c975d4ae2ff0489180291fdc7a887039dae8 (patch)
tree3f393ef498572b8f6e5c72d7a40dc4b3d3dc3ca3 /drv_generic_graphic.c
parent52df507b2fc152a99b816fd88e9bc8bfe05e0d7d (diff)
downloadlcd4linux-1c01c975d4ae2ff0489180291fdc7a887039dae8.tar.gz
ported (modified) r815 from voker_dev
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@912 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'drv_generic_graphic.c')
-rw-r--r--drv_generic_graphic.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c
index afab559..5c864e3 100644
--- a/drv_generic_graphic.c
+++ b/drv_generic_graphic.c
@@ -177,7 +177,7 @@ static void drv_generic_graphic_blit(const int row, const int col, const int hei
static RGBA drv_generic_graphic_blend(const int row, const int col)
{
- int l;
+ int l, o;
RGBA p;
RGBA ret;
@@ -185,9 +185,29 @@ static RGBA drv_generic_graphic_blend(const int row, const int col)
ret.G = BL_COL.G;
ret.B = BL_COL.B;
ret.A = 0xff;
- for (l = LAYERS - 1; l >= 0; l--) {
+
+ /* find first opaque layer */
+ /* layers below are fully covered */
+ o = LAYERS - 1;
+ for (l = 0; l < LAYERS; l++) {
+ p = drv_generic_graphic_FB[l][row * LCOLS + col];
+ if (p.A == 255) {
+ o = l;
+ break;
+ }
+ }
+
+ for (l = o; l >= 0; l--) {
p = drv_generic_graphic_FB[l][row * LCOLS + col];
- if (p.A > 0) {
+ switch (p.A) {
+ case 0:
+ break;
+ case 255:
+ ret.R = p.R;
+ ret.G = p.G;
+ ret.B = p.B;
+ break;
+ default:
ret.R = (p.R * p.A + ret.R * (255 - p.A)) / 255;
ret.G = (p.G * p.A + ret.G * (255 - p.A)) / 255;
ret.B = (p.B * p.A + ret.B * (255 - p.A)) / 255;