com php-src: Implement FAST_ZPP support for imagecolora t() and imagesetpixel(): ext/gd/gd.c
| From: | Christoph Michael Becker | Date: | Fri, 02 Sep 2016 17:06:26 +0000 |
| Subject: | com php-src: Implement FAST_ZPP support for imagecolora t() and imagesetpixel(): ext/gd/gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94255@lists.php.net to get a copy of this message | ||
Commit: 0bf11d1e71c0c3a4cf959dd6a98882587fce32f8
Author: Christoph M. Becker <cmbecker69@gmx.de> Fri, 2 Sep 2016 19:06:26 +0200
Parents: a565f06d89c029b7336e17dd6f22ff0416341430
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0bf11d1e71c0c3a4cf959dd6a98882587fce32f8
Log:
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%.
Changed paths:
M ext/gd/gd.c
Diff:
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 332bd5a..5149db4 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;