Remove broken optimizations in combine_disjoint_over_u()
authorSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 5 Oct 2010 15:08:42 +0000 (11:08 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 11 Oct 2010 16:06:20 +0000 (12:06 -0400)
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
test/blitters-test.c

index c129980..0d3b95d 100644 (file)
@@ -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;
        }
     }
 }
index 7ba80eb..77a26dd 100644 (file)
@@ -465,6 +465,6 @@ main (int argc, const char *argv[])
     }
 
     return fuzzer_test_main("blitters", 2000000,
-                           0x217CF14A,
+                           0x1DB8BDF8,
                            test_composite, argc, argv);
 }