gfx/cairo/handle-multi-path-clip.patch

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c
michael@0 2 --- a/gfx/cairo/cairo/src/cairo-image-surface.c
michael@0 3 +++ b/gfx/cairo/cairo/src/cairo-image-surface.c
michael@0 4 @@ -2885,16 +2885,18 @@ static cairo_status_t
michael@0 5 cairo_bool_t need_clip_mask = FALSE;
michael@0 6 cairo_status_t status;
michael@0 7 struct _cairo_boxes_chunk *chunk;
michael@0 8 uint32_t pixel;
michael@0 9 int i;
michael@0 10
michael@0 11 if (clip != NULL) {
michael@0 12 status = _cairo_clip_get_region (clip, &clip_region);
michael@0 13 + if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
michael@0 14 + return CAIRO_STATUS_SUCCESS;
michael@0 15 need_clip_mask = status == CAIRO_INT_STATUS_UNSUPPORTED;
michael@0 16 if (need_clip_mask &&
michael@0 17 (op == CAIRO_OPERATOR_SOURCE || ! extents->is_bounded))
michael@0 18 {
michael@0 19 return CAIRO_INT_STATUS_UNSUPPORTED;
michael@0 20 }
michael@0 21
michael@0 22 if (clip_region != NULL && cairo_region_num_rectangles (clip_region) == 1)
michael@0 23 @@ -3200,30 +3202,20 @@ static cairo_status_t
michael@0 24 return _clip_and_composite (dst, op, src,
michael@0 25 _composite_traps, &info,
michael@0 26 extents, clip);
michael@0 27 }
michael@0 28
michael@0 29 static cairo_clip_path_t *
michael@0 30 _clip_get_single_path (cairo_clip_t *clip)
michael@0 31 {
michael@0 32 - cairo_clip_path_t *iter = clip->path;
michael@0 33 - cairo_clip_path_t *path = NULL;
michael@0 34 -
michael@0 35 - do {
michael@0 36 - if ((iter->flags & CAIRO_CLIP_PATH_IS_BOX) == 0) {
michael@0 37 - if (path != NULL)
michael@0 38 - return FALSE;
michael@0 39 -
michael@0 40 - path = iter;
michael@0 41 - }
michael@0 42 - iter = iter->prev;
michael@0 43 - } while (iter != NULL);
michael@0 44 -
michael@0 45 - return path;
michael@0 46 + if (clip->path->prev == NULL)
michael@0 47 + return clip->path;
michael@0 48 +
michael@0 49 + return NULL;
michael@0 50 }
michael@0 51
michael@0 52 /* high level image interface */
michael@0 53
michael@0 54 static cairo_int_status_t
michael@0 55 _cairo_image_surface_paint (void *abstract_surface,
michael@0 56 cairo_operator_t op,
michael@0 57 const cairo_pattern_t *source,

mercurial