gfx/cairo/quartz-fallback.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 Robert O'Callahan <robert@ocallahan.org>
     3 # Date 1250204857 -43200
     4 # Node ID cc6bebbd93bb9d8606fe06b997f890acc17996fb
     5 # Parent  caea8b548962f0df38e8e9032e9f57ef0fd099ec
     6 Bug 507939 - Remove erroneous clip rect fixup which caused repainting errors with repeating radial gradients on Mac. r=jmuizelaar
     8 diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
     9 --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
    10 +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    11 @@ -1033,38 +1033,29 @@ typedef enum {
    12      DO_TILED_IMAGE
    13  } cairo_quartz_action_t;
    15  static cairo_quartz_action_t
    16  _cairo_quartz_setup_fallback_source (cairo_quartz_surface_t *surface,
    17  				     const cairo_pattern_t *source)
    18  {
    19      CGRect clipBox = CGContextGetClipBoundingBox (surface->cgContext);
    20 -    CGAffineTransform ctm;
    21      double x0, y0, w, h;
    23      cairo_surface_t *fallback;
    24      cairo_t *fallback_cr;
    25      CGImageRef img;
    26      cairo_pattern_t *source_copy;
    28      cairo_status_t status;
    30      if (clipBox.size.width == 0.0f ||
    31  	clipBox.size.height == 0.0f)
    32  	return DO_NOTHING;
    34 -    // the clipBox is in userspace, so:
    35 -    ctm = CGContextGetCTM (surface->cgContext);
    36 -    ctm = CGAffineTransformInvert (ctm);
    37 -    clipBox = CGRectApplyAffineTransform (clipBox, ctm);
    38 -
    39 -    // get the Y flip right -- the CTM will always have a Y flip in place
    40 -    clipBox.origin.y = surface->extents.height - (clipBox.origin.y + clipBox.size.height);
    41 -
    42      x0 = floor(clipBox.origin.x);
    43      y0 = floor(clipBox.origin.y);
    44      w = ceil(clipBox.origin.x + clipBox.size.width) - x0;
    45      h = ceil(clipBox.origin.y + clipBox.size.height) - y0;
    47      /* Create a temporary the size of the clip surface, and position
    48       * it so that the device origin coincides with the original surface */
    49      fallback = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) w, (int) h);
    50 @@ -1717,18 +1708,20 @@ _cairo_quartz_surface_paint (void *abstr
    51      action = _cairo_quartz_setup_source (surface, source);
    53      if (action == DO_SOLID || action == DO_PATTERN) {
    54  	CGContextFillRect (surface->cgContext, CGRectMake(surface->extents.x,
    55  							  surface->extents.y,
    56  							  surface->extents.width,
    57  							  surface->extents.height));
    58      } else if (action == DO_SHADING) {
    59 +	CGContextSaveGState (surface->cgContext);
    60  	CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
    61  	CGContextDrawShading (surface->cgContext, surface->sourceShading);
    62 +	CGContextRestoreGState (surface->cgContext);
    63      } else if (action == DO_IMAGE || action == DO_TILED_IMAGE) {
    64  	CGContextSaveGState (surface->cgContext);
    66  	CGContextConcatCTM (surface->cgContext, surface->sourceTransform);
    67  	CGContextTranslateCTM (surface->cgContext, 0, surface->sourceImageRect.size.height);
    68  	CGContextScaleCTM (surface->cgContext, 1, -1);
    70  	if (action == DO_IMAGE)

mercurial