Permalink
Browse files

Add some ifdefs for functions added in recent Cairo

  • Loading branch information...
1 parent 33970b2 commit f85ab78befd05a55b1871863bf00fe1fe717e252 @mgdm mgdm committed Feb 15, 2012
Showing with 11 additions and 1 deletion.
  1. +4 −0 cairo.c
  2. +5 −1 cairo_surface.c
  3. +2 −0 php_cairo.h
View
@@ -481,13 +481,15 @@ ZEND_BEGIN_ARG_INFO(cairo_surface_create_similar_args, ZEND_SEND_BY_VAL)
ZEND_ARG_INFO(0, height)
ZEND_END_ARG_INFO()
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
ZEND_BEGIN_ARG_INFO(cairo_surface_create_for_rectangle_args, ZEND_SEND_BY_VAL)
ZEND_ARG_OBJ_INFO(0, surface, CairoSurface, 0)
ZEND_ARG_INFO(0, x)
ZEND_ARG_INFO(0, y)
ZEND_ARG_INFO(0, width)
ZEND_ARG_INFO(0, height)
ZEND_END_ARG_INFO()
+#endif
ZEND_BEGIN_ARG_INFO(cairo_surface_mark_dirty_rectangle_args, ZEND_SEND_BY_VAL)
ZEND_ARG_OBJ_INFO(0, surface, CairoSurface, 0)
@@ -1067,7 +1069,9 @@ static const zend_function_entry cairo_functions[] = {
/* Generic Surface Functions */
PHP_FE(cairo_surface_create_similar, cairo_surface_create_similar_args)
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
PHP_FE(cairo_surface_create_for_rectangle, cairo_surface_create_similar_args)
+#endif
PHP_FE(cairo_surface_status, cairo_surface_args)
PHP_FE(cairo_surface_finish, cairo_surface_args)
PHP_FE(cairo_surface_flush, cairo_surface_args)
View
@@ -106,6 +106,7 @@ PHP_FUNCTION(cairo_surface_create_similar)
proto CairoSurface object CairoSurface->createForRectangle(double x, double y, double width, double height)
Create a new surface that is a rectangle within the target surface. */
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
PHP_FUNCTION(cairo_surface_create_for_rectangle)
{
zval *surface_zval = NULL;
@@ -130,6 +131,7 @@ PHP_FUNCTION(cairo_surface_create_for_rectangle)
new_surface_object->parent_zval = surface_zval;
new_surface_object->surface = new_surface;
}
+#endif
/* }}} */
@@ -530,7 +532,9 @@ PHP_FUNCTION(cairo_surface_write_to_png)
const zend_function_entry cairo_surface_methods[] = {
PHP_ME(CairoSurface, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME_MAPPING(createSimilar, cairo_surface_create_similar, CairoSurface_createSimilar_args, ZEND_ACC_PUBLIC)
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
PHP_ME_MAPPING(createForRectangle, cairo_surface_create_for_rectangle, CairoSurface_createForRectangle_args, ZEND_ACC_PUBLIC)
+#endif
PHP_ME_MAPPING(status, cairo_surface_status, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(finish, cairo_surface_finish, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(flush, cairo_surface_flush, NULL, ZEND_ACC_PUBLIC)
@@ -687,7 +691,7 @@ zend_class_entry* php_cairo_get_surface_ce(cairo_surface_t *surface TSRMLS_DC)
break;
#endif
-#ifdef CAIRO_HAS_PS_SURFACE
+#ifdef CAIRO_HAS_RECORDING_SURFACE
case CAIRO_SURFACE_TYPE_RECORDING:
type = cairo_ce_cairorecordingsurface;
break;
View
@@ -418,7 +418,9 @@ PHP_FUNCTION(cairo_scaled_font_get_type);
/* Generic Surface Functions */
PHP_FUNCTION(cairo_surface_create_similar);
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
PHP_FUNCTION(cairo_surface_create_for_rectangle);
+#endif
PHP_FUNCTION(cairo_surface_status);
PHP_FUNCTION(cairo_surface_finish);
PHP_FUNCTION(cairo_surface_flush);

0 comments on commit f85ab78

Please sign in to comment.