From 224a67fb9f91f027efa8142d6b81072b33bd6cc5 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 10 Apr 2013 20:12:25 +0200 Subject: add external 2.1 detection and fix gd_compat for 2.1+ --- ext/gd/config.m4 | 2 ++ ext/gd/gd.c | 8 ++++++-- ext/gd/libgd/gd_compat.h | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index ebbdb92fb9..d85c8b985c 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -252,6 +252,8 @@ AC_DEFUN([PHP_GD_CHECK_VERSION],[ PHP_CHECK_LIBRARY(gd, gdFreeFontCache, [AC_DEFINE(HAVE_GD_FREEFONTCACHE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdFontCacheMutexSetup, [AC_DEFINE(HAVE_GD_FONTMUTEX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) PHP_CHECK_LIBRARY(gd, gdNewDynamicCtxEx, [AC_DEFINE(HAVE_GD_DYNAMIC_CTX_EX, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImageConvolution, [AC_DEFINE(HAVE_GD_IMAGE_CONVOLUTION, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) + PHP_CHECK_LIBRARY(gd, gdImagePixelate, [AC_DEFINE(HAVE_GD_IMAGE_PIXELATE, 1, [ ])], [], [ -L$GD_LIB $GD_SHARED_LIBADD ]) ]) dnl diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 3bb9fa2e5f..25f53687c1 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -1241,9 +1241,13 @@ PHP_RSHUTDOWN_FUNCTION(gd) /* }}} */ #if HAVE_GD_BUNDLED -#define PHP_GD_VERSION_STRING "bundled (2.0.34 compatible)" +#define PHP_GD_VERSION_STRING "bundled (2.1.0 compatible)" #else -#define PHP_GD_VERSION_STRING "2.0" +# ifdef GD_VERSION_STRING +# define PHP_GD_VERSION_STRING GD_VERSION_STRING +# else +# define PHP_GD_VERSION_STRING "2.0" +# endif #endif /* {{{ PHP_MINFO_FUNCTION diff --git a/ext/gd/libgd/gd_compat.h b/ext/gd/libgd/gd_compat.h index c084a0069c..779e709a63 100644 --- a/ext/gd/libgd/gd_compat.h +++ b/ext/gd/libgd/gd_compat.h @@ -32,6 +32,7 @@ int gdImageContrast(gdImagePtr src, double contrast); /* Simply adds or substracts respectively red, green or blue to a pixel */ int gdImageColor(gdImagePtr src, const int red, const int green, const int blue, const int alpha); +#if !defined(HAVE_GD_IMAGE_CONVOLUTION) /* Image convolution by a 3x3 custom matrix */ int gdImageConvolution(gdImagePtr src, float ft[3][3], float filter_div, float offset); int gdImageEdgeDetectQuick(gdImagePtr src); @@ -40,11 +41,17 @@ int gdImageSelectiveBlur( gdImagePtr src); int gdImageEmboss(gdImagePtr im); int gdImageMeanRemoval(gdImagePtr im); int gdImageSmooth(gdImagePtr im, float weight); +#endif + +#if !defined(HAVE_GD_IMAGE_PIXELATE) enum gdPixelateMode { GD_PIXELATE_UPPERLEFT, GD_PIXELATE_AVERAGE }; +int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode); +#endif + int gdImagePixelate(gdImagePtr im, int block_size, const unsigned int mode); #if !HAVE_GD_IMAGEELLIPSE -- cgit v1.2.1