Fix compilation with --enable-png=no

Adrian Johnson spotted that the build was broken if the PNG functions were
disabled. Fix.
This commit is contained in:
Chris Wilson 2008-12-12 10:12:43 +00:00
parent 391c602640
commit e184bf0d35
3 changed files with 12 additions and 1 deletions

View file

@ -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);

View file

@ -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;

View file

@ -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>