Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bd837a0

Browse filesBrowse files
committed
Fix #4230: Don't overflow buffer with sketch path.
There's no good way to estimate the length of the string when sketch is turned on, so I've just bitten the bullet and made the string dynamically reallocatable after all. It's a bit of a performance regression in that there is always a string copy upon creating the Python string object, but at least now this should work for arbitrary path transformations.
1 parent daa51ca commit bd837a0
Copy full SHA for bd837a0

File tree

Expand file treeCollapse file tree

7 files changed

+12230
-42
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+12230
-42
lines changed

‎lib/matplotlib/backends/backend_svg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_svg.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,21 +540,23 @@ def option_image_nocomposite(self):
540540
else:
541541
return not rcParams['image.composite_image']
542542

543-
def _convert_path(self, path, transform=None, clip=None, simplify=None):
543+
def _convert_path(self, path, transform=None, clip=None, simplify=None,
544+
sketch=None):
544545
if clip:
545546
clip = (0.0, 0.0, self.width, self.height)
546547
else:
547548
clip = None
548549
return _path.convert_to_string(
549-
path, transform, clip, simplify, None, 6,
550+
path, transform, clip, simplify, sketch, 6,
550551
[b'M', b'L', b'Q', b'C', b'z'], False).decode('ascii')
551552

552553
def draw_path(self, gc, path, transform, rgbFace=None):
553554
trans_and_flip = self._make_flip_transform(transform)
554555
clip = (rgbFace is None and gc.get_hatch_path() is None)
555556
simplify = path.should_simplify and clip
556557
path_data = self._convert_path(
557-
path, trans_and_flip, clip=clip, simplify=simplify)
558+
path, trans_and_flip, clip=clip, simplify=simplify,
559+
sketch=gc.get_sketch_params())
558560

559561
attrib = {}
560562
attrib['style'] = self._get_style(gc, rgbFace)
Binary file not shown.
Loading

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.