gfx/cairo/pixman-image-transform.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 # HG changeset patch
     2 # User Jeff Muizelaar <jmuizelaar@mozilla.com>
     3 # Date 1299543337 18000
     4 # Node ID 57f411f16517fa3abc31b6b081dd31420c4d9b45
     5 # Parent  e56ecd8b3a68c158025207c5fd081d043e28f5ce
     6 Bug 637828. Reset the transform on the dest image. r=joe
     8 We can get into a situation where the destination image has a transform
     9 because we use it as source. The transform set when the image is a source
    10 sticks around and when we use it as a destination pixman gets confused.
    12 It seems like the code at fault here is really pixman. I think that pixman
    13 should probably not be using a transformed fetch on the destination image under
    14 any circumstances.
    16 For example, in this case we're fetching destination pixels from a different
    17 part of the image than we're storing them to. I can't see any reason for
    18 wanting this behaviour.
    20 However, reseting the transform seemed like the easiest solution.
    22 diff --git a/gfx/cairo/cairo/src/cairo-image-surface.c b/gfx/cairo/cairo/src/cairo-image-surface.c
    23 --- a/gfx/cairo/cairo/src/cairo-image-surface.c
    24 +++ b/gfx/cairo/cairo/src/cairo-image-surface.c
    25 @@ -1138,16 +1138,27 @@ _cairo_image_surface_composite (cairo_op
    26  	return status;
    28      status = _cairo_image_surface_set_attributes (src, &src_attr,
    29  						  dst_x + width / 2.,
    30  						  dst_y + height / 2.);
    31      if (unlikely (status))
    32  	goto CLEANUP_SURFACES;
    34 +    /* we sometimes get destinations with transforms.
    35 +     * we're not equiped to deal with this */
    36 +    {
    37 +        static const pixman_transform_t id = {
    38 +           {{ pixman_fixed_1, 0, 0 },
    39 +            { 0, pixman_fixed_1, 0 },
    40 +            { 0, 0, pixman_fixed_1 }}
    41 +        };
    42 +        pixman_image_set_transform (dst->pixman_image, &id);
    43 +    }
    44 +
    45      if (mask) {
    46  	status = _cairo_image_surface_set_attributes (mask, &mask_attr,
    47  						      dst_x + width / 2.,
    48  						      dst_y + height / 2.);
    49  	if (unlikely (status))
    50  	    goto CLEANUP_SURFACES;
    52  	pixman_image_composite (_pixman_operator (op),

mercurial