Submitted By: Armin K. Initial Package Version: 1.12.0 Upstream Status: Unknown Origin: Mozilla. From the Firefox-12 source. Description: this is gfx/cairo/expose-snapshot.patch applied to the system Cairo to expose some private functions. It allows Firefox to be compiled with --enable-system-cairo More details https://bugzilla.mozilla.org/show_bug.cgi?id=722975 Based on Andy's patch, but rediffed for Cairo 1.12.4. --- cairo.orig/src/cairo-analysis-surface.c 2012-04-29 11:04:27.000000000 +0200 +++ cairo/src/cairo-analysis-surface.c 2012-10-07 20:22:22.407783487 +0200 @@ -125,7 +125,7 @@ _cairo_surface_init (&proxy->base, &proxy_backend, NULL, target->content); proxy->target = target; - _cairo_surface_attach_snapshot (source, &proxy->base, NULL); + cairo_surface_attach_snapshot (source, &proxy->base, NULL); return &proxy->base; } @@ -916,7 +916,7 @@ }; cairo_surface_t * -_cairo_null_surface_create (cairo_content_t content) +cairo_null_surface_create (cairo_content_t content) { cairo_surface_t *surface; --- cairo.orig/src/cairo-analysis-surface-private.h 2010-06-13 21:58:21.000000000 +0200 +++ cairo/src/cairo-analysis-surface-private.h 2012-10-07 20:22:22.407783487 +0200 @@ -68,7 +68,4 @@ _cairo_analysis_surface_merge_status (cairo_int_status_t status_a, cairo_int_status_t status_b); -cairo_private cairo_surface_t * -_cairo_null_surface_create (cairo_content_t content); - #endif /* CAIRO_ANALYSIS_SURFACE_H */ --- cairo.orig/src/cairo-cogl-surface.c 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/cairo-cogl-surface.c 2012-10-07 20:22:22.407783487 +0200 @@ -1403,7 +1403,7 @@ reference_surface->ignore_alpha, NULL, COGL_TEXTURE (texture)); - _cairo_surface_attach_snapshot (abstract_surface, clone, NULL); + cairo_surface_attach_snapshot (abstract_surface, clone, NULL); /* Attaching the snapshot will take a reference on the clone surface... */ cairo_surface_destroy (clone); --- cairo.orig/src/cairo.h 2012-03-29 12:05:32.000000000 +0200 +++ cairo/src/cairo.h 2012-10-07 20:22:22.408783503 +0200 @@ -232,6 +232,15 @@ typedef void (*cairo_destroy_func_t) (void *data); /** + * cairo_surface_func_t: + * @surface: The surface being referred to. + * + * #cairo_surface_func_t the type of function which is used for callback + * when a surface needs to be passed as a parameter. + */ +typedef void (*cairo_surface_func_t) (cairo_surface_t *surface); + +/** * cairo_user_data_key_t: * @unused: not used; ignore. * @@ -2414,6 +2423,14 @@ void *user_data, cairo_destroy_func_t destroy); +cairo_public void +cairo_surface_attach_snapshot (cairo_surface_t *surface, + cairo_surface_t *snapshot, + cairo_surface_func_t detach_func); + +cairo_public void +cairo_surface_detach_snapshot (cairo_surface_t *snapshot); + #define CAIRO_MIME_TYPE_JPEG "image/jpeg" #define CAIRO_MIME_TYPE_PNG "image/png" #define CAIRO_MIME_TYPE_JP2 "image/jp2" @@ -2690,6 +2707,11 @@ cairo_public cairo_raster_source_finish_func_t cairo_raster_source_pattern_get_finish (cairo_pattern_t *pattern); +/* Null-surface functions */ + +cairo_public cairo_surface_t * +cairo_null_surface_create (cairo_content_t content); + /* Pattern creation functions */ cairo_public cairo_pattern_t * --- cairo.orig/src/cairo-image-source.c 2012-04-29 11:04:27.000000000 +0200 +++ cairo/src/cairo-image-source.c 2012-10-07 20:22:22.408783503 +0200 @@ -670,7 +670,7 @@ _cairo_surface_init (&proxy->base, &proxy_backend, NULL, image->content); proxy->image = image; - _cairo_surface_attach_snapshot (source, &proxy->base, NULL); + cairo_surface_attach_snapshot (source, &proxy->base, NULL); return &proxy->base; } --- cairo.orig/src/cairoint.h 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/cairoint.h 2012-10-07 20:22:22.409783519 +0200 @@ -1382,17 +1382,9 @@ cairo_private cairo_surface_t * _cairo_surface_snapshot (cairo_surface_t *surface); -cairo_private void -_cairo_surface_attach_snapshot (cairo_surface_t *surface, - cairo_surface_t *snapshot, - cairo_surface_func_t detach_func); - cairo_private cairo_surface_t * _cairo_surface_has_snapshot (cairo_surface_t *surface, - const cairo_surface_backend_t *backend); - -cairo_private void -_cairo_surface_detach_snapshot (cairo_surface_t *snapshot); + const cairo_surface_backend_t *backend); cairo_private cairo_status_t _cairo_surface_begin_modification (cairo_surface_t *surface); --- cairo.orig/src/cairo-recording-surface.c 2012-10-05 15:06:00.000000000 +0200 +++ cairo/src/cairo-recording-surface.c 2012-10-07 20:22:22.410783534 +0200 @@ -553,7 +553,7 @@ _cairo_surface_init (&proxy->base, &proxy_backend, NULL, image->content); proxy->image = image; - _cairo_surface_attach_snapshot (source, &proxy->base, NULL); + cairo_surface_attach_snapshot (source, &proxy->base, NULL); return &proxy->base; } @@ -1944,7 +1944,7 @@ cairo_surface_t *analysis_surface; cairo_status_t status; - null_surface = _cairo_null_surface_create (surface->base.content); + null_surface = cairo_null_surface_create (surface->base.content); analysis_surface = _cairo_analysis_surface_create (null_surface); cairo_surface_destroy (null_surface); --- cairo.orig/src/cairo-script-surface.c 2012-04-29 11:04:27.000000000 +0200 +++ cairo/src/cairo-script-surface.c 2012-10-07 20:22:22.410783534 +0200 @@ -1117,7 +1117,7 @@ "dup /s%d exch def ", surface->base.unique_id); - _cairo_surface_attach_snapshot (source, &surface->base, detach_snapshot); + cairo_surface_attach_snapshot (source, &surface->base, detach_snapshot); cairo_surface_destroy (&surface->base); } --- cairo.orig/src/cairo-surface.c 2012-09-27 22:38:56.000000000 +0200 +++ cairo/src/cairo-surface.c 2012-10-07 20:25:31.030695973 +0200 @@ -330,14 +330,14 @@ _cairo_surface_detach_snapshots (cairo_surface_t *surface) { while (_cairo_surface_has_snapshots (surface)) { - _cairo_surface_detach_snapshot (cairo_list_first_entry (&surface->snapshots, + cairo_surface_detach_snapshot (cairo_list_first_entry (&surface->snapshots, cairo_surface_t, snapshot)); } } void -_cairo_surface_detach_snapshot (cairo_surface_t *snapshot) +cairo_surface_detach_snapshot (cairo_surface_t *snapshot) { assert (snapshot->snapshot_of != NULL); @@ -351,7 +351,7 @@ } void -_cairo_surface_attach_snapshot (cairo_surface_t *surface, +cairo_surface_attach_snapshot (cairo_surface_t *surface, cairo_surface_t *snapshot, cairo_surface_func_t detach_func) { @@ -361,7 +361,7 @@ cairo_surface_reference (snapshot); if (snapshot->snapshot_of != NULL) - _cairo_surface_detach_snapshot (snapshot); + cairo_surface_detach_snapshot (snapshot); snapshot->snapshot_of = surface; snapshot->snapshot_detach = detach_func; @@ -1461,7 +1461,7 @@ /* update the current snapshots *before* the user updates the surface */ _cairo_surface_detach_snapshots (surface); if (surface->snapshot_of != NULL) - _cairo_surface_detach_snapshot (surface); + cairo_surface_detach_snapshot (surface); _cairo_surface_detach_mime_data (surface); return __cairo_surface_flush (surface, flags); --- cairo.orig/src/cairo-surface-private.h 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/cairo-surface-private.h 2012-10-07 20:22:22.412783564 +0200 @@ -46,8 +46,6 @@ #include "cairo-clip-private.h" #include "cairo-surface-backend-private.h" -typedef void (*cairo_surface_func_t) (cairo_surface_t *); - struct _cairo_surface { const cairo_surface_backend_t *backend; cairo_device_t *device; --- cairo.orig/src/cairo-surface-snapshot.c 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/cairo-surface-snapshot.c 2012-10-07 20:22:22.412783564 +0200 @@ -281,7 +281,7 @@ snapshot->base.device_transform = surface->device_transform; snapshot->base.device_transform_inverse = surface->device_transform_inverse; - _cairo_surface_attach_snapshot (surface, + cairo_surface_attach_snapshot (surface, &snapshot->base, _cairo_surface_snapshot_copy_on_write); --- cairo.orig/src/cairo-surface-subsurface.c 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/cairo-surface-subsurface.c 2012-10-07 20:22:22.412783564 +0200 @@ -562,10 +562,10 @@ return; if (ss->snapshot) - _cairo_surface_detach_snapshot (ss->snapshot); + cairo_surface_detach_snapshot (ss->snapshot); ss->snapshot = cairo_surface_reference (snapshot); - _cairo_surface_attach_snapshot (ss->target, &ss->base, + cairo_surface_attach_snapshot (ss->target, &ss->base, _cairo_surface_subsurface_detach_snapshot); } --- cairo.orig/src/cairo-vg-surface.c 2012-04-19 14:17:58.000000000 +0200 +++ cairo/src/cairo-vg-surface.c 2012-10-07 20:22:22.413783579 +0200 @@ -986,7 +986,7 @@ return status; } - _cairo_surface_attach_snapshot (spat->surface, &clone->base, + cairo_surface_attach_snapshot (spat->surface, &clone->base, _vg_surface_remove_from_cache); DONE: --- cairo.orig/src/cairo-xcb-surface.c 2012-09-27 22:38:56.000000000 +0200 +++ cairo/src/cairo-xcb-surface.c 2012-10-07 20:22:58.916347305 +0200 @@ -500,7 +500,7 @@ if (unlikely (image->status)) return image->status; - _cairo_surface_attach_snapshot (&surface->base, image, NULL); + cairo_surface_attach_snapshot (&surface->base, image, NULL); DONE: *image_out = (cairo_image_surface_t *) image; @@ -748,7 +748,7 @@ &surface->fallback_damage); if (status == CAIRO_STATUS_SUCCESS && ! surface->base._finishing) { - _cairo_surface_attach_snapshot (&surface->base, + cairo_surface_attach_snapshot (&surface->base, &surface->fallback->base, cairo_surface_finish); } --- cairo.orig/src/cairo-xcb-surface-core.c 2012-02-02 01:48:14.000000000 +0100 +++ cairo/src/cairo-xcb-surface-core.c 2012-10-07 20:22:22.414783595 +0200 @@ -440,7 +440,7 @@ if (unlikely (pixmap->base.status)) return pixmap; - _cairo_surface_attach_snapshot (source, &pixmap->base, NULL); + cairo_surface_attach_snapshot (source, &pixmap->base, NULL); if (pattern->base.extend != CAIRO_EXTEND_NONE) { if (extents->x < 0 || extents->y < 0 || --- cairo.orig/src/cairo-xcb-surface-render.c 2012-09-27 22:38:56.000000000 +0200 +++ cairo/src/cairo-xcb-surface-render.c 2012-10-07 20:22:22.414783595 +0200 @@ -1295,7 +1295,7 @@ return picture; } - _cairo_surface_attach_snapshot (source, + cairo_surface_attach_snapshot (source, &picture->base, NULL); --- cairo.orig/src/drm/cairo-drm-i915-shader.c 2012-02-02 01:48:14.000000000 +0100 +++ cairo/src/drm/cairo-drm-i915-shader.c 2012-10-07 20:22:22.416783627 +0200 @@ -1656,7 +1656,7 @@ image, &s); if (likely (status == CAIRO_STATUS_SUCCESS)) { - _cairo_surface_attach_snapshot (surface, + cairo_surface_attach_snapshot (surface, &s->intel.drm.base, intel_surface_detach_snapshot); --- cairo.orig/src/drm/cairo-drm-i965-shader.c 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/drm/cairo-drm-i965-shader.c 2012-10-07 20:22:22.416783627 +0200 @@ -281,7 +281,7 @@ return status; } - _cairo_surface_attach_snapshot (&image->base, + cairo_surface_attach_snapshot (&image->base, &clone->intel.drm.base, intel_surface_detach_snapshot); @@ -567,7 +567,7 @@ if (bo->purgeable && ! intel_bo_madvise (&device->intel, bo, I915_MADV_WILLNEED)) { - _cairo_surface_detach_snapshot (&s->intel.drm.base); + cairo_surface_detach_snapshot (&s->intel.drm.base); s = NULL; } --- cairo.orig/src/drm/cairo-drm-intel-surface.c 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/drm/cairo-drm-intel-surface.c 2012-10-07 20:22:22.417783642 +0200 @@ -105,7 +105,7 @@ if (unlikely (image->status)) return image->status; - _cairo_surface_attach_snapshot (&surface->drm.base, image, surface_finish_and_destroy); + cairo_surface_attach_snapshot (&surface->drm.base, image, surface_finish_and_destroy); DONE: *image_out = (cairo_image_surface_t *) cairo_surface_reference (image); --- cairo.orig/src/drm/cairo-drm-radeon-surface.c 2012-09-13 13:38:21.000000000 +0200 +++ cairo/src/drm/cairo-drm-radeon-surface.c 2012-10-07 20:22:22.417783642 +0200 @@ -107,7 +107,7 @@ if (unlikely (status)) return status; - _cairo_surface_attach_snapshot (&surface->base.base, image, cairo_surface_destroy); + cairo_surface_attach_snapshot (&surface->base.base, image, cairo_surface_destroy); DONE: *image_out = (cairo_image_surface_t *) cairo_surface_reference (image); --- cairo.orig/test/xcb-snapshot-assert.c 2012-05-24 11:15:54.000000000 +0200 +++ cairo/test/xcb-snapshot-assert.c 2012-10-07 20:22:22.417783642 +0200 @@ -68,7 +68,7 @@ } CAIRO_TEST (xcb_snapshot_assert, - "Test a wrong _cairo_surface_attach_snapshot call", + "Test a wrong cairo_surface_attach_snapshot call", "xcb", /* keywords */ NULL, /* requirements */ 2, 2, --- cairo.orig/test/xcb-stress-cache.c 2012-02-02 01:48:15.000000000 +0100 +++ cairo/test/xcb-stress-cache.c 2012-10-07 20:22:22.417783642 +0200 @@ -48,7 +48,7 @@ * already full, so a random cache entry is picked and removed. * - The surface that was added before is picked and gets fed to * _surface_cache_entry_destroy. - * - This calls _cairo_surface_detach_snapshot which causes the + * - This calls cairo_surface_detach_snapshot which causes the * detach_func from above to be called, so the surface is finished and the * associated picture is FreePicture'd. * - _composite_mask now uses a Picture that was already freed.