Fix opacity check
authorAndrea Canciani <ranma42@gmail.com>
Tue, 2 Nov 2010 16:02:01 +0000 (17:02 +0100)
committerAndrea Canciani <ranma42@gmail.com>
Fri, 12 Nov 2010 16:13:30 +0000 (17:13 +0100)
Radial gradients are "conical", thus they can have some non-opaque
parts even if all of their stops are completely opaque.

To guarantee that a radial gradient is actually opaque, it needs to
also have one of the two circles containing the other one. In this
case when extrapolating, the whole plane is completely covered (as
explained in the comment in pixman-radial-gradient.c).

pixman/pixman-image.c

index c9420c3..e78b139 100644 (file)
@@ -398,10 +398,24 @@ compute_image_info (pixman_image_t *image)
            flags &= ~FAST_PATH_NARROW_FORMAT;
        break;
 
-    case LINEAR:
     case RADIAL:
        code = PIXMAN_unknown;
 
+       /*
+        * As explained in pixman-radial-gradient.c, every point of
+        * the plane has a valid associated radius (and thus will be
+        * colored) if and only if a is negative (i.e. one of the two
+        * circles contains the other one).
+        */
+
+        if (image->radial.a >= 0)
+           break;
+
+       /* Fall through */
+
+    case LINEAR:
+       code = PIXMAN_unknown;
+
        if (image->common.repeat != PIXMAN_REPEAT_NONE)
        {
            int i;