Fix incorrect optimization in combine_over_ca().
authorSøren Sandmann Pedersen <sandmann@redhat.com>
Thu, 6 Aug 2009 00:31:41 +0000 (20:31 -0400)
committerSøren Sandmann Pedersen <sandmann@redhat.com>
Sat, 8 Aug 2009 22:50:17 +0000 (18:50 -0400)
Previously the code assumed that an alpha of 0 meant that no change
would take place. This is incorrect because an alpha of 0 can happen
as the result of the source having alpha=0, but rgb != 0.

pixman/pixman-combine.c.template

index 59ea1e1..f707fe9 100644 (file)
@@ -1610,17 +1610,14 @@ combine_over_ca (pixman_implementation_t *imp,
        combine_mask_ca (&s, &m);
 
        a = ~m;
-       if (a != ~0)
+       if (a)
        {
-           if (a)
-           {
-               comp4_t d = *(dest + i);
-               UNcx4_MUL_UNcx4_ADD_UNcx4 (d, a, s);
-               s = d;
-           }
-
-           *(dest + i) = s;
+           comp4_t d = *(dest + i);
+           UNcx4_MUL_UNcx4_ADD_UNcx4 (d, a, s);
+           s = d;
        }
+
+       *(dest + i) = s;
     }
 }