From: Christoph M. Becker Date: Fri, 2 Sep 2016 17:06:26 +0000 (+0200) Subject: Implement FAST_ZPP support for imagecolorat() and imagesetpixel() X-Git-Tag: php-7.2.0alpha1~1370 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0bf11d1e71c0c3a4cf959dd6a98882587fce32f8;p=php Implement FAST_ZPP support for imagecolorat() and imagesetpixel() These functions may be used in tight loops to do image manipulation in userland. Using FAST_ZPP is supposed to bring considerable performance improvements in this case; we've been able to measure up to 25%. --- diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 332bd5a408..5149db48bb 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -2805,9 +2805,17 @@ PHP_FUNCTION(imagecolorat) zend_long x, y; gdImagePtr im; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &IM, &x, &y) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(3, 3) + Z_PARAM_RESOURCE(IM) + Z_PARAM_LONG(x) + Z_PARAM_LONG(y) + ZEND_PARSE_PARAMETERS_END(); +#endif if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) { RETURN_FALSE; @@ -3067,9 +3075,18 @@ PHP_FUNCTION(imagesetpixel) zend_long x, y, col; gdImagePtr im; +#ifndef FAST_ZPP if (zend_parse_parameters(ZEND_NUM_ARGS(), "rlll", &IM, &x, &y, &col) == FAILURE) { return; } +#else + ZEND_PARSE_PARAMETERS_START(4, 4) + Z_PARAM_RESOURCE(IM) + Z_PARAM_LONG(x) + Z_PARAM_LONG(y) + Z_PARAM_LONG(col) + ZEND_PARSE_PARAMETERS_END(); +#endif if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) { RETURN_FALSE;