gfx/cairo/win32-composite-src-mod.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-win32-surface.c b/gfx/cairo/cairo/src/cairo-win32-surface.c
michael@0 2 --- a/gfx/cairo/cairo/src/cairo-win32-surface.c
michael@0 3 +++ b/gfx/cairo/cairo/src/cairo-win32-surface.c
michael@0 4 @@ -928,16 +928,19 @@ _cairo_win32_surface_composite_inner (ca
michael@0 5 return _composite_alpha_blend (dst, src, alpha,
michael@0 6 src_r.x, src_r.y, src_r.width, src_r.height,
michael@0 7 dst_r.x, dst_r.y, dst_r.width, dst_r.height);
michael@0 8 }
michael@0 9
michael@0 10 return CAIRO_STATUS_SUCCESS;
michael@0 11 }
michael@0 12
michael@0 13 +/* from pixman-private.h */
michael@0 14 +#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
michael@0 15 +
michael@0 16 static cairo_int_status_t
michael@0 17 _cairo_win32_surface_composite (cairo_operator_t op,
michael@0 18 cairo_pattern_t *pattern,
michael@0 19 cairo_pattern_t *mask_pattern,
michael@0 20 void *abstract_dst,
michael@0 21 int src_x,
michael@0 22 int src_y,
michael@0 23 int mask_x,
michael@0 24 @@ -1209,18 +1212,18 @@ _cairo_win32_surface_composite (cairo_op
michael@0 25 /* If we need to repeat, we turn the repeated blit into
michael@0 26 * a bunch of piece-by-piece blits.
michael@0 27 */
michael@0 28 if (needs_repeat) {
michael@0 29 cairo_rectangle_int_t piece_src_r, piece_dst_r;
michael@0 30 uint32_t rendered_width = 0, rendered_height = 0;
michael@0 31 uint32_t to_render_height, to_render_width;
michael@0 32 int32_t piece_x, piece_y;
michael@0 33 - int32_t src_start_x = src_r.x % src_extents.width;
michael@0 34 - int32_t src_start_y = src_r.y % src_extents.height;
michael@0 35 + int32_t src_start_x = MOD(src_r.x, src_extents.width);
michael@0 36 + int32_t src_start_y = MOD(src_r.y, src_extents.height);
michael@0 37
michael@0 38 if (needs_scale)
michael@0 39 goto UNSUPPORTED;
michael@0 40
michael@0 41 /* If both the src and dest have an image, we may as well fall
michael@0 42 * back, because it will be faster than our separate blits.
michael@0 43 * Our blit code will be fastest when the src is a DDB and the
michael@0 44 * destination is a DDB.

mercurial