Bug 825721, cairo fix, r=jmuizelaar, a=lsblakk
authorMilan Sreckovic <msreckovic@mozilla.com>
Tue, 26 Mar 2013 14:23:51 +1300
changeset 127792 f47fc0d38ede4f774835b77e21364bea5d3f7f8d
parent 127791 5444887515142ec7a542d5582fb2b97817fed0cb
child 127793 06ddb061806350ad382bd8b22216d59925141af7
child 127795 91fbf8798210d3e9ac638ef17b5d6659765ce853
child 127797 6ee28486d5e37936f8ad31db52db76790ac3bf31
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
reviewersjmuizelaar, lsblakk
bugs825721
milestone20.0
Bug 825721, cairo fix, r=jmuizelaar, a=lsblakk
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
@@ -1846,16 +1846,20 @@ static cairo_status_t
     if (likely (status == CAIRO_STATUS_SUCCESS)) {
 	for (chunk = &clear.chunks; chunk != NULL; chunk = chunk->next) {
 	    for (i = 0; i < chunk->count; i++) {
 		int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
 		int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
 		int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
 		int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
 
+		x1 = (x1 < 0 ? 0 : x1);
+		y1 = (y1 < 0 ? 0 : y1);
+		if (x2 <= x1 || y2 <= y1)
+		    continue;
 		pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
 			     PIXMAN_FORMAT_BPP (dst->pixman_format),
 			     x1, y1, x2 - x1, y2 - y1,
 			     0);
 	    }
 	}
     }
 
@@ -2669,16 +2673,18 @@ static cairo_status_t
 	const cairo_box_t *box = chunk->base;
 
 	for (i = 0; i < chunk->count; i++) {
 	    int x1 = _cairo_fixed_integer_ceil (box[i].p1.x);
 	    int y1 = _cairo_fixed_integer_ceil (box[i].p1.y);
 	    int x2 = _cairo_fixed_integer_floor (box[i].p2.x);
 	    int y2 = _cairo_fixed_integer_floor (box[i].p2.y);
 
+	    x1 = (x1 < 0 ? 0 : x1);
+	    y1 = (y1 < 0 ? 0 : y1);
 	    if (x2 > x1 && y2 > y1) {
 		cairo_box_t b;
 
 		pixman_fill ((uint32_t *) dst->data,
 			     dst->stride / sizeof (uint32_t),
 			     PIXMAN_FORMAT_BPP (dst->pixman_format),
 			     x1, y1, x2 - x1, y2 - y1,
 			     pixel);
@@ -2929,17 +2935,19 @@ static cairo_status_t
 	    cairo_box_t *box = chunk->base;
 
 	    for (i = 0; i < chunk->count; i++) {
 		int x1 = _cairo_fixed_integer_round_down (box[i].p1.x);
 		int y1 = _cairo_fixed_integer_round_down (box[i].p1.y);
 		int x2 = _cairo_fixed_integer_round_down (box[i].p2.x);
 		int y2 = _cairo_fixed_integer_round_down (box[i].p2.y);
 
-		if (x2 == x1 || y2 == y1)
+		x1 = (x1 < 0 ? 0 : x1);
+		y1 = (y1 < 0 ? 0 : y1);
+		if (x2 <= x1 || y2 <= y1)
 		    continue;
 
 		pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
 			     PIXMAN_FORMAT_BPP (dst->pixman_format),
 			     x1, y1, x2 - x1, y2 - y1,
 			     pixel);
 	    }
 	}