summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2017-08-16 21:57:54 (GMT)
committerfvogel <fvogelnew1@free.fr>2017-08-16 21:57:54 (GMT)
commit529cbbedfc05feddbb139047b0acca13cf18d516 (patch)
tree3ee43f5155b2ed1664b960fd6b552b017a53bc91
parentfdb30c8ae222354ea2f65a03bd2a602d92fe20ea (diff)
downloadtk-529cbbedfc05feddbb139047b0acca13cf18d516.zip
tk-529cbbedfc05feddbb139047b0acca13cf18d516.tar.gz
tk-529cbbedfc05feddbb139047b0acca13cf18d516.tar.bz2
Fix [2874226]: polygon doesn't honor -joinstyle on Windows and OS X. This second fix deals with the Windows case only, when drawing non-stippled lines.
-rw-r--r--win/tkWinDraw.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/win/tkWinDraw.c b/win/tkWinDraw.c
index 1d17cc6..85d39c5 100644
--- a/win/tkWinDraw.c
+++ b/win/tkWinDraw.c
@@ -763,7 +763,8 @@ RenderObject(
int npoints,
int mode,
HPEN pen,
- WinDrawFunc func)
+ WinDrawFunc func) /* Name of the Windows GDI drawing function:
+ this is either Polyline or Polygon. */
{
RECT rect = {0,0,0,0};
HPEN oldPen;
@@ -861,7 +862,24 @@ RenderObject(
SetPolyFillMode(dc, (gc->fill_rule == EvenOddRule) ? ALTERNATE
: WINDING);
+ BeginPath(dc);
func(dc, winPoints, npoints);
+ /*
+ * In the case of closed polylines, the first and last points
+ * are the same. We want miter or bevel join be rendered also
+ * at this point, this needs telling the Windows GDI that the
+ * path is closed.
+ */
+ if ((points[0].x == points[npoints-1].x) &&
+ (points[0].y == points[npoints-1].y)) {
+ CloseFigure(dc);
+ }
+ EndPath(dc);
+ if (func == Polygon) {
+ StrokeAndFillPath(dc);
+ } else {
+ StrokePath(dc);
+ }
SelectObject(dc, oldPen);
}
DeleteObject(SelectObject(dc, oldBrush));