Bug 1050788 - Fix a bug where cairo's region clipping code incorrectly handled empty clips. r=jrmuizel
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 27 Aug 2014 10:22:38 +1200
changeset 201722 c3474588bddd7fb10b32bd9b6b931b1a4efb506f
parent 201721 5ee7a98d1e2fe5fd290f23bad457a1b098331fa5
child 201723 f1b9d154464e5f899b2b5d39aeb94955b0e2b925
push id48247
push usermwoodrow@mozilla.com
push dateTue, 26 Aug 2014 22:28:53 +0000
treeherdermozilla-inbound@c3474588bddd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs1050788
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1050788 - Fix a bug where cairo's region clipping code incorrectly handled empty clips. r=jrmuizel
gfx/cairo/cairo-region-clip.patch
gfx/cairo/cairo/src/cairo-clip.c
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/cairo-region-clip.patch
@@ -0,0 +1,34 @@
+# HG changeset patch
+# User Matt Woodrow <mwoodrow@mozilla.com>
+# Date 1408674084 -43200
+#      Fri Aug 22 14:21:24 2014 +1200
+# Node ID 2b819b882c3b26c02d821e8d713591a9b56f1728
+# Parent  ffd1fc7e7d5a85e4823b5f2067b4a24d358a0e41
+Bug 1050788 - Fix cairo clip path region construction when the first path generates no traps. r=jrmuizel
+
+diff --git a/gfx/cairo/cairo/src/cairo-clip.c b/gfx/cairo/cairo/src/cairo-clip.c
+--- a/gfx/cairo/cairo/src/cairo-clip.c
++++ b/gfx/cairo/cairo/src/cairo-clip.c
+@@ -590,16 +590,22 @@ static cairo_int_status_t
+     status = _cairo_path_fixed_fill_rectilinear_to_traps (&clip_path->path,
+ 							  clip_path->fill_rule,
+ 							  &traps);
+     if (unlikely (_cairo_status_is_error (status)))
+ 	return status;
+     if (status == CAIRO_INT_STATUS_UNSUPPORTED)
+ 	goto UNSUPPORTED;
+ 
++    if (unlikely (traps.num_traps == 0)) {
++	clip_path->region = cairo_region_create ();
++	clip_path->flags |= CAIRO_CLIP_PATH_HAS_REGION;
++	return CAIRO_STATUS_SUCCESS;
++    }
++
+     if (traps.num_traps > ARRAY_LENGTH (stack_boxes)) {
+ 	boxes = _cairo_malloc_ab (traps.num_traps, sizeof (cairo_box_t));
+ 	if (unlikely (boxes == NULL))
+ 	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+     }
+ 
+     for (n = 0; n < traps.num_traps; n++) {
+ 	boxes[n].p1.x = traps.traps[n].left.p1.x;
--- a/gfx/cairo/cairo/src/cairo-clip.c
+++ b/gfx/cairo/cairo/src/cairo-clip.c
@@ -590,16 +590,22 @@ static cairo_int_status_t
     status = _cairo_path_fixed_fill_rectilinear_to_traps (&clip_path->path,
 							  clip_path->fill_rule,
 							  &traps);
     if (unlikely (_cairo_status_is_error (status)))
 	return status;
     if (status == CAIRO_INT_STATUS_UNSUPPORTED)
 	goto UNSUPPORTED;
 
+    if (unlikely (traps.num_traps == 0)) {
+	clip_path->region = cairo_region_create ();
+	clip_path->flags |= CAIRO_CLIP_PATH_HAS_REGION;
+	return CAIRO_STATUS_SUCCESS;
+    }
+
     if (traps.num_traps > ARRAY_LENGTH (stack_boxes)) {
 	boxes = _cairo_malloc_ab (traps.num_traps, sizeof (cairo_box_t));
 	if (unlikely (boxes == NULL))
 	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
     }
 
     for (n = 0; n < traps.num_traps; n++) {
 	boxes[n].p1.x = traps.traps[n].left.p1.x;