From cd94cf60a2379ccfe4619b1b9384a68b3e7a1205 Mon Sep 17 00:00:00 2001 From: "Christoph M. Becker" Date: Mon, 29 Apr 2019 16:14:26 +0200 Subject: 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. --- ext/gd/gd.c | 6 +++++- ext/gd/tests/bug77943.phpt | 29 +++++++++++++++++++++++++++++ ext/gd/tests/bug77943.png | Bin 0 -> 2194 bytes 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 ext/gd/tests/bug77943.phpt create mode 100644 ext/gd/tests/bug77943.png (limited to 'ext/gd') diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 50d4745371..231fcac381 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; } /* }}} */ diff --git a/ext/gd/tests/bug77943.phpt b/ext/gd/tests/bug77943.phpt new file mode 100644 index 0000000000..1009b3e4b3 --- /dev/null +++ b/ext/gd/tests/bug77943.phpt @@ -0,0 +1,29 @@ +--TEST-- +Bug #77943 (imageantialias($image, false); does not work) +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +The images are equal. +===DONE=== diff --git a/ext/gd/tests/bug77943.png b/ext/gd/tests/bug77943.png new file mode 100644 index 0000000000..6eae56c05d Binary files /dev/null and b/ext/gd/tests/bug77943.png differ -- cgit v1.2.1