summaryrefslogtreecommitdiff
path: root/ext/gd/tests/bug73281.phpt
blob: 162ee1b33a85b3d51ece3cf2888d7f6be0bdf5ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
--TEST--
Bug #73281 (imagescale(…, IMG_BILINEAR_FIXED) can cause black border)
--SKIPIF--
<?php
if (!extension_loaded('gd')) die('skip gd extension not available');
if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.3', '<=')) die('skip upstream fix not yet released');
?>
--FILE--
<?php
$coordinates = [[0, 0], [0, 199], [199, 199], [199, 0]];

$src = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($src, 255, 255, 255);
imagefilledrectangle($src, 0,0, 99,99, $white);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
echo "truecolor source\n";
foreach ($coordinates as $coordinate) {
    list($x, $y) = $coordinate;
    printf("%3d, %3d: %x\n", $x, $y, imagecolorat($dst, $x, $y));
}

$src = imagecreate(100, 100);
$white = imagecolorallocate($src, 255, 255, 255);
imagefilledrectangle($src, 0,0, 99,99, $white);
$dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
echo "\npalette source\n";
foreach ($coordinates as $coordinate) {
    list($x, $y) = $coordinate;
    printf("%3d, %3d: %x\n", $x, $y, imagecolorat($dst, $x, $y));
}
?>
===DONE===
--EXPECT--
truecolor source
  0,   0: ffffff
  0, 199: ffffff
199, 199: ffffff
199,   0: ffffff

palette source
  0,   0: ffffff
  0, 199: ffffff
199, 199: ffffff
199,   0: ffffff
===DONE===