From ca7270ffa22cfd87f343bf9be6af7742742a13b2 Mon Sep 17 00:00:00 2001 From: Pierre Joye Date: Wed, 14 Dec 2005 22:33:34 +0000 Subject: [PATCH] - add wbmp read/write tests - remove HAVE_GD_WBMP, always available --- ext/gd/config.m4 | 1 - ext/gd/config.w32 | 1 - ext/gd/gd.c | 44 ++++--------------------------- ext/gd/gd.dsp | 8 +++--- ext/gd/tests/createfromwbmp.phpt | 18 +++++++++++++ ext/gd/tests/imagewbmp.phpt | 31 ++++++++++++++++++++++ ext/gd/tests/src.wbmp | Bin 0 -> 9 bytes 7 files changed, 58 insertions(+), 45 deletions(-) create mode 100644 ext/gd/tests/createfromwbmp.phpt create mode 100644 ext/gd/tests/imagewbmp.phpt create mode 100644 ext/gd/tests/src.wbmp diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index 879a850782..3228655a41 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -327,7 +327,6 @@ if test "$PHP_GD" != "no"; then dnl These defines are always available dnl FIXME: Cleanup the sources so that these are not needed! - AC_DEFINE(HAVE_GD_WBMP, 1, [ ]) AC_DEFINE(HAVE_LIBGD13, 1, [ ]) AC_DEFINE(HAVE_LIBGD15, 1, [ ]) AC_DEFINE(HAVE_LIBGD20, 1, [ ]) diff --git a/ext/gd/config.w32 b/ext/gd/config.w32 index bb3c0b008f..b46c9c0b10 100644 --- a/ext/gd/config.w32 +++ b/ext/gd/config.w32 @@ -43,7 +43,6 @@ if (PHP_GD != "no") { /D HAVE_GD_PNG \ /D HAVE_GD_STRINGFTEX=1 \ /D HAVE_GD_STRINGTTF=1 \ -/D HAVE_GD_WBMP \ /D HAVE_GD_XBM \ /D HAVE_LIBFREETYPE=1 \ /D HAVE_LIBGD13=1 \ diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 84c477e5f2..b8cc209020 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -64,9 +64,8 @@ static void php_free_ps_enc(zend_rsrc_list_entry *rsrc TSRMLS_DC); #include /* 3 Medium bold font */ #include /* 4 Large font */ #include /* 5 Giant font */ -#ifdef HAVE_GD_WBMP #include "libgd/wbmp.h" -#endif + #ifdef ENABLE_GD_TTF # ifdef HAVE_LIBFREETYPE # include @@ -229,9 +228,7 @@ zend_function_entry gd_functions[] = { #ifdef HAVE_GD_JPG PHP_FE(imagecreatefromjpeg, NULL) #endif -#ifdef HAVE_GD_WBMP PHP_FE(imagecreatefromwbmp, NULL) -#endif #ifdef HAVE_GD_XBM PHP_FE(imagecreatefromxbm, NULL) #endif @@ -250,9 +247,7 @@ zend_function_entry gd_functions[] = { #ifdef HAVE_GD_JPG PHP_FE(imagejpeg, NULL) #endif -#ifdef HAVE_GD_WBMP PHP_FE(imagewbmp, NULL) -#endif PHP_FE(imagegd, NULL) PHP_FE(imagegd2, NULL) @@ -299,15 +294,13 @@ zend_function_entry gd_functions[] = { #endif PHP_FE(imagetypes, NULL) -#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_JPG) PHP_FE(jpeg2wbmp, NULL) #endif -#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_PNG) PHP_FE(png2wbmp, NULL) #endif -#ifdef HAVE_GD_WBMP PHP_FE(image2wbmp, NULL) -#endif #if HAVE_GD_BUNDLED PHP_FE(imagelayereffect, NULL) PHP_FE(imagecolormatch, NULL) @@ -512,9 +505,7 @@ PHP_MINFO_FUNCTION(gd) #ifdef HAVE_GD_PNG php_info_print_table_row(2, "PNG Support", "enabled"); #endif -#ifdef HAVE_GD_WBMP php_info_print_table_row(2, "WBMP Support", "enabled"); -#endif #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) php_info_print_table_row(2, "XPM Support", "enabled"); #endif @@ -577,11 +568,7 @@ PHP_FUNCTION(gd_info) #else add_assoc_bool(return_value, "PNG Support", 0); #endif -#ifdef HAVE_GD_WBMP add_assoc_bool(return_value, "WBMP Support", 1); -#else - add_assoc_bool(return_value, "WBMP Support", 0); -#endif #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) add_assoc_bool(return_value, "XPM Support", 1); #else @@ -1293,9 +1280,7 @@ PHP_FUNCTION(imagetypes) #ifdef HAVE_GD_PNG ret |= 4; #endif -#ifdef HAVE_GD_WBMP ret |= 8; -#endif #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) ret |= 16; #endif @@ -1332,7 +1317,6 @@ static int _php_image_type (char data[8]) } else if (!memcmp(data, php_sig_gif, 3)) { return PHP_GDIMG_TYPE_GIF; } -#ifdef HAVE_GD_WBMP else { gdIOCtx *io_ctx; io_ctx = gdNewDynamicCtxEx(8, data, 0); @@ -1353,7 +1337,6 @@ static int _php_image_type (char data[8]) } } } -#endif return -1; #endif } @@ -1436,12 +1419,7 @@ PHP_FUNCTION(imagecreatefromstring) break; case PHP_GDIMG_TYPE_WBM: -#ifdef HAVE_GD_WBMP im = _php_image_create_from_string(data, "WBMP", gdImageCreateFromWBMPCtx TSRMLS_CC); -#else - php_error_docref(NULL TSRMLS_CC, E_WARNING, "No WBMP support in this PHP build"); - RETURN_FALSE; -#endif break; case PHP_GDIMG_TYPE_GD2: @@ -1625,7 +1603,6 @@ PHP_FUNCTION(imagecreatefromxpm) /* }}} */ #endif -#ifdef HAVE_GD_WBMP /* {{{ proto resource imagecreatefromwbmp(string filename) Create a new image from WBMP file or URL */ PHP_FUNCTION(imagecreatefromwbmp) @@ -1633,7 +1610,6 @@ PHP_FUNCTION(imagecreatefromwbmp) _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_WBM, "WBMP", gdImageCreateFromWBMP, gdImageCreateFromWBMPCtx); } /* }}} */ -#endif /* HAVE_GD_WBMP */ /* {{{ proto resource imagecreatefromgd(string filename) Create a new image from GD file or URL */ @@ -1703,7 +1679,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } switch (image_type) { -#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -1713,7 +1688,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } gdImageWBMP(im, q, fp); break; -#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); break; @@ -1753,7 +1727,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } switch (image_type) { -#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -1763,7 +1736,6 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char } gdImageWBMP(im, q, tmp); break; -#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); break; @@ -1854,7 +1826,6 @@ PHP_FUNCTION(imagejpeg) /* }}} */ #endif /* HAVE_GD_JPG */ -#ifdef HAVE_GD_WBMP /* {{{ proto bool imagewbmp(resource im [, string filename, [, int foreground]]) Output WBMP image to browser or file */ PHP_FUNCTION(imagewbmp) @@ -1866,7 +1837,6 @@ PHP_FUNCTION(imagewbmp) #endif } /* }}} */ -#endif /* HAVE_GD_WBMP */ /* {{{ proto bool imagegd(resource im [, string filename]) Output GD image to browser or file */ @@ -3649,7 +3619,6 @@ PHP_FUNCTION(imagepsbbox) /* }}} */ #endif -#ifdef HAVE_GD_WBMP /* {{{ proto bool image2wbmp(resource im [, string filename [, int threshold]]) Output WBMP image to browser or file */ PHP_FUNCTION(image2wbmp) @@ -3657,9 +3626,8 @@ PHP_FUNCTION(image2wbmp) _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_CONVERT_WBM, "WBMP", _php_image_bw_convert); } /* }}} */ -#endif /* HAVE_GD_WBMP */ -#if defined(HAVE_GD_JPG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_JPG) /* {{{ proto bool jpeg2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold) Convert JPEG image to WBMP image */ PHP_FUNCTION(jpeg2wbmp) @@ -3669,7 +3637,7 @@ PHP_FUNCTION(jpeg2wbmp) /* }}} */ #endif -#if defined(HAVE_GD_PNG) && defined(HAVE_GD_WBMP) +#if defined(HAVE_GD_PNG) /* {{{ proto bool png2wbmp (string f_org, string f_dest, int d_height, int d_width, int threshold) Convert PNG image to WBMP image */ PHP_FUNCTION(png2wbmp) @@ -3679,7 +3647,6 @@ PHP_FUNCTION(png2wbmp) /* }}} */ #endif -#ifdef HAVE_GD_WBMP /* {{{ _php_image_bw_convert * It converts a gd Image to bw using a threshold value */ static void _php_image_bw_convert(gdImagePtr im_org, gdIOCtx *out, int threshold) @@ -3920,7 +3887,6 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) RETURN_TRUE; } /* }}} */ -#endif /* HAVE_GD_WBMP */ #endif /* HAVE_LIBGD */ diff --git a/ext/gd/gd.dsp b/ext/gd/gd.dsp index a1f87856b2..7d0c448062 100644 --- a/ext/gd/gd.dsp +++ b/ext/gd/gd.dsp @@ -43,8 +43,8 @@ RSC=rc.exe # PROP Intermediate_Dir "Release_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c +# ADD BASE CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=0 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_XBM" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=0 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_XBM" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -73,8 +73,8 @@ LINK32=link.exe # PROP Intermediate_Dir "Debug_TS" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c -# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D "HAVE_GD_WBMP" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c +# ADD BASE CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D HAVE_LIBGD13=1 /D HAVE_LIBGD=1 /D HAVE_LIBGD15=1 /D HAVE_LIBGD204=1 /FR /YX /FD /c +# ADD CPP /nologo /MDd /W3 /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I "libgd" /D ZEND_DEBUG=1 /D "HAVE_LIBGD15" /D HAVE_LIBGD204=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "COMPILE_DL_GD" /D ZTS=1 /D "ZEND_WIN32" /D "PHP_WIN32" /D HAVE_GD_GIF_READ=1 /D HAVE_GD_GIF_CREATE=1 /D HAVE_GDIMAGECOLORRESOLVE=1 /D "HAVE_GD_PNG" /D "HAVE_GD_JPG" /D HAVE_LIBGD=1 /D HAVE_LIBGD13=1 /D HAVE_LIBGD20=1 /D "USE_GD_IOCTX" /D HAVE_LIBFREETYPE=1 /D "USE_GD_IMGSTRTTF" /D HAVE_GD_STRINGTTF=1 /D HAVE_GD_BUNDLED=1 /D "MSWIN32" /D "HAVE_LIBPNG" /D "HAVE_LIBJPEG" /D HAVE_GD_STRINGFTEX=1 /D HAVE_GD_IMAGESETBRUSH=1 /D HAVE_GD_IMAGESETTILE=1 /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 diff --git a/ext/gd/tests/createfromwbmp.phpt b/ext/gd/tests/createfromwbmp.phpt new file mode 100644 index 0000000000..5e48f235e0 --- /dev/null +++ b/ext/gd/tests/createfromwbmp.phpt @@ -0,0 +1,18 @@ +--TEST-- +imagecreatefromwbmp +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test create from wbmp: ok diff --git a/ext/gd/tests/imagewbmp.phpt b/ext/gd/tests/imagewbmp.phpt new file mode 100644 index 0000000000..cea464e759 --- /dev/null +++ b/ext/gd/tests/imagewbmp.phpt @@ -0,0 +1,31 @@ +--TEST-- +imagewbmp +--SKIPIF-- + +--FILE-- + +--EXPECT-- +test create wbmp: ok diff --git a/ext/gd/tests/src.wbmp b/ext/gd/tests/src.wbmp new file mode 100644 index 0000000000000000000000000000000000000000..d38c74268a0f8235927e436cfb163175bb68b7ea GIT binary patch literal 9 QcmZQzU}gRB