com php-src: Remove basically effectless gdImageAABlend(): ext/gd/libgd/gd.c ext/gd/tests/imagepolygon_aa.phpt ext/g d/tests/imagepolygon_aa.png
| From: | Christoph Michael Becker | Date: | Fri, 30 Sep 2016 14:12:47 +0000 |
| Subject: | com php-src: Remove basically effectless gdImageAABlend(): ext/gd/libgd/gd.c ext/gd/tests/imagepolygon_aa.phpt ext/g d/tests/imagepolygon_aa.png | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-94797@lists.php.net to get a copy of this message | ||
Commit: 04400b19fc9804014410e2a8a14c73a1bcb2480d
Author: Christoph M. Becker <cmbecker69@gmx.de> Fri, 30 Sep 2016 16:12:47 +0200
Parents: f72c27590ff2294f0b82b2786b257157eaee7c4a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=04400b19fc9804014410e2a8a14c73a1bcb2480d
Log:
Remove basically effectless gdImageAABlend()
This had already be done for GD 2.0.26 as part of the improved antialiasing
support (<https://boutell.com/gd/manual2.0.26.html#whatsnew2.0.26>).
Changed paths:
M ext/gd/libgd/gd.c
A ext/gd/tests/imagepolygon_aa.phpt
A ext/gd/tests/imagepolygon_aa.png
Diff:
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index 35b4397...df75054 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -1018,46 +1018,7 @@ int gdImageGetPixel (gdImagePtr im, int x, int y)
void gdImageAABlend (gdImagePtr im)
{
- float p_alpha, old_alpha;
- int color = im->AA_color, color_red, color_green, color_blue;
- int old_color, old_red, old_green, old_blue;
- int p_color, p_red, p_green, p_blue;
- int px, py;
-
- color_red = gdImageRed(im, color);
- color_green = gdImageGreen(im, color);
- color_blue = gdImageBlue(im, color);
-
- /* Impose the anti-aliased drawing on the image. */
- for (py = 0; py < im->sy; py++) {
- for (px = 0; px < im->sx; px++) {
- if (im->AA_opacity[py][px] != 0) {
- old_color = gdImageGetPixel(im, px, py);
-
- if ((old_color != color) && ((old_color != im->AA_dont_blend) ||
(im->AA_opacity[py][px] == 255))) {
- /* Only blend with different colors that aren't the dont_blend color. */
- p_alpha = (float) (im->AA_opacity[py][px]) / 255.0;
- old_alpha = 1.0 - p_alpha;
-
- if (p_alpha >= 1.0) {
- p_color = color;
- } else {
- old_red = gdImageRed(im, old_color);
- old_green = gdImageGreen(im, old_color);
- old_blue = gdImageBlue(im, old_color);
-
- p_red = (int) (((float) color_red * p_alpha) + ((float) old_red * old_alpha));
- p_green = (int) (((float) color_green * p_alpha) + ((float) old_green * old_alpha));
- p_blue = (int) (((float) color_blue * p_alpha) + ((float) old_blue * old_alpha));
- p_color = gdImageColorResolve(im, p_red, p_green, p_blue);
- }
- gdImageSetPixel(im, px, py, p_color);
- }
- }
- }
- /* Clear the AA_opacity array behind us. */
- memset(im->AA_opacity[py], 0, im->sx);
- }
+ (void)im;
}
static void _gdImageFilledHRectangle (gdImagePtr im, int x1, int y1, int x2, int y2, int color);
@@ -2743,7 +2704,6 @@ void gdImagePolygon (gdImagePtr im, gdPointPtr p, int n, int c)
if (c == gdAntiAliased) {
im->AA_polygon = 0;
- gdImageAABlend(im);
}
}
diff --git a/ext/gd/tests/imagepolygon_aa.phpt b/ext/gd/tests/imagepolygon_aa.phpt
new file mode 100644
index 0000000..e868f0c
--- /dev/null
+++ b/ext/gd/tests/imagepolygon_aa.phpt
@@ -0,0 +1,24 @@
+--TEST--
+antialiased imagepolygon()
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
+
+$im = imagecreatetruecolor(100, 100);
+$white = imagecolorallocate($im, 255, 255, 255);
+$black = imagecolorallocate($im, 0, 0, 0);
+imagefilledrectangle($im, 0,0, 99,99, $white);
+imageantialias($im, true);
+
+imagepolygon($im, [10,10, 49,89, 89,49], 3, $black);
+
+test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'imagepolygon_aa.png', $im);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
diff --git a/ext/gd/tests/imagepolygon_aa.png b/ext/gd/tests/imagepolygon_aa.png
new file mode 100644
index 0000000..a10af43
Binary files /dev/null and b/ext/gd/tests/imagepolygon_aa.png differ