]> granicus.if.org Git - php/commitdiff
Fix #77943: imageantialias($image, false); does not work
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 29 Apr 2019 15:23:16 +0000 (17:23 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 29 Apr 2019 15:23:16 +0000 (17:23 +0200)
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.

NEWS
ext/gd/gd.c

diff --git a/NEWS b/NEWS
index 3024c268ef07b34855150ec9bb4d109d5b7545bb..3a8ba4753347a0ed9ddf20db97666f9239e3c20c 100644 (file)
--- 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)
 
index 50d47453710fe9a117dcfd80082de393220d097b..231fcac3811c0bd1d8acb54e40a3b57eab799885 100644 (file)
@@ -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;
 }
 /* }}} */