[Pixman] [PATCH 5/5] Clip composite region against the destination alpha map extents.

Søren Sandmann sandmann at daimi.au.dk
Tue Sep 14 06:18:22 PDT 2010


From: Søren Sandmann Pedersen <ssp at redhat.com>

Otherwise we can end up writing outside the alpha map.
---
 pixman/pixman.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/pixman/pixman.c b/pixman/pixman.c
index cdf4b75..285bbfc 100644
--- a/pixman/pixman.c
+++ b/pixman/pixman.c
@@ -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 */
-- 
1.7.1.1



More information about the Pixman mailing list