Skip to content

Commit 6e5950d

Browse files
committed
Merge remote-tracking branch 'origin/v1.1.x'
2 parents bbe02dd + ae4a308 commit 6e5950d

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

lib/matplotlib/backends/backend_cairo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ def convert_path(ctx, path, transform):
127127
for points, code in path.iter_segments(transform):
128128
if code == Path.MOVETO:
129129
ctx.move_to(*points)
130+
elif code == Path.CLOSEPOLY:
131+
ctx.close_path()
130132
elif code == Path.LINETO:
131133
ctx.line_to(*points)
132134
elif code == Path.CURVE3:
@@ -135,8 +137,6 @@ def convert_path(ctx, path, transform):
135137
points[2], points[3])
136138
elif code == Path.CURVE4:
137139
ctx.curve_to(*points)
138-
elif code == Path.CLOSEPOLY:
139-
ctx.close_path()
140140

141141

142142
def draw_path(self, gc, path, transform, rgbFace=None):

lib/matplotlib/backends/backend_emf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,15 @@ def convert_path(self, tpath):
234234
for points, code in tpath.iter_segments():
235235
if code == Path.MOVETO:
236236
self.emf.MoveTo(*points)
237+
elif code == Path.CLOSEPOLY:
238+
self.emf.CloseFigure()
237239
elif code == Path.LINETO:
238240
self.emf.LineTo(*points)
239241
elif code == Path.CURVE3:
240242
points = quad2cubic(*(list(last_points[-2:]) + list(points)))
241243
self.emf.PolyBezierTo(zip(points[2::2], points[3::2]))
242244
elif code == Path.CURVE4:
243245
self.emf.PolyBezierTo(zip(points[::2], points[1::2]))
244-
elif code == Path.CLOSEPOLY:
245-
self.emf.CloseFigure()
246246
last_points = points
247247
self.emf.EndPath()
248248

lib/matplotlib/backends/backend_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,8 @@ def pathOperations(path, transform, clip=None, simplify=None):
12631263
# This is allowed anywhere in the path
12641264
cmds.extend(points)
12651265
cmds.append(Op.moveto)
1266+
elif code == Path.CLOSEPOLY:
1267+
cmds.append(Op.closepath)
12661268
elif last_points is None:
12671269
# The other operations require a previous point
12681270
raise ValueError('Path lacks initial MOVETO')
@@ -1276,8 +1278,6 @@ def pathOperations(path, transform, clip=None, simplify=None):
12761278
elif code == Path.CURVE4:
12771279
cmds.extend(points)
12781280
cmds.append(Op.curveto)
1279-
elif code == Path.CLOSEPOLY:
1280-
cmds.append(Op.closepath)
12811281
last_points = points
12821282
return cmds
12831283

lib/matplotlib/backends/backend_ps.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,11 @@ def _convert_path(self, path, transform, clip=False, simplify=None):
533533
simplify=simplify):
534534
if code == Path.MOVETO:
535535
ps.append("%g %g m" % tuple(points))
536+
elif code == Path.CLOSEPOLY:
537+
ps.append("cl")
538+
elif last_points is None:
539+
# The other operations require a previous point
540+
raise ValueError('Path lacks initial MOVETO')
536541
elif code == Path.LINETO:
537542
ps.append("%g %g l" % tuple(points))
538543
elif code == Path.CURVE3:
@@ -541,8 +546,6 @@ def _convert_path(self, path, transform, clip=False, simplify=None):
541546
tuple(points[2:]))
542547
elif code == Path.CURVE4:
543548
ps.append("%g %g %g %g %g %g c" % tuple(points))
544-
elif code == Path.CLOSEPOLY:
545-
ps.append("cl")
546549
last_points = points
547550

548551
ps = "\n".join(ps)

0 commit comments

Comments
 (0)