Skip to content

Commit 9c37d95

Browse files
committed
Fix #52070: imagedashedline() - dashed line sometimes is not visible
We finally remove the inadvertent leftover from the synchronization with GD 2.0.12.
1 parent 2688023 commit 9c37d95

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ PHP NEWS
1010
too long). (Jacob Hipps)
1111
. Fixed incorrect write to getenv result in FPM reload. (Jakub Zelenka)
1212

13+
- GD:
14+
. Fixed bug #52070 (imagedashedline() - dashed line sometimes is not visible).
15+
(cmb)
16+
1317
- mbstring:
1418
. Fixed bug #75944 (Wrong cp1251 detection). (dmk001)
1519
. Fixed bug #76113 (mbstring does not build with Oniguruma 6.8.1).

ext/gd/libgd/gd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,6 @@ void gdImageDashedLine (gdImagePtr im, int x1, int y1, int x2, int y2, int color
13921392
} else {
13931393
wid = 1;
13941394
}
1395-
wid = (int)(thick * sin(atan2(dy, dx)));
13961395
vert = 1;
13971396

13981397
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)