mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-08 18:28:03 +02:00
[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.
This commit is contained in:
parent
002e02715c
commit
582604f7b6
1 changed files with 6 additions and 10 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue