Skip to content

Commit ab592df

Browse files
committed
Merge branch 'PHP-7.2'
* PHP-7.2: Fix #52070: imagedashedline() - dashed line sometimes is not visible
2 parents 6441b1b + 76f421d commit ab592df

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

ext/gd/libgd/gd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,6 @@ void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color
13381338
} else {
13391339
wid = 1;
13401340
}
1341-
wid = (int)(thick * sin(atan2(dy, dx)));
13421341
vert = 1;
13431342

13441343
d = 2 * dy - dx;

ext/gd/tests/bug52070.phpt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Bug #52070 (imagedashedline() - dashed line sometimes is not visible)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('gd')) die('skip gd extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$im = imagecreate(1200, 800);
10+
$background_color = imagecolorallocate($im, 40, 40, 40);
11+
$color = imagecolorallocate($im, 255, 255, 255);
12+
imagedashedline($im, 800, 400, 300, 400, $color);
13+
imagedashedline($im, 800, 400, 300, 800, $color);
14+
imagedashedline($im, 800, 400, 400, 800, $color);
15+
imagedashedline($im, 800, 400, 500, 800, $color);
16+
imagedashedline($im, 800, 400, 600, 800, $color);
17+
imagedashedline($im, 800, 400, 700, 800, $color);
18+
imagedashedline($im, 800, 400, 800, 800, $color);
19+
include_once __DIR__ . '/func.inc';
20+
test_image_equals_file(__DIR__ . '/bug52070.png', $im);
21+
?>
22+
===DONE===
23+
--EXPECT--
24+
The images are equal.
25+
===DONE===

ext/gd/tests/bug52070.png

2.17 KB
Loading

0 commit comments

Comments
 (0)