Tue, 06 Jan 2015 21:39:09 +0100
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 | @@ -1114,17 +1114,17 @@ static cairo_int_status_t |
michael@0 | 5 | cairo_win32_surface_t *dst = abstract_dst; |
michael@0 | 6 | cairo_win32_surface_t *src; |
michael@0 | 7 | cairo_surface_pattern_t *src_surface_pattern; |
michael@0 | 8 | int alpha; |
michael@0 | 9 | double scalex, scaley; |
michael@0 | 10 | cairo_fixed_t x0_fixed, y0_fixed; |
michael@0 | 11 | cairo_int_status_t status; |
michael@0 | 12 | |
michael@0 | 13 | - cairo_bool_t needs_alpha, needs_scale, needs_repeat; |
michael@0 | 14 | + cairo_bool_t needs_alpha, needs_scale, needs_repeat, needs_pad; |
michael@0 | 15 | cairo_image_surface_t *src_image = NULL; |
michael@0 | 16 | |
michael@0 | 17 | cairo_format_t src_format; |
michael@0 | 18 | cairo_rectangle_int_t src_extents; |
michael@0 | 19 | |
michael@0 | 20 | cairo_rectangle_int_t src_r = { src_x, src_y, width, height }; |
michael@0 | 21 | cairo_rectangle_int_t dst_r = { dst_x, dst_y, width, height }; |
michael@0 | 22 | |
michael@0 | 23 | @@ -1145,17 +1145,18 @@ static cairo_int_status_t |
michael@0 | 24 | { |
michael@0 | 25 | goto UNSUPPORTED; |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | if (pattern->type != CAIRO_PATTERN_TYPE_SURFACE) |
michael@0 | 29 | goto UNSUPPORTED; |
michael@0 | 30 | |
michael@0 | 31 | if (pattern->extend != CAIRO_EXTEND_NONE && |
michael@0 | 32 | - pattern->extend != CAIRO_EXTEND_REPEAT) |
michael@0 | 33 | + pattern->extend != CAIRO_EXTEND_REPEAT && |
michael@0 | 34 | + pattern->extend != CAIRO_EXTEND_PAD) |
michael@0 | 35 | goto UNSUPPORTED; |
michael@0 | 36 | |
michael@0 | 37 | if (mask_pattern) { |
michael@0 | 38 | /* FIXME: When we fully support RENDER style 4-channel |
michael@0 | 39 | * masks we need to check r/g/b != 1.0. |
michael@0 | 40 | */ |
michael@0 | 41 | if (mask_pattern->type != CAIRO_PATTERN_TYPE_SOLID) |
michael@0 | 42 | return CAIRO_INT_STATUS_UNSUPPORTED; |
michael@0 | 43 | @@ -1252,16 +1253,17 @@ static cairo_int_status_t |
michael@0 | 44 | |
michael@0 | 45 | /* If the src rectangle doesn't wholly lie within the src extents, |
michael@0 | 46 | * fudge things. We really need to do fixup on the unpainted |
michael@0 | 47 | * region -- e.g. the SOURCE operator is broken for areas outside |
michael@0 | 48 | * of the extents, because it won't clear that area to transparent |
michael@0 | 49 | * black. |
michael@0 | 50 | */ |
michael@0 | 51 | |
michael@0 | 52 | + needs_pad = FALSE; |
michael@0 | 53 | if (pattern->extend != CAIRO_EXTEND_REPEAT) { |
michael@0 | 54 | needs_repeat = FALSE; |
michael@0 | 55 | |
michael@0 | 56 | /* If the src rect and the extents of the source image don't overlap at all, |
michael@0 | 57 | * we can't do anything useful here. |
michael@0 | 58 | */ |
michael@0 | 59 | if (src_r.x > src_extents.width || src_r.y > src_extents.height || |
michael@0 | 60 | (src_r.x + src_r.width) < 0 || (src_r.y + src_r.height) < 0) |
michael@0 | 61 | @@ -1273,40 +1275,48 @@ static cairo_int_status_t |
michael@0 | 62 | |
michael@0 | 63 | if (src_r.x < 0) { |
michael@0 | 64 | src_r.width += src_r.x; |
michael@0 | 65 | |
michael@0 | 66 | dst_r.width += src_r.x; |
michael@0 | 67 | dst_r.x -= src_r.x; |
michael@0 | 68 | |
michael@0 | 69 | src_r.x = 0; |
michael@0 | 70 | + needs_pad = TRUE; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | if (src_r.y < 0) { |
michael@0 | 74 | src_r.height += src_r.y; |
michael@0 | 75 | |
michael@0 | 76 | dst_r.height += src_r.y; |
michael@0 | 77 | dst_r.y -= src_r.y; |
michael@0 | 78 | |
michael@0 | 79 | src_r.y = 0; |
michael@0 | 80 | + needs_pad = TRUE; |
michael@0 | 81 | } |
michael@0 | 82 | |
michael@0 | 83 | if (src_r.x + src_r.width > src_extents.width) { |
michael@0 | 84 | src_r.width = src_extents.width - src_r.x; |
michael@0 | 85 | dst_r.width = src_r.width; |
michael@0 | 86 | + needs_pad = TRUE; |
michael@0 | 87 | } |
michael@0 | 88 | |
michael@0 | 89 | if (src_r.y + src_r.height > src_extents.height) { |
michael@0 | 90 | src_r.height = src_extents.height - src_r.y; |
michael@0 | 91 | dst_r.height = src_r.height; |
michael@0 | 92 | + needs_pad = TRUE; |
michael@0 | 93 | } |
michael@0 | 94 | } else { |
michael@0 | 95 | needs_repeat = TRUE; |
michael@0 | 96 | } |
michael@0 | 97 | |
michael@0 | 98 | + if (pattern->extend == CAIRO_EXTEND_PAD && needs_pad) { |
michael@0 | 99 | + goto UNSUPPORTED; |
michael@0 | 100 | + } |
michael@0 | 101 | + |
michael@0 | 102 | /* |
michael@0 | 103 | * Operations that we can do: |
michael@0 | 104 | * |
michael@0 | 105 | * AlphaBlend uses the following formula for alpha when not use the per-pixel alpha (AlphaFormat = 0) |
michael@0 | 106 | * Dst.Alpha = Src.Alpha * (SCA/255.0) + Dst.Alpha * (1.0 - (SCA/255.0)) |
michael@0 | 107 | * This turns into Dst.Alpha = Src.Alpha when SCA = 255. |
michael@0 | 108 | * (http://msdn.microsoft.com/en-us/library/aa921335.aspx) |
michael@0 | 109 | * |