michael@0: diff --git a/gfx/cairo/README b/gfx/cairo/README michael@0: --- a/gfx/cairo/README michael@0: +++ b/gfx/cairo/README michael@0: @@ -69,16 +69,18 @@ quartz-state.patch: bug 522859; refactor michael@0: quartz-cache-CGImageRef.patch: cache CGImageRef for a CGBitmapContext; when we reuse it, Quartz will cache stuff, improving performance michael@0: michael@0: quartz-remove-snapshot.patch: remove broken implementation of backend snapshot michael@0: michael@0: quartz-cglayers.patch: add support for cairo surfaces backed by CGLayers michael@0: michael@0: quartz-cglayers-fix-fallback.patch: Bug 572912; fix bug in fallback code in previous patch michael@0: michael@0: +quartz-get-image.patch: Bug 575521; add a way to get the image surface associated with a surface michael@0: + michael@0: premultiply-alpha-solid-gradients.patch: bug 539165; multiply the solid color by the alpha component before using it for a solid surface michael@0: michael@0: xlib-initialize-members.path: bug 548793; initialize XRender version if the server doesn't have the extension michael@0: michael@0: remove-comma: remove a comma from enum michael@0: michael@0: d2d.patch: add d2d support michael@0: michael@0: diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: --- a/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: +++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c michael@0: @@ -1880,24 +1880,24 @@ _cairo_quartz_surface_finish (void *abst michael@0: surface->cgContext = NULL; michael@0: michael@0: if (surface->bitmapContextImage) { michael@0: CGImageRelease (surface->bitmapContextImage); michael@0: surface->bitmapContextImage = NULL; michael@0: } michael@0: michael@0: if (surface->imageSurfaceEquiv) { michael@0: + _cairo_image_surface_assume_ownership_of_data (surface->imageSurfaceEquiv); michael@0: cairo_surface_destroy (surface->imageSurfaceEquiv); michael@0: surface->imageSurfaceEquiv = NULL; michael@0: + } else if (surface->imageData) { michael@0: + free (surface->imageData); michael@0: } michael@0: michael@0: - if (surface->imageData) { michael@0: - free (surface->imageData); michael@0: - surface->imageData = NULL; michael@0: - } michael@0: + surface->imageData = NULL; michael@0: michael@0: if (surface->cgLayer) { michael@0: CGLayerRelease (surface->cgLayer); michael@0: } michael@0: michael@0: return CAIRO_STATUS_SUCCESS; michael@0: } michael@0: michael@0: @@ -3200,16 +3200,28 @@ cairo_quartz_finish_cg_context_with_clip michael@0: cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t*)surface; michael@0: michael@0: if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ) michael@0: return; michael@0: michael@0: CGContextRestoreGState (quartz->cgContext); michael@0: } michael@0: michael@0: +cairo_surface_t * michael@0: +cairo_quartz_surface_get_image (cairo_surface_t *surface) michael@0: +{ michael@0: + cairo_quartz_surface_t *quartz = (cairo_quartz_surface_t *)surface; michael@0: + cairo_image_surface_t *image; michael@0: + michael@0: + if (_cairo_quartz_get_image(quartz, &image)) michael@0: + return NULL; michael@0: + michael@0: + return (cairo_surface_t *)image; michael@0: +} michael@0: + michael@0: /* Debug stuff */ michael@0: michael@0: #ifdef QUARTZ_DEBUG michael@0: michael@0: #include michael@0: michael@0: void ExportCGImageToPNGFile(CGImageRef inImageRef, char* dest) michael@0: { michael@0: diff --git a/gfx/cairo/cairo/src/cairo-quartz.h b/gfx/cairo/cairo/src/cairo-quartz.h michael@0: --- a/gfx/cairo/cairo/src/cairo-quartz.h michael@0: +++ b/gfx/cairo/cairo/src/cairo-quartz.h michael@0: @@ -63,16 +63,19 @@ cairo_public CGContextRef michael@0: cairo_quartz_surface_get_cg_context (cairo_surface_t *surface); michael@0: michael@0: cairo_public CGContextRef michael@0: cairo_quartz_get_cg_context_with_clip (cairo_t *cr); michael@0: michael@0: cairo_public void michael@0: cairo_quartz_finish_cg_context_with_clip (cairo_t *cr); michael@0: michael@0: +cairo_public cairo_surface_t * michael@0: +cairo_quartz_surface_get_image (cairo_surface_t *surface); michael@0: + michael@0: #if CAIRO_HAS_QUARTZ_FONT michael@0: michael@0: /* michael@0: * Quartz font support michael@0: */ michael@0: michael@0: cairo_public cairo_font_face_t * michael@0: cairo_quartz_font_face_create_for_cgfont (CGFontRef font); michael@0: diff --git a/gfx/cairo/cairo/src/cairo-rename.h b/gfx/cairo/cairo/src/cairo-rename.h michael@0: --- a/gfx/cairo/cairo/src/cairo-rename.h michael@0: +++ b/gfx/cairo/cairo/src/cairo-rename.h michael@0: @@ -178,16 +178,17 @@ michael@0: #define cairo_qpainter_surface_get_qpainter _moz_cairo_qpainter_surface_get_qpainter michael@0: #define cairo_quartz_font_face_create_for_atsu_font_id _moz_cairo_quartz_font_face_create_for_atsu_font_id michael@0: #define cairo_quartz_font_face_create_for_cgfont _moz_cairo_quartz_font_face_create_for_cgfont michael@0: #define cairo_quartz_image_surface_create _moz_cairo_quartz_image_surface_create michael@0: #define cairo_quartz_image_surface_get_image _moz_cairo_quartz_image_surface_get_image michael@0: #define cairo_quartz_surface_create _moz_cairo_quartz_surface_create michael@0: #define cairo_quartz_surface_create_for_cg_context _moz_cairo_quartz_surface_create_for_cg_context michael@0: #define cairo_quartz_surface_get_cg_context _moz_cairo_quartz_surface_get_cg_context michael@0: +#define cairo_quartz_surface_get_image _moz_cairo_quartz_surface_get_image michael@0: #define cairo_rectangle _moz_cairo_rectangle michael@0: #define cairo_rectangle_list_destroy _moz_cairo_rectangle_list_destroy michael@0: #define cairo_reference _moz_cairo_reference michael@0: #define cairo_rel_curve_to _moz_cairo_rel_curve_to michael@0: #define cairo_rel_line_to _moz_cairo_rel_line_to michael@0: #define cairo_rel_move_to _moz_cairo_rel_move_to michael@0: #define cairo_reset_clip _moz_cairo_reset_clip michael@0: #define cairo_restore _moz_cairo_restore