gfx/cairo/quartz-get-image.patch

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/cairo/quartz-get-image.patch	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,127 @@
     1.4 +diff --git a/gfx/cairo/README b/gfx/cairo/README
     1.5 +--- a/gfx/cairo/README
     1.6 ++++ b/gfx/cairo/README
     1.7 +@@ -69,16 +69,18 @@ quartz-state.patch: bug 522859; refactor
     1.8 + quartz-cache-CGImageRef.patch: cache CGImageRef for a CGBitmapContext; when we reuse it, Quartz will cache stuff, improving performance
     1.9 + 
    1.10 + quartz-remove-snapshot.patch: remove broken implementation of backend snapshot
    1.11 + 
    1.12 + quartz-cglayers.patch: add support for cairo surfaces backed by CGLayers
    1.13 + 
    1.14 + quartz-cglayers-fix-fallback.patch: Bug 572912; fix bug in fallback code in previous patch
    1.15 + 
    1.16 ++quartz-get-image.patch: Bug 575521; add a way to get the image surface associated with a surface
    1.17 ++
    1.18 + premultiply-alpha-solid-gradients.patch: bug 539165; multiply the solid color by the alpha component before using it for a solid surface
    1.19 + 
    1.20 + xlib-initialize-members.path: bug 548793; initialize XRender version if the server doesn't have the extension
    1.21 + 
    1.22 + remove-comma: remove a comma from enum
    1.23 + 
    1.24 + d2d.patch: add d2d support
    1.25 + 
    1.26 +diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    1.27 +--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
    1.28 ++++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
    1.29 +@@ -1880,24 +1880,24 @@ _cairo_quartz_surface_finish (void *abst
    1.30 +     surface->cgContext = NULL;
    1.31 + 
    1.32 +     if (surface->bitmapContextImage) {
    1.33 +         CGImageRelease (surface->bitmapContextImage);
    1.34 +         surface->bitmapContextImage = NULL;
    1.35 +     }
    1.36 + 
    1.37 +     if (surface->imageSurfaceEquiv) {
    1.38 ++	_cairo_image_surface_assume_ownership_of_data (surface->imageSurfaceEquiv);
    1.39 + 	cairo_surface_destroy (surface->imageSurfaceEquiv);
    1.40 + 	surface->imageSurfaceEquiv = NULL;
    1.41 ++    } else if (surface->imageData) {
    1.42 ++        free (surface->imageData);
    1.43 +     }
    1.44 + 
    1.45 +-    if (surface->imageData) {
    1.46 +-	free (surface->imageData);
    1.47 +-	surface->imageData = NULL;
    1.48 +-    }
    1.49 ++    surface->imageData = NULL;
    1.50 + 
    1.51 +     if (surface->cgLayer) {
    1.52 +         CGLayerRelease (surface->cgLayer);
    1.53 +     }
    1.54 + 
    1.55 +     return CAIRO_STATUS_SUCCESS;
    1.56 + }
    1.57 + 
    1.58 +@@ -3200,16 +3200,28 @@ cairo_quartz_finish_cg_context_with_clip
    1.59 +     cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface;
    1.60 + 
    1.61 +     if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
    1.62 + 	return;
    1.63 + 
    1.64 +     CGContextRestoreGState (quartz->cgContext);
    1.65 + }
    1.66 + 
    1.67 ++cairo_surface_t *
    1.68 ++cairo_quartz_surface_get_image (cairo_surface_t *surface)
    1.69 ++{
    1.70 ++    cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t *)surface;
    1.71 ++    cairo_image_surface_t *image;
    1.72 ++
    1.73 ++    if (_cairo_quartz_get_image(quartz, &image))
    1.74 ++        return NULL;
    1.75 ++
    1.76 ++    return (cairo_surface_t *)image;
    1.77 ++}
    1.78 ++
    1.79 + /* Debug stuff */
    1.80 + 
    1.81 + #ifdef QUARTZ_DEBUG
    1.82 + 
    1.83 + #include <Movies.h>
    1.84 + 
    1.85 + void ExportCGImageToPNGFile(CGImageRef inImageRef, char* dest)
    1.86 + {
    1.87 +diff --git a/gfx/cairo/cairo/src/cairo-quartz.h b/gfx/cairo/cairo/src/cairo-quartz.h
    1.88 +--- a/gfx/cairo/cairo/src/cairo-quartz.h
    1.89 ++++ b/gfx/cairo/cairo/src/cairo-quartz.h
    1.90 +@@ -63,16 +63,19 @@ cairo_public CGContextRef
    1.91 + cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
    1.92 + 
    1.93 + cairo_public CGContextRef
    1.94 + cairo_quartz_get_cg_context_with_clip (cairo_t *cr);
    1.95 + 
    1.96 + cairo_public void
    1.97 + cairo_quartz_finish_cg_context_with_clip (cairo_t *cr);
    1.98 + 
    1.99 ++cairo_public cairo_surface_t *
   1.100 ++cairo_quartz_surface_get_image (cairo_surface_t *surface);
   1.101 ++
   1.102 + #if CAIRO_HAS_QUARTZ_FONT
   1.103 + 
   1.104 + /*
   1.105 +  * Quartz font support
   1.106 +  */
   1.107 + 
   1.108 + cairo_public cairo_font_face_t *
   1.109 + cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
   1.110 +diff --git a/gfx/cairo/cairo/src/cairo-rename.h b/gfx/cairo/cairo/src/cairo-rename.h
   1.111 +--- a/gfx/cairo/cairo/src/cairo-rename.h
   1.112 ++++ b/gfx/cairo/cairo/src/cairo-rename.h
   1.113 +@@ -178,16 +178,17 @@
   1.114 + #define cairo_qpainter_surface_get_qpainter _moz_cairo_qpainter_surface_get_qpainter
   1.115 + #define cairo_quartz_font_face_create_for_atsu_font_id _moz_cairo_quartz_font_face_create_for_atsu_font_id
   1.116 + #define cairo_quartz_font_face_create_for_cgfont _moz_cairo_quartz_font_face_create_for_cgfont
   1.117 + #define cairo_quartz_image_surface_create _moz_cairo_quartz_image_surface_create
   1.118 + #define cairo_quartz_image_surface_get_image _moz_cairo_quartz_image_surface_get_image
   1.119 + #define cairo_quartz_surface_create _moz_cairo_quartz_surface_create
   1.120 + #define cairo_quartz_surface_create_for_cg_context _moz_cairo_quartz_surface_create_for_cg_context
   1.121 + #define cairo_quartz_surface_get_cg_context _moz_cairo_quartz_surface_get_cg_context
   1.122 ++#define cairo_quartz_surface_get_image _moz_cairo_quartz_surface_get_image
   1.123 + #define cairo_rectangle _moz_cairo_rectangle
   1.124 + #define cairo_rectangle_list_destroy _moz_cairo_rectangle_list_destroy
   1.125 + #define cairo_reference _moz_cairo_reference
   1.126 + #define cairo_rel_curve_to _moz_cairo_rel_curve_to
   1.127 + #define cairo_rel_line_to _moz_cairo_rel_line_to
   1.128 + #define cairo_rel_move_to _moz_cairo_rel_move_to
   1.129 + #define cairo_reset_clip _moz_cairo_reset_clip
   1.130 + #define cairo_restore _moz_cairo_restore

mercurial