Clip composite region against the destination alpha map extents.
authorSøren Sandmann Pedersen <ssp@redhat.com>
Mon, 30 Aug 2010 02:46:09 +0000 (22:46 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Tue, 21 Sep 2010 12:31:08 +0000 (08:31 -0400)
Otherwise we can end up writing outside the alpha map.

pixman/pixman.c

index cdf4b75..285bbfc 100644 (file)
@@ -315,14 +315,27 @@ pixman_compute_composite_region32 (pixman_region32_t * region,
            return FALSE;
     }
 
-    if (dst_image->common.alpha_map && dst_image->common.alpha_map->common.have_clip_region)
+    if (dst_image->common.alpha_map)
     {
-       if (!clip_general_image (region, &dst_image->common.alpha_map->common.clip_region,
-                                -dst_image->common.alpha_origin_x,
-                                -dst_image->common.alpha_origin_y))
+       if (!pixman_region32_intersect_rect (region, region,
+                                            dst_image->common.alpha_origin_x,
+                                            dst_image->common.alpha_origin_y,
+                                            dst_image->common.alpha_map->width,
+                                            dst_image->common.alpha_map->height))
        {
            return FALSE;
        }
+       if (!pixman_region32_not_empty (region))
+           return FALSE;
+       if (dst_image->common.alpha_map->common.have_clip_region)
+       {
+           if (!clip_general_image (region, &dst_image->common.alpha_map->common.clip_region,
+                                    -dst_image->common.alpha_origin_x,
+                                    -dst_image->common.alpha_origin_y))
+           {
+               return FALSE;
+           }
+       }
     }
 
     /* clip against src */