Skip to content

Commit 687fe27

Browse files
committed
Bracket each call to new_gc() by a corresponding call to gc.restore() to avoid
bugs in the Cairo and Mac OS X backends. svn path=/trunk/matplotlib/; revision=7969
1 parent 50509ca commit 687fe27

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/matplotlib/patheffects.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
119119

120120
gc0 = self._update_gc(gc0, self._gc)
121121
renderer.draw_path(gc0, tpath, affine, None)
122+
gc0.restore()
122123

123124

124125
class withStroke(Stroke):
@@ -183,6 +184,7 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
183184

184185
gc0 = self._update_gc(gc0, self._gc)
185186
renderer.draw_path(gc0, tpath, affine0, shadow_rgbFace)
187+
gc0.restore()
186188

187189

188190
class withSimplePatchShadow(SimplePatchShadow):
@@ -198,6 +200,7 @@ def draw_path(self, renderer, gc, tpath, affine, rgbFace):
198200
gc1.copy_properties(gc)
199201
gc1.set_alpha(gc1.get_alpha()*self._patch_alpha)
200202
renderer.draw_path(gc1, tpath, affine, rgbFace)
203+
gc1.restore()
201204

202205

203206
if __name__ == '__main__':

lib/matplotlib/text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ def draw(self, renderer):
590590
else:
591591
renderer.draw_tex(gc, x, y, clean_line,
592592
self._fontproperties, angle)
593+
gc.restore()
593594
renderer.close_group('text')
594595
return
595596

0 commit comments

Comments
 (0)