[Pixman] [PATCH] general: Support component alpha for all image types

Søren Sandmann sandmann at cs.au.dk
Sat Nov 23 17:37:05 PST 2013


Currently, if you attempt to use component alpha on source images or
images without RGB channels, Pixman will silently just use unified
alpha instead. This patch makes such images supported for component
alpha.

There is no particularly compelling usecase at the moment, but this
patch does get rid of a bit of special-case code both in
pixman-general.c and in test/composite.c.
---
 pixman/pixman-general.c |  6 +-----
 test/blitters-test.c    |  2 +-
 test/composite.c        | 11 -----------
 3 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index a653fa7..8bce7c0 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -183,11 +183,7 @@ general_composite_rect  (pixman_implementation_t *imp,
 	mask_image = NULL;
     }
 
-    component_alpha =
-        mask_image			      &&
-        mask_image->common.type == BITS       &&
-        mask_image->common.component_alpha    &&
-        PIXMAN_FORMAT_RGB (mask_image->bits.format);
+    component_alpha = mask_image && mask_image->common.component_alpha;
 
     _pixman_implementation_iter_init (
 	imp->toplevel, &mask_iter,
diff --git a/test/blitters-test.c b/test/blitters-test.c
index ea03f47..df82358 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -394,6 +394,6 @@ main (int argc, const char *argv[])
     }
 
     return fuzzer_test_main("blitters", 2000000,
-			    0xE0A07495,
+			    0x63B4E3F3,
 			    test_composite, argc, argv);
 }
diff --git a/test/composite.c b/test/composite.c
index 9e51a8f..594c697 100644
--- a/test/composite.c
+++ b/test/composite.c
@@ -299,17 +299,6 @@ composite_test (image_t *dst,
 	}
     }
 
-    if (mask)
-    {
-	if (component_alpha && PIXMAN_FORMAT_R (mask->format) == 0)
-	{
-	    /* Ax component-alpha masks expand alpha into
-	     * all color channels.
-	     */
-	    tmsk.r = tmsk.g = tmsk.b = tmsk.a;
-	}
-    }
-
     if (PIXMAN_FORMAT_TYPE (dst->format) == PIXMAN_TYPE_ARGB_SRGB)
     {
 	tdst.r = convert_linear_to_srgb (tdst.r);
-- 
1.8.3.1



More information about the Pixman mailing list