com php-src: Fix #77943: imageantialias($image, false); does not work: NEWS ext/gd/gd.c
| From: | Christoph Michael Becker | Date: | Mon, 29 Apr 2019 15:23:16 +0000 |
| Subject: | com php-src: Fix #77943: imageantialias($image, false); does not work: NEWS ext/gd/gd.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105979@lists.php.net to get a copy of this message | ||
Commit: 18a9ae412f00cc1e312c296952fac24f16b4d4de
Author: Christoph M. Becker <cmbecker69@gmx.de> Mon, 29 Apr 2019 17:23:16 +0200
Parents: 3891e0d13a0e85e51a450a868960e98b5c74df56
Branches: PHP-7.2 PHP-7..3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=18a9ae412f00cc1e312c296952fac24f16b4d4de
Log:
Fix #77943: imageantialias($image, false); does not work
Firstly, we must not call
gdImageSetAntiAliased() (which sets the
color to anti-alias), but rather modify the gdImage.AA flag.
Furthermore, we have to actually use the supplied boolean value.
We also make sure that we don't attempt to enable anti-aliasing for
palette images.
Bugs:
https://bugs.php..net/77943
Changed paths:
M NEWS
M ext/gd/gd.c
Diff:
diff --git a/NEWS b/NEWS
index 3024c26..3a8ba47 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,9 @@ PHP NEWS
- FPM:
. Fixed bug #77921 (static..php.net doesn't work anymore). (Peter Kokot)
+- GD:
+ . Fixed bug #77943 (imageantialias($image, false); does not work). (cmb)
+
- JSON:
. Fixed bug #77843 (Use after free with json serializer). (Nikita)
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 50d4745..231fcac 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -4699,7 +4699,11 @@ PHP_FUNCTION(imageantialias)
if ((im = (gdImagePtr)zend_fetch_resource(Z_RES_P(IM), "Image", le_gd)) == NULL) {
RETURN_FALSE;
}
- gdImageSetAntiAliased(im, 0);
+
+ if (im->trueColor) {
+ im->AA = alias;
+ }
+
RETURN_TRUE;
}
/* }}} */