summaryrefslogtreecommitdiff
path: root/src/cairo-surface-fallback.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-11-05 16:38:34 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-11-05 18:13:09 +0000
commite40d62a0fe96b8b937017a3bc2f18766c411ec41 (patch)
treea00ea404aaf2f1ec3b97f01bf968c3085a8d0007 /src/cairo-surface-fallback.c
parent89616dee8f11c6a7de3fa476b13661420648786f (diff)
[png] Attach the png representation to cairo_surface_create_from_png().
Attach the original png data as an alternate representation for image surfaces created by cairo_surface_create_from_png().
Diffstat (limited to 'src/cairo-surface-fallback.c')
-rw-r--r--src/cairo-surface-fallback.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index f8f89025..bb29a9f0 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -1036,6 +1036,11 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface)
cairo_surface_pattern_t pattern;
cairo_image_surface_t *image;
void *image_extra;
+ const char *mime_types[] = {
+ CAIRO_MIME_TYPE_JPEG,
+ CAIRO_MIME_TYPE_PNG,
+ NULL
+ }, **mime_type;
status = _cairo_surface_acquire_source_image (surface,
&image, &image_extra);
@@ -1075,15 +1080,12 @@ _cairo_surface_fallback_snapshot (cairo_surface_t *surface)
snapshot->device_transform = surface->device_transform;
snapshot->device_transform_inverse = surface->device_transform_inverse;
- /* XXX Need to copy all known image representations...
- * For now, just copy "image/jpeg", but in future we should construct
- * an array of known types and iterate.
- */
- status = _cairo_surface_copy_mime_data (snapshot, surface,
- CAIRO_MIME_TYPE_JPEG);
- if (status) {
- cairo_surface_destroy (snapshot);
- return _cairo_surface_create_in_error (status);
+ for (mime_type = mime_types; *mime_type; mime_type++) {
+ status = _cairo_surface_copy_mime_data (snapshot, surface, *mime_type);
+ if (status) {
+ cairo_surface_destroy (snapshot);
+ return _cairo_surface_create_in_error (status);
+ }
}
snapshot->is_snapshot = TRUE;