[Pixman] [PATCH] Fix bugs in component alpha combiners for separable PDF operators

Søren Sandmann sandmann at cs.au.dk
Wed Sep 19 09:19:14 PDT 2012


From: Søren Sandmann Pedersen <ssp at redhat.com>

In general, the component alpha version of an operator is supposed to
do this:

       - multiply source with mask in all channels
       - multiply mask with source alpha in all channels
       - compute the regular operator in all channels using the
         mask value whenever source alpha is called for

The first two steps are usually accomplished with the function
combine_mask_ca(), but for operators where source alpha is not used,
such as SRC, ADD and OUT, the simpler function
combine_mask_value_ca(), which doesn't compute the new mask values,
can be used.

However, the PDF blend modes generally *do* make use of source alpha,
so they can't use combine_mask_value_ca() as they do now. They have to
use combine_mask_ca().

This patch fixes this in combine_multiply_ca() and the CA combiners
generated by PDF_SEPARABLE_BLEND_MODE.
---
 pixman/pixman-combine.c.template |    4 ++--
 test/blitters-test.c             |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template
index cd008d9..50d2b0a 100644
--- a/pixman/pixman-combine.c.template
+++ b/pixman/pixman-combine.c.template
@@ -489,7 +489,7 @@ combine_multiply_ca (pixman_implementation_t *imp,
 	comp4_t r = d;
 	comp4_t dest_ia = ALPHA_c (~d);
 
-	combine_mask_value_ca (&s, &m);
+	combine_mask_ca (&s, &m);
 
 	UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (r, ~m, s, dest_ia);
 	UNcx4_MUL_UNcx4 (d, s);
@@ -546,7 +546,7 @@ combine_multiply_ca (pixman_implementation_t *imp,
 	    comp1_t ida = ~da;						\
 	    comp4_t result;						\
             								\
-	    combine_mask_value_ca (&s, &m);				\
+	    combine_mask_ca (&s, &m);					\
             								\
 	    result = d;							\
 	    UNcx4_MUL_UNcx4_ADD_UNcx4_MUL_UNc (result, ~m, s, ida);     \
diff --git a/test/blitters-test.c b/test/blitters-test.c
index 6a3cc86..8c46cef 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -395,6 +395,6 @@ main (int argc, const char *argv[])
     }
 
     return fuzzer_test_main("blitters", 2000000,
-			    0xA364B5BF,
+			    0x3E1DD2E8,
 			    test_composite, argc, argv);
 }
-- 
1.7.4



More information about the Pixman mailing list