gfx/cairo/quartz-get-image.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/README b/gfx/cairo/README
     2 --- a/gfx/cairo/README
     3 +++ b/gfx/cairo/README
     4 @@ -69,16 +69,18 @@ quartz-state.patch: bug 522859; refactor
     5  quartz-cache-CGImageRef.patch: cache CGImageRef for a CGBitmapContext; when we reuse it, Quartz will cache stuff, improving performance
     7  quartz-remove-snapshot.patch: remove broken implementation of backend snapshot
     9  quartz-cglayers.patch: add support for cairo surfaces backed by CGLayers
    11  quartz-cglayers-fix-fallback.patch: Bug 572912; fix bug in fallback code in previous patch
    13 +quartz-get-image.patch: Bug 575521; add a way to get the image surface associated with a surface
    14 +
    15  premultiply-alpha-solid-gradients.patch: bug 539165; multiply the solid color by the alpha component before using it for a solid surface
    17  xlib-initialize-members.path: bug 548793; initialize XRender version if the server doesn't have the extension
    19  remove-comma: remove a comma from enum
    21  d2d.patch: add d2d support
    23 diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    24 --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
    25 +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    26 @@ -1880,24 +1880,24 @@ _cairo_quartz_surface_finish (void *abst
    27      surface->cgContext = NULL;
    29      if (surface->bitmapContextImage) {
    30          CGImageRelease (surface->bitmapContextImage);
    31          surface->bitmapContextImage = NULL;
    32      }
    34      if (surface->imageSurfaceEquiv) {
    35 +	_cairo_image_surface_assume_ownership_of_data (surface->imageSurfaceEquiv);
    36  	cairo_surface_destroy (surface->imageSurfaceEquiv);
    37  	surface->imageSurfaceEquiv = NULL;
    38 +    } else if (surface->imageData) {
    39 +        free (surface->imageData);
    40      }
    42 -    if (surface->imageData) {
    43 -	free (surface->imageData);
    44 -	surface->imageData = NULL;
    45 -    }
    46 +    surface->imageData = NULL;
    48      if (surface->cgLayer) {
    49          CGLayerRelease (surface->cgLayer);
    50      }
    52      return CAIRO_STATUS_SUCCESS;
    53  }
    55 @@ -3200,16 +3200,28 @@ cairo_quartz_finish_cg_context_with_clip
    56      cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface;
    58      if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
    59  	return;
    61      CGContextRestoreGState (quartz->cgContext);
    62  }
    64 +cairo_surface_t *
    65 +cairo_quartz_surface_get_image (cairo_surface_t *surface)
    66 +{
    67 +    cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t *)surface;
    68 +    cairo_image_surface_t *image;
    69 +
    70 +    if (_cairo_quartz_get_image(quartz, &image))
    71 +        return NULL;
    72 +
    73 +    return (cairo_surface_t *)image;
    74 +}
    75 +
    76  /* Debug stuff */
    78  #ifdef QUARTZ_DEBUG
    80  #include <Movies.h>
    82  void ExportCGImageToPNGFile(CGImageRef inImageRef, char* dest)
    83  {
    84 diff --git a/gfx/cairo/cairo/src/cairo-quartz.h b/gfx/cairo/cairo/src/cairo-quartz.h
    85 --- a/gfx/cairo/cairo/src/cairo-quartz.h
    86 +++ b/gfx/cairo/cairo/src/cairo-quartz.h
    87 @@ -63,16 +63,19 @@ cairo_public CGContextRef
    88  cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
    90  cairo_public CGContextRef
    91  cairo_quartz_get_cg_context_with_clip (cairo_t *cr);
    93  cairo_public void
    94  cairo_quartz_finish_cg_context_with_clip (cairo_t *cr);
    96 +cairo_public cairo_surface_t *
    97 +cairo_quartz_surface_get_image (cairo_surface_t *surface);
    98 +
    99  #if CAIRO_HAS_QUARTZ_FONT
   101  /*
   102   * Quartz font support
   103   */
   105  cairo_public cairo_font_face_t *
   106  cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
   107 diff --git a/gfx/cairo/cairo/src/cairo-rename.h b/gfx/cairo/cairo/src/cairo-rename.h
   108 --- a/gfx/cairo/cairo/src/cairo-rename.h
   109 +++ b/gfx/cairo/cairo/src/cairo-rename.h
   110 @@ -178,16 +178,17 @@
   111  #define cairo_qpainter_surface_get_qpainter _moz_cairo_qpainter_surface_get_qpainter
   112  #define cairo_quartz_font_face_create_for_atsu_font_id _moz_cairo_quartz_font_face_create_for_atsu_font_id
   113  #define cairo_quartz_font_face_create_for_cgfont _moz_cairo_quartz_font_face_create_for_cgfont
   114  #define cairo_quartz_image_surface_create _moz_cairo_quartz_image_surface_create
   115  #define cairo_quartz_image_surface_get_image _moz_cairo_quartz_image_surface_get_image
   116  #define cairo_quartz_surface_create _moz_cairo_quartz_surface_create
   117  #define cairo_quartz_surface_create_for_cg_context _moz_cairo_quartz_surface_create_for_cg_context
   118  #define cairo_quartz_surface_get_cg_context _moz_cairo_quartz_surface_get_cg_context
   119 +#define cairo_quartz_surface_get_image _moz_cairo_quartz_surface_get_image
   120  #define cairo_rectangle _moz_cairo_rectangle
   121  #define cairo_rectangle_list_destroy _moz_cairo_rectangle_list_destroy
   122  #define cairo_reference _moz_cairo_reference
   123  #define cairo_rel_curve_to _moz_cairo_rel_curve_to
   124  #define cairo_rel_line_to _moz_cairo_rel_line_to
   125  #define cairo_rel_move_to _moz_cairo_rel_move_to
   126  #define cairo_reset_clip _moz_cairo_reset_clip
   127  #define cairo_restore _moz_cairo_restore

mercurial