summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph M. Becker <cmbecker69@gmx.de>2016-09-14 15:49:25 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2016-09-14 15:50:09 +0200
commitbc27ce98eef4579a153fab67f66f52f19aa06623 (patch)
tree0a8bce2ef88e0e11010eae980729609710a51bc4
parentcfc8522238a6117eab699ceb493e6b9db5dd9508 (diff)
parent09eb6ed35eb5b0d164aa9fbad52dd8d873166294 (diff)
downloadphp-git-bc27ce98eef4579a153fab67f66f52f19aa06623.tar.gz
Merge branch 'PHP-5.6' into PHP-7.0
-rw-r--r--NEWS2
-rw-r--r--ext/gd/libgd/gdft.c2
-rw-r--r--ext/gd/tests/bug50194.phpt29
-rw-r--r--ext/gd/tests/bug50194.pngbin0 -> 2827 bytes
4 files changed, 33 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index d209f23eef..44959d64a8 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,8 @@ PHP NEWS
- GD:
. Fixed bug #67325 (imagetruecolortopalette: white is duplicated in palette).
(cmb)
+ . Fixed bug #50194 (imagettftext broken on transparent background w/o
+ alphablending). (cmb)
- Mbstring:
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c
index d484b83e2e..6de314e971 100644
--- a/ext/gd/libgd/gdft.c
+++ b/ext/gd/libgd/gdft.c
@@ -658,6 +658,8 @@ static char * gdft_draw_bitmap (gdCache_head_t *tc_cache, gdImage * im, int fg,
} else {
return "Unsupported ft_pixel_mode";
}
+ if (level == 0) /* if background */
+ continue;
if ((fg >= 0) && (im->trueColor)) {
/* Consider alpha in the foreground color itself to be an
* upper bound on how opaque things get, when truecolor is
diff --git a/ext/gd/tests/bug50194.phpt b/ext/gd/tests/bug50194.phpt
new file mode 100644
index 0000000000..91b7b35139
--- /dev/null
+++ b/ext/gd/tests/bug50194.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #50194 (imagettftext broken on transparent background w/o alphablending)
+--SKIPIF--
+<?php
+if (!extension_loaded('gd')) die('skip gd extension not available');
+if (!function_exists('imagettftext')) die('skip imagettftext() not available');
+?>
+--FILE--
+<?php
+require_once __DIR__ . DIRECTORY_SEPARATOR . 'func.inc';
+
+$im = imagecreatetruecolor(240, 55);
+$background = imagecolorallocatealpha($im, 60, 60, 60, 0); // no tranparency
+$black = imagecolorallocate($im, 0, 0, 0);
+imagealphablending($im, false);
+imagefilledrectangle($im, 0, 0, 239, 54, $background);
+$text = 'Testing ... ';
+$font = __DIR__ . DIRECTORY_SEPARATOR . 'Tuffy.ttf';
+imagettftext($im, 40, 0, 10, 40, $black, $font, $text);
+imagesavealpha($im, true);
+
+test_image_equals_file(__DIR__ . DIRECTORY_SEPARATOR . 'bug50194.png', $im);
+
+imagedestroy($im);
+?>
+===DONE===
+--EXPECT--
+The images are equal.
+===DONE===
diff --git a/ext/gd/tests/bug50194.png b/ext/gd/tests/bug50194.png
new file mode 100644
index 0000000000..5bbf5babae
--- /dev/null
+++ b/ext/gd/tests/bug50194.png
Binary files differ