1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/cairo/cairo-clamp-boundary.patch Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 1.4 +# HG changeset patch 1.5 +# User Milan Sreckovic <msreckovic@mozilla.com> 1.6 +# Date 1362078121 18000 1.7 +# Node ID e9e6d97b153d8ec17ee03bb1deef1dec24c7a17c 1.8 +# Parent c65d59d33aa86b7e75bc420ea3beda6201e0aceb 1.9 +Bug 825721: clamp negative box starts and disallow negative sizes. r=jmuizelaar 1.10 + 1.11 +diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c 1.12 +--- a/gfx/cairo/cairo/src/cairo-image-surface.c 1.13 ++++ b/gfx/cairo/cairo/src/cairo-image-surface.c 1.14 +@@ -1846,16 +1846,20 @@ static cairo_status_t 1.15 + if (likely (status == CAIRO_STATUS_SUCCESS)) { 1.16 + for (chunk = &clear.chunks; chunk != NULL; chunk = chunk->next) { 1.17 + for (i = 0; i < chunk->count; i++) { 1.18 + int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x); 1.19 + int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y); 1.20 + int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x); 1.21 + int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y); 1.22 + 1.23 ++ x1 = (x1 < 0 ? 0 : x1); 1.24 ++ y1 = (y1 < 0 ? 0 : y1); 1.25 ++ if (x2 <= x1 || y2 <= y1) 1.26 ++ continue; 1.27 + pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t), 1.28 + PIXMAN_FORMAT_BPP (dst->pixman_format), 1.29 + x1, y1, x2 - x1, y2 - y1, 1.30 + 0); 1.31 + } 1.32 + } 1.33 + } 1.34 + 1.35 +@@ -2669,16 +2673,18 @@ static cairo_status_t 1.36 + const cairo_box_t *box = chunk->base; 1.37 + 1.38 + for (i = 0; i < chunk->count; i++) { 1.39 + int x1 = _cairo_fixed_integer_ceil (box[i].p1.x); 1.40 + int y1 = _cairo_fixed_integer_ceil (box[i].p1.y); 1.41 + int x2 = _cairo_fixed_integer_floor (box[i].p2.x); 1.42 + int y2 = _cairo_fixed_integer_floor (box[i].p2.y); 1.43 + 1.44 ++ x1 = (x1 < 0 ? 0 : x1); 1.45 ++ y1 = (y1 < 0 ? 0 : y1); 1.46 + if (x2 > x1 && y2 > y1) { 1.47 + cairo_box_t b; 1.48 + 1.49 + pixman_fill ((uint32_t *) dst->data, 1.50 + dst->stride / sizeof (uint32_t), 1.51 + PIXMAN_FORMAT_BPP (dst->pixman_format), 1.52 + x1, y1, x2 - x1, y2 - y1, 1.53 + pixel); 1.54 +@@ -2929,17 +2935,19 @@ static cairo_status_t 1.55 + cairo_box_t *box = chunk->base; 1.56 + 1.57 + for (i = 0; i < chunk->count; i++) { 1.58 + int x1 = _cairo_fixed_integer_round_down (box[i].p1.x); 1.59 + int y1 = _cairo_fixed_integer_round_down (box[i].p1.y); 1.60 + int x2 = _cairo_fixed_integer_round_down (box[i].p2.x); 1.61 + int y2 = _cairo_fixed_integer_round_down (box[i].p2.y); 1.62 + 1.63 +- if (x2 == x1 || y2 == y1) 1.64 ++ x1 = (x1 < 0 ? 0 : x1); 1.65 ++ y1 = (y1 < 0 ? 0 : y1); 1.66 ++ if (x2 <= x1 || y2 <= y1) 1.67 + continue; 1.68 + 1.69 + pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t), 1.70 + PIXMAN_FORMAT_BPP (dst->pixman_format), 1.71 + x1, y1, x2 - x1, y2 - y1, 1.72 + pixel); 1.73 + } 1.74 + }