diff options
author | Benjamin Otte <otte@redhat.com> | 2010-01-25 19:22:33 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2010-01-25 19:43:52 +0100 |
commit | 582604f7b6b5b2ab6e681245bc7cde64d4995307 (patch) | |
tree | 2cd0eb01ca920ef824c583c17264cc173f50c7f1 /src/cairo-png.c | |
parent | 002e02715cac9a285fd97e1bb6b068ceebfae3d8 (diff) | |
download | cairo-582604f7b6b5b2ab6e681245bc7cde64d4995307.tar.gz |
[png] Simplify coercion code
Call _cairo_image_surface_coerce() unconditionally to ensure coercion to
one of the standard formats happens even when it's a format we support.
Diffstat (limited to 'src/cairo-png.c')
-rw-r--r-- | src/cairo-png.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/cairo-png.c b/src/cairo-png.c index f89e03fc0..ecb27d84b 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -172,14 +172,11 @@ write_png (cairo_surface_t *surface, /* Handle the various fallback formats (e.g. low bit-depth XServers) * by coercing them to a simpler format using pixman. */ - if (image->format == CAIRO_FORMAT_INVALID) { - clone = _cairo_image_surface_coerce (image, - _cairo_format_from_content (image->base.content)); - status = clone->base.status; - if (unlikely (status)) - goto BAIL1; - } else - clone = image; + clone = _cairo_image_surface_coerce (image, + _cairo_format_from_content (image->base.content)); + status = clone->base.status; + if (unlikely (status)) + goto BAIL1; rows = _cairo_malloc_ab (clone->height, sizeof (png_byte*)); if (unlikely (rows == NULL)) { @@ -279,8 +276,7 @@ BAIL4: BAIL3: free (rows); BAIL2: - if (clone != image) - cairo_surface_destroy (&clone->base); + cairo_surface_destroy (&clone->base); BAIL1: _cairo_surface_release_source_image (surface, image, image_extra); |