gfx/cairo/cairo-mask-extends-bug.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 @@ -1788,18 +1788,35 @@ static cairo_status_t
     5  					    cairo_boxes_t *boxes)
     6  {
     7      cairo_boxes_t clear;
     8      cairo_box_t box;
     9      cairo_status_t status;
    10      struct _cairo_boxes_chunk *chunk;
    11      int i;
    13 -    if (boxes->num_boxes < 1 && clip_region == NULL)
    14 -	return _cairo_image_surface_fixup_unbounded (dst, extents, NULL);
    15 +    // If we have no boxes then we need to clear the entire extents
    16 +    // because we have nothing to draw.
    17 +    if (boxes->num_boxes < 1 && clip_region == NULL) {
    18 +        int x = extents->unbounded.x;
    19 +        int y = extents->unbounded.y;
    20 +        int width = extents->unbounded.width;
    21 +        int height = extents->unbounded.height;
    22 +
    23 +        pixman_color_t color = { 0 };
    24 +        pixman_box32_t box = { x, y, x + width, y + height };
    25 +
    26 +        if (! pixman_image_fill_boxes (PIXMAN_OP_CLEAR,
    27 +                                       dst->pixman_image,
    28 +                                       &color,
    29 +                                       1, &box)) {
    30 +            return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    31 +        }
    32 +        return CAIRO_STATUS_SUCCESS;
    33 +    }
    35      _cairo_boxes_init (&clear);
    37      box.p1.x = _cairo_fixed_from_int (extents->unbounded.x + extents->unbounded.width);
    38      box.p1.y = _cairo_fixed_from_int (extents->unbounded.y);
    39      box.p2.x = _cairo_fixed_from_int (extents->unbounded.x);
    40      box.p2.y = _cairo_fixed_from_int (extents->unbounded.y + extents->unbounded.height);

mercurial