general: Support component alpha for all image types
authorSøren Sandmann <ssp@redhat.com>
Sun, 24 Nov 2013 01:30:33 +0000 (20:30 -0500)
committerSøren Sandmann <ssp@redhat.com>
Sun, 24 Nov 2013 01:30:33 +0000 (20:30 -0500)
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
test/blitters-test.c
test/composite.c

index a653fa71ae37c0393ac8e608ad780372d475a203..8bce7c006090325d9d0f872e17932676c83efbb4 100644 (file)
@@ -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,
index ea03f475d3b22fe8bd410ff6659ff69831c37826..df82358417e4e2267a75afa010352251c56d0b50 100644 (file)
@@ -394,6 +394,6 @@ main (int argc, const char *argv[])
     }
 
     return fuzzer_test_main("blitters", 2000000,
-                           0xE0A07495,
+                           0x63B4E3F3,
                            test_composite, argc, argv);
 }
index 9e51a8f6553e0306b91bdb78087cc92f723a6774..594c6977274ffd4985c275a7d7a2c20ead731782 100644 (file)
@@ -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);