pajoye Wed Dec 14 22:33:34 2005 EDT Added files: /php-src/ext/gd/tests createfromwbmp.phpt imagewbmp.phpt src.wbmp
Modified files: /php-src/ext/gd config.m4 config.w32 gd.c gd.dsp Log: - add wbmp read/write tests - remove HAVE_GD_WBMP, always available
http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/config.m4?r1=1.159&r2=1.160&diff_format=u Index: php-src/ext/gd/config.m4 diff -u php-src/ext/gd/config.m4:1.159 php-src/ext/gd/config.m4:1.160 --- php-src/ext/gd/config.m4:1.159 Wed Dec 14 19:10:52 2005 +++ php-src/ext/gd/config.m4 Wed Dec 14 22:33:33 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.159 2005/12/14 19:10:52 pajoye Exp $ +dnl $Id: config.m4,v 1.160 2005/12/14 22:33:33 pajoye Exp $ dnl dnl @@ -327,7 +327,6 @@ 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, [ ]) http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/config.w32?r1=1.12&r2=1.13&diff_format=u Index: php-src/ext/gd/config.w32 diff -u php-src/ext/gd/config.w32:1.12 php-src/ext/gd/config.w32:1.13 --- php-src/ext/gd/config.w32:1.12 Wed Dec 14 19:12:57 2005 +++ php-src/ext/gd/config.w32 Wed Dec 14 22:33:33 2005 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.12 2005/12/14 19:12:57 pajoye Exp $ +// $Id: config.w32,v 1.13 2005/12/14 22:33:33 pajoye Exp $ // vim:ft=javascript ARG_WITH("gd", "Bundled GD support", "yes,shared"); @@ -43,7 +43,6 @@ /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 \ http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.c?r1=1.324&r2=1.325&diff_format=u Index: php-src/ext/gd/gd.c diff -u php-src/ext/gd/gd.c:1.324 php-src/ext/gd/gd.c:1.325 --- php-src/ext/gd/gd.c:1.324 Wed Dec 14 19:10:52 2005 +++ php-src/ext/gd/gd.c Wed Dec 14 22:33:33 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: gd.c,v 1.324 2005/12/14 19:10:52 pajoye Exp $ */ +/* $Id: gd.c,v 1.325 2005/12/14 22:33:33 pajoye Exp $ */ /* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center, Cold Spring Harbor Labs. */ @@ -64,9 +64,8 @@ #include <gdfontmb.h> /* 3 Medium bold font */ #include <gdfontl.h> /* 4 Large font */ #include <gdfontg.h> /* 5 Giant font */ -#ifdef HAVE_GD_WBMP #include "libgd/wbmp.h" -#endif + #ifdef ENABLE_GD_TTF # ifdef HAVE_LIBFREETYPE # include <ft2build.h> @@ -229,9 +228,7 @@ #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 @@ #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 @@ #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 @@ #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 @@ #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 @@ #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 @@ } 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 @@ } } } -#endif return -1; #endif } @@ -1436,12 +1419,7 @@ 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 @@ /* }}} */ #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_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 @@ } switch (image_type) { -#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -1713,7 +1688,6 @@ } gdImageWBMP(im, q, fp); break; -#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); break; @@ -1753,7 +1727,6 @@ } switch (image_type) { -#ifdef HAVE_GD_WBMP case PHP_GDIMG_CONVERT_WBM: if (q == -1) { q = 0; @@ -1763,7 +1736,6 @@ } gdImageWBMP(im, q, tmp); break; -#endif case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); break; @@ -1854,7 +1826,6 @@ /* }}} */ #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 @@ #endif } /* }}} */ -#endif /* HAVE_GD_WBMP */ /* {{{ proto bool imagegd(resource im [, string filename]) Output GD image to browser or file */ @@ -3649,7 +3619,6 @@ /* }}} */ #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_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 @@ /* }}} */ #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 @@ /* }}} */ #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 @@ RETURN_TRUE; } /* }}} */ -#endif /* HAVE_GD_WBMP */ #endif /* HAVE_LIBGD */ http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/gd.dsp?r1=1.20&r2=1.21&diff_format=u Index: php-src/ext/gd/gd.dsp diff -u php-src/ext/gd/gd.dsp:1.20 php-src/ext/gd/gd.dsp:1.21 --- php-src/ext/gd/gd.dsp:1.20 Wed Dec 14 19:12:57 2005 +++ php-src/ext/gd/gd.dsp Wed Dec 14 22:33:33 2005 @@ -43,8 +43,8 @@ # 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 @@ # 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 http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/createfromwbmp.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/createfromwbmp.phpt +++ php-src/ext/gd/tests/createfromwbmp.phpt --TEST-- imagecreatefromwbmp --SKIPIF-- <?php if (!function_exists('imagecreatefromwbmp')) die("skip gd extension not available\n"); if (!GD_BUNDLED) die('skip external GD libraries always fail'); ?> --FILE-- <?php $file = dirname(__FILE__) . '/src.wbmp'; $im2 = imagecreatefromwbmp($file); echo 'test create from wbmp: '; echo imagecolorat($im2, 3,3) == 0x0 ? 'ok' : 'failed'; echo "\n"; ?> --EXPECT-- test create from wbmp: ok http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/imagewbmp.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/imagewbmp.phpt +++ php-src/ext/gd/tests/imagewbmp.phpt --TEST-- imagewbmp --SKIPIF-- <?php if (!function_exists('imagecreatefromwbmp')) die("skip gd extension not available\n"); if (!GD_BUNDLED) die('skip external GD libraries always fail'); ?> --FILE-- <?php $file = dirname(__FILE__) . '/im.wbmp'; $im = imagecreatetruecolor(6,6); imagefill($im, 0,0, 0xffffff); imagesetpixel($im, 3,3, 0x0); imagewbmp($im, $file); $im2 = imagecreatefromwbmp($file); echo 'test create wbmp: '; $c = imagecolorsforindex($im2, imagecolorat($im2, 3,3)); $failed = false; foreach ($c as $v) { if ($v != 0) { $failed = true; } } echo !$failed ? 'ok' : 'failed'; echo "\n"; unlink($file); ?> --EXPECT-- test create wbmp: ok http://cvs.php.net/viewcvs.cgi/php-src/ext/gd/tests/src.wbmp?view=markup&rev=1.1 Index: php-src/ext/gd/tests/src.wbmp +++ php-src/ext/gd/tests/src.wbmp
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php