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.

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

mercurial