Bug 918671 - Fix cairo clipping bug when nesting clips. r=jrmuizel

This commit is contained in:
Benoit Girard 2013-11-12 19:11:50 +00:00
parent d382306711
commit 42c54a6474
3 changed files with 62 additions and 2 deletions

View File

@ -208,6 +208,8 @@ xlib-flush-glyphs.patch: bug 839745, flush glyphs when necessary
dasharray-zero-gap.patch: bug 885585, ensure strokes get painted when the gaps in a dash array are all zero length
cairo-mask-extends-bug.patch: bug 918671, sometimes when building a mask we wouldn't clear it properly. This is fixed in cairo 1.12
==== pixman patches ====
pixman-android-cpu-detect.patch: Add CPU detection support for Android, where we can't reliably access /proc/self/auxv.

View File

@ -0,0 +1,41 @@
diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c
--- a/gfx/cairo/cairo/src/cairo-image-surface.c
+++ b/gfx/cairo/cairo/src/cairo-image-surface.c
@@ -1788,18 +1788,35 @@ static cairo_status_t
cairo_boxes_t *boxes)
{
cairo_boxes_t clear;
cairo_box_t box;
cairo_status_t status;
struct _cairo_boxes_chunk *chunk;
int i;
- if (boxes->num_boxes < 1 && clip_region == NULL)
- return _cairo_image_surface_fixup_unbounded (dst, extents, NULL);
+ // If we have no boxes then we need to clear the entire extents
+ // because we have nothing to draw.
+ if (boxes->num_boxes < 1 && clip_region == NULL) {
+ int x = extents->unbounded.x;
+ int y = extents->unbounded.y;
+ int width = extents->unbounded.width;
+ int height = extents->unbounded.height;
+
+ pixman_color_t color = { 0 };
+ pixman_box32_t box = { x, y, x + width, y + height };
+
+ if (! pixman_image_fill_boxes (PIXMAN_OP_CLEAR,
+ dst->pixman_image,
+ &color,
+ 1, &box)) {
+ return _cairo_error (CAIRO_STATUS_NO_MEMORY);
+ }
+ return CAIRO_STATUS_SUCCESS;
+ }
_cairo_boxes_init (&clear);
box.p1.x = _cairo_fixed_from_int (extents->unbounded.x + extents->unbounded.width);
box.p1.y = _cairo_fixed_from_int (extents->unbounded.y);
box.p2.x = _cairo_fixed_from_int (extents->unbounded.x);
box.p2.y = _cairo_fixed_from_int (extents->unbounded.y + extents->unbounded.height);

View File

@ -1793,8 +1793,25 @@ _cairo_image_surface_fixup_unbounded_boxes (cairo_image_surface_t *dst,
struct _cairo_boxes_chunk *chunk;
int i;
if (boxes->num_boxes < 1 && clip_region == NULL)
return _cairo_image_surface_fixup_unbounded (dst, extents, NULL);
// If we have no boxes then we need to clear the entire extents
// because we have nothing to draw.
if (boxes->num_boxes < 1 && clip_region == NULL) {
int x = extents->unbounded.x;
int y = extents->unbounded.y;
int width = extents->unbounded.width;
int height = extents->unbounded.height;
pixman_color_t color = { 0 };
pixman_box32_t box = { x, y, x + width, y + height };
if (! pixman_image_fill_boxes (PIXMAN_OP_CLEAR,
dst->pixman_image,
&color,
1, &box)) {
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
}
return CAIRO_STATUS_SUCCESS;
}
_cairo_boxes_init (&clear);