pajoye Sat Mar 13 18:36:30 2004 EDT
Added files: (Branch: PHP_4_3)
/php-src/ext/gd/tests bug27582_1.phpt bug27582_2.phpt
Modified files:
/php-src/ext/gd/libgd gd.c
Log:
- MFH bug #27582 (imagefilltoborder crashes)
http://cvs.php.net/diff.php/php-src/ext/gd/libgd/gd.c?r1=1.24.2.24&r2=1.24.2.25&ty=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.24.2.24 php-src/ext/gd/libgd/gd.c:1.24.2.25
--- php-src/ext/gd/libgd/gd.c:1.24.2.24 Thu Dec 25 17:33:03 2003
+++ php-src/ext/gd/libgd/gd.c Sat Mar 13 18:36:28 2004
@@ -1769,6 +1769,11 @@
return;
}
+ if (im->alphaBlendingFlag) {
+ restoreAlphaBleding = 1;
+ im->alphaBlendingFlag = 0;
+ }
+
if (x >= im->sx) {
x = im->sx - 1;
}
@@ -1784,6 +1789,9 @@
leftLimit = i;
}
if (leftLimit == -1) {
+ if (restoreAlphaBleding) {
+ im->alphaBlendingFlag = 1;
+ }
return;
}
/* Seek right */
@@ -1827,6 +1835,9 @@
}
}
}
+ if (restoreAlphaBleding) {
+ im->alphaBlendingFlag = 1;
+ }
}
http://cvs.php.net/co.php/php-src/ext/gd/tests/bug27582_1.phpt?r=1.1&p=1
Index: php-src/ext/gd/tests/bug27582_1.phpt
+++ php-src/ext/gd/tests/bug27582_1.phpt
http://cvs.php.net/co.php/php-src/ext/gd/tests/bug27582_2.phpt?r=1.1&p=1
Index: php-src/ext/gd/tests/bug27582_2.phpt
+++ php-src/ext/gd/tests/bug27582_2.phpt
--TEST--
Bug #24594 (Filling an area using tiles).
--SKIPIF--
<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
if (!GD_BUNDLED) {
die('skip external GD libraries may fail');
}
?>
--FILE--
<?php
/* $id */
/*
* This test segfaults with the current imagefilltoborder
* implementation. A rewrite of this function is required
* to fix it. The algorithm used in gdImageFill (and the
* privat function for tiled fill) may help here. pierre.
*/
$tile = imagecreate(36,36);
$base = imagecreate(150,150);
$white = imagecolorallocate($tile,255,255,255);
$black = imagecolorallocate($tile,0,0,0);
$white = imagecolorallocate($base,255,255,255);
$black = imagecolorallocate($base,0,0,0);
/* create the dots pattern */
for ($x=0;$x<36;$x+=2) {
for ($y=0;$y<36;$y+=2) {
imagesetpixel($tile,$x,$y,$black);
}
}
imagesettile($base,$tile);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefill($base,11,12,IMG_COLOR_TILED);
$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';
$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';
$res .= imagecolorat($base,10,12)==$black?'1':'0';
$res .= imagecolorat($base,11,13)==$black?'1':'0';
$res .= imagecolorat($base,12,14)==$black?'1':'0';
$res .= imagecolorat($base,13,15)==$black?'1':'0';
$res .= imagecolorat($base,14,16)==$black?'1':'0';
$res .= imagecolorat($base,15,17)==$black?'1':'0';
echo "$res\n";
imagefilledrectangle($base,0,0,149,149,$white);
imagerectangle($base, 9,9,139,139,$black);
imageline($base, 9,9,139,139,$black);
imagefilltoborder($base,0,0,$black,IMG_COLOR_TILED);
$res = imagecolorat($base,0,10)==$black?'1':'0';
$res .= imagecolorat($base,0,20)==$black?'1':'0';
$res .= imagecolorat($base,0,30)==$black?'1':'0';
$res .= imagecolorat($base,0,40)==$black?'1':'0';
$res .= imagecolorat($base,0,50)==$black?'1':'0';
$res .= imagecolorat($base,0,60)==$black?'1':'0';
$res .= imagecolorat($base,11,12)==$white?'1':'0';
$res .= imagecolorat($base,12,13)==$white?'1':'0';
$res .= imagecolorat($base,13,14)==$white?'1':'0';
$res .= imagecolorat($base,14,15)==$white?'1':'0';
$res .= imagecolorat($base,15,16)==$white?'1':'0';
$res .= imagecolorat($base,16,17)==$white?'1':'0';
$res .= imagecolorat($base,0,16)==$black?'1':'0';
$res .= imagecolorat($base,2,42)==$black?'1':'0';
$res .= imagecolorat($base,4,44)==$black?'1':'0';
$res .= imagecolorat($base,146,146)==$black?'1':'0';
$res .= imagecolorat($base,148,146)==$black?'1':'0';
$res .= imagecolorat($base,0,0)==$black?'1':'0';
echo "$res\n";
?>
--EXPECT--
000000111111101010
111111111111111111
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php