From: Søren Sandmann Pedersen <s...@redhat.com>

The first broken optimization is that it checks "a != 0x00" where it
should check "s != 0x00". The other is that it skips the computation
when alpha is 0xff. That is wrong because in the formula:

     min (1, (1 - Aa)/Ab)

the render specification states that if Ab is 0, the quotient is
defined to positive infinity. That is the case even if (1 - Aa) is 0.
---
 pixman/pixman-combine.c.template |   14 +++++---------
 test/blitters-test.c             |    2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/pixman/pixman-combine.c.template b/pixman/pixman-combine.c.template
index c129980..0d3b95d 100644
--- a/pixman/pixman-combine.c.template
+++ b/pixman/pixman-combine.c.template
@@ -1296,17 +1296,13 @@ combine_disjoint_over_u (pixman_implementation_t *imp,
        comp4_t s = combine_mask (src, mask, i);
        comp2_t a = s >> A_SHIFT;
 
-       if (a != 0x00)
+       if (s != 0x00)
        {
-           if (a != MASK)
-           {
-               comp4_t d = *(dest + i);
-               a = combine_disjoint_out_part (d >> A_SHIFT, a);
-               UNcx4_MUL_UNc_ADD_UNcx4 (d, a, s);
-               s = d;
-           }
+           comp4_t d = *(dest + i);
+           a = combine_disjoint_out_part (d >> A_SHIFT, a);
+           UNcx4_MUL_UNc_ADD_UNcx4 (d, a, s);
 
-           *(dest + i) = s;
+           *(dest + i) = d;
        }
     }
 }
diff --git a/test/blitters-test.c b/test/blitters-test.c
index 7ba80eb..77a26dd 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -465,6 +465,6 @@ main (int argc, const char *argv[])
     }
 
     return fuzzer_test_main("blitters", 2000000,
-                           0x217CF14A,
+                           0x1DB8BDF8,
                            test_composite, argc, argv);
 }
-- 
1.7.1.1

_______________________________________________
Pixman mailing list
Pixman@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to