gfx/cairo/cairo-clamp-boundary.patch

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:00fb461a62d8
1 # HG changeset patch
2 # User Milan Sreckovic <msreckovic@mozilla.com>
3 # Date 1362078121 18000
4 # Node ID e9e6d97b153d8ec17ee03bb1deef1dec24c7a17c
5 # Parent c65d59d33aa86b7e75bc420ea3beda6201e0aceb
6 Bug 825721: clamp negative box starts and disallow negative sizes. r=jmuizelaar
7
8 diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c
9 --- a/gfx/cairo/cairo/src/cairo-image-surface.c
10 +++ b/gfx/cairo/cairo/src/cairo-image-surface.c
11 @@ -1846,16 +1846,20 @@ static cairo_status_t
12 if (likely (status == CAIRO_STATUS_SUCCESS)) {
13 for (chunk = &clear.chunks; chunk != NULL; chunk = chunk->next) {
14 for (i = 0; i < chunk->count; i++) {
15 int x1 = _cairo_fixed_integer_part (chunk->base[i].p1.x);
16 int y1 = _cairo_fixed_integer_part (chunk->base[i].p1.y);
17 int x2 = _cairo_fixed_integer_part (chunk->base[i].p2.x);
18 int y2 = _cairo_fixed_integer_part (chunk->base[i].p2.y);
19
20 + x1 = (x1 < 0 ? 0 : x1);
21 + y1 = (y1 < 0 ? 0 : y1);
22 + if (x2 <= x1 || y2 <= y1)
23 + continue;
24 pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
25 PIXMAN_FORMAT_BPP (dst->pixman_format),
26 x1, y1, x2 - x1, y2 - y1,
27 0);
28 }
29 }
30 }
31
32 @@ -2669,16 +2673,18 @@ static cairo_status_t
33 const cairo_box_t *box = chunk->base;
34
35 for (i = 0; i < chunk->count; i++) {
36 int x1 = _cairo_fixed_integer_ceil (box[i].p1.x);
37 int y1 = _cairo_fixed_integer_ceil (box[i].p1.y);
38 int x2 = _cairo_fixed_integer_floor (box[i].p2.x);
39 int y2 = _cairo_fixed_integer_floor (box[i].p2.y);
40
41 + x1 = (x1 < 0 ? 0 : x1);
42 + y1 = (y1 < 0 ? 0 : y1);
43 if (x2 > x1 && y2 > y1) {
44 cairo_box_t b;
45
46 pixman_fill ((uint32_t *) dst->data,
47 dst->stride / sizeof (uint32_t),
48 PIXMAN_FORMAT_BPP (dst->pixman_format),
49 x1, y1, x2 - x1, y2 - y1,
50 pixel);
51 @@ -2929,17 +2935,19 @@ static cairo_status_t
52 cairo_box_t *box = chunk->base;
53
54 for (i = 0; i < chunk->count; i++) {
55 int x1 = _cairo_fixed_integer_round_down (box[i].p1.x);
56 int y1 = _cairo_fixed_integer_round_down (box[i].p1.y);
57 int x2 = _cairo_fixed_integer_round_down (box[i].p2.x);
58 int y2 = _cairo_fixed_integer_round_down (box[i].p2.y);
59
60 - if (x2 == x1 || y2 == y1)
61 + x1 = (x1 < 0 ? 0 : x1);
62 + y1 = (y1 < 0 ? 0 : y1);
63 + if (x2 <= x1 || y2 <= y1)
64 continue;
65
66 pixman_fill ((uint32_t *) dst->data, dst->stride / sizeof (uint32_t),
67 PIXMAN_FORMAT_BPP (dst->pixman_format),
68 x1, y1, x2 - x1, y2 - y1,
69 pixel);
70 }
71 }

mercurial