bug73281.phpt 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. Bug #73281 (imagescale(…, IMG_BILINEAR_FIXED) can cause black border)
  3. --EXTENSIONS--
  4. gd
  5. --SKIPIF--
  6. <?php
  7. if (!GD_BUNDLED && version_compare(GD_VERSION, '2.2.3', '<=')) die('skip upstream fix not yet released');
  8. ?>
  9. --FILE--
  10. <?php
  11. $coordinates = [[0, 0], [0, 199], [199, 199], [199, 0]];
  12. $src = imagecreatetruecolor(100, 100);
  13. $white = imagecolorallocate($src, 255, 255, 255);
  14. imagefilledrectangle($src, 0,0, 99,99, $white);
  15. $dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
  16. echo "truecolor source\n";
  17. foreach ($coordinates as $coordinate) {
  18. list($x, $y) = $coordinate;
  19. printf("%3d, %3d: %x\n", $x, $y, imagecolorat($dst, $x, $y));
  20. }
  21. $src = imagecreate(100, 100);
  22. $white = imagecolorallocate($src, 255, 255, 255);
  23. imagefilledrectangle($src, 0,0, 99,99, $white);
  24. $dst = imagescale($src, 200, 200, IMG_BILINEAR_FIXED);
  25. echo "\npalette source\n";
  26. foreach ($coordinates as $coordinate) {
  27. list($x, $y) = $coordinate;
  28. printf("%3d, %3d: %x\n", $x, $y, imagecolorat($dst, $x, $y));
  29. }
  30. ?>
  31. --EXPECT--
  32. truecolor source
  33. 0, 0: ffffff
  34. 0, 199: ffffff
  35. 199, 199: ffffff
  36. 199, 0: ffffff
  37. palette source
  38. 0, 0: ffffff
  39. 0, 199: ffffff
  40. 199, 199: ffffff
  41. 199, 0: ffffff