summaryrefslogtreecommitdiff
path: root/ext/gd
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2019-04-29 16:17:58 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-04-29 16:18:27 +0200
commit3fc1bdc81c022b18bb7fad0f8e4536bb72db46d9 (patch)
tree415c3076e8ef1c4fd5bb598770934013ddc3912c /ext/gd
parentff2b5bda59c994ebecdb962a9a63c95dcb2e2ef9 (diff)
parentcd94cf60a2379ccfe4619b1b9384a68b3e7a1205 (diff)
downloadphp-git-3fc1bdc81c022b18bb7fad0f8e4536bb72db46d9.tar.gz
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fix #77943: imageantialias($image, false); does not work
Diffstat (limited to 'ext/gd')
-rw-r--r--ext/gd/gd.c6
-rw-r--r--ext/gd/tests/bug77943.phpt29
-rw-r--r--ext/gd/tests/bug77943.pngbin0 -> 2194 bytes
3 files changed, 34 insertions, 1 deletions
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index 66464960c7..ca9fdf51a7 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -4623,7 +4623,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--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . '/func.inc';
+
+$width = 400;
+$height = 300;
+$im = imagecreatetruecolor($width, $height);
+$white = imagecolorallocate($im, 255, 255, 255);
+$blue = imagecolorallocate($im, 0, 0, 255);
+
+imageantialias($im, false);
+imagefilledrectangle($im, 0, 0, $width-1, $height-1, $white);
+
+imageline($im, 0, 0, $width, $height, $blue);
+imagesetthickness($im, 3);
+imageline($im, 10, 0, $width, $height-10, $blue);
+
+test_image_equals_file(__DIR__ . '/bug77943.png', $im);
+?>
+===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
--- /dev/null
+++ b/ext/gd/tests/bug77943.png
Binary files differ