@@ -133,8 +133,8 @@ def _fill_and_stroke (self, ctx, fill_c, alpha, alpha_overrides):
133
133
ctx .stroke ()
134
134
135
135
@staticmethod
136
- def convert_path (ctx , path , transform ):
137
- for points , code in path .iter_segments (transform ):
136
+ def convert_path (ctx , path , transform , clip = None ):
137
+ for points , code in path .iter_segments (transform , clip = clip ):
138
138
if code == Path .MOVETO :
139
139
ctx .move_to (* points )
140
140
elif code == Path .CLOSEPOLY :
@@ -152,11 +152,18 @@ def convert_path(ctx, path, transform):
152
152
def draw_path (self , gc , path , transform , rgbFace = None ):
153
153
ctx = gc .ctx
154
154
155
+ # We'll clip the path to the actual rendering extents
156
+ # if the path isn't filled.
157
+ if rgbFace is None and gc .get_hatch () is None :
158
+ clip = ctx .clip_extents ()
159
+ else :
160
+ clip = None
161
+
155
162
transform = transform + \
156
163
Affine2D ().scale (1.0 , - 1.0 ).translate (0 , self .height )
157
164
158
165
ctx .new_path ()
159
- self .convert_path (ctx , path , transform )
166
+ self .convert_path (ctx , path , transform , clip )
160
167
161
168
self ._fill_and_stroke (ctx , rgbFace , gc .get_alpha (), gc .get_forced_alpha ())
162
169
0 commit comments