summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cairoint.h1
-rw-r--r--util/cairo-script/cairo-script-operators.c8
-rw-r--r--util/cairo-trace/trace.c4
3 files changed, 12 insertions, 1 deletions
diff --git a/src/cairoint.h b/src/cairoint.h
index c8b1f583..f5d5f94d 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -2636,7 +2636,6 @@ slim_hidden_proto (cairo_surface_set_fallback_resolution);
slim_hidden_proto (cairo_surface_set_mime_data);
slim_hidden_proto (cairo_surface_show_page);
slim_hidden_proto (cairo_surface_status);
-slim_hidden_proto (cairo_surface_write_to_png_stream);
slim_hidden_proto (cairo_text_cluster_allocate);
slim_hidden_proto (cairo_text_cluster_free);
slim_hidden_proto (cairo_toy_font_face_create);
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c
index 13d6f766..81412583 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -2721,8 +2721,12 @@ png_read_func (void *closure, uint8_t *data, unsigned int len)
static csi_status_t
_image_read_png (csi_file_t *src, cairo_surface_t **out)
{
+#if CAIRO_HAS_PNG_FUNCTIONS
*out = cairo_image_surface_create_from_png_stream (png_read_func, src);
return cairo_surface_status (*out);
+#else
+ return CAIRO_STATUS_READ_ERROR;
+#endif
}
struct _image_tag {
@@ -5401,9 +5405,13 @@ _write_to_png (csi_t *ctx)
if (_csi_unlikely (status))
return status;
+#if CAIRO_HAS_PNG_FUNCTIONS
status = cairo_surface_write_to_png (surface, filename->string);
if (_csi_unlikely (status))
return status;
+#else
+ return CAIRO_STATUS_WRITE_ERROR;
+#endif
pop (1);
return CSI_STATUS_SUCCESS;
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index b272dd89..aaf8e19d 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -2986,6 +2986,7 @@ cairo_surface_set_mime_data (cairo_surface_t *surface,
closure);
}
+#if CAIRO_HAS_PNG_FUNCTIONS
cairo_status_t
cairo_surface_write_to_png (cairo_surface_t *surface, const char *filename)
{
@@ -3018,6 +3019,7 @@ cairo_surface_write_to_png_stream (cairo_surface_t *surface,
return DLCALL (cairo_surface_write_to_png_stream,
surface, write_func, data);
}
+#endif
static void CAIRO_PRINTF_FORMAT(2, 3)
_emit_pattern_op (cairo_pattern_t *pattern, const char *fmt, ...)
@@ -3629,6 +3631,7 @@ cairo_svg_surface_create_for_stream (cairo_write_func_t write_func, void *closur
#endif
+#if CAIRO_HAS_PNG_FUNCTIONS
cairo_surface_t *
cairo_image_surface_create_from_png (const char *filename)
{
@@ -3683,6 +3686,7 @@ cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, void *c
return ret;
}
+#endif
#if CAIRO_HAS_XLIB_SURFACE
#include <cairo-xlib.h>