Skip to content

Commit 1650927

Browse files
committed
With cairo /pycairo both at version 1.8.8, I'm still seeing crashes with paths
longer than 20000 points or so (tried the gtkcairo backend on Mac OS X). So the path length check is still needed. svn path=/trunk/matplotlib/; revision=8162
1 parent 64e2b9c commit 1650927

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/matplotlib/backends/backend_cairo.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,17 @@ def convert_path(ctx, path, transform):
138138

139139

140140
def draw_path(self, gc, path, transform, rgbFace=None):
141+
if len(path.vertices) > 18980:
142+
raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")
143+
141144
ctx = gc.ctx
142145

143146
transform = transform + \
144147
Affine2D().scale(1.0, -1.0).translate(0, self.height)
145148

146149
ctx.new_path()
147150
self.convert_path(ctx, path, transform)
148-
151+
149152
self._fill_and_stroke(ctx, rgbFace, gc.get_alpha())
150153

151154
def draw_image(self, gc, x, y, im):

0 commit comments

Comments
 (0)