@@ -82,8 +82,10 @@ def _convert_path(ctx, path, transform, clip=None):
82
82
83
83
84
84
def _convert_paths (ctx , paths , transforms , clip = None ):
85
- return (_convert_paths_fast if HAS_CAIRO_CFFI else _convert_paths_slow )(
86
- ctx , paths , transforms , clip )
85
+ if HAS_CAIRO_CFFI :
86
+ return _convert_paths_fast (ctx , paths , transforms , clip )
87
+ else :
88
+ return _convert_paths_slow (ctx , paths , transforms , clip )
87
89
88
90
89
91
def _convert_paths_slow (ctx , paths , transforms , clip = None ):
@@ -106,7 +108,7 @@ def _convert_paths_slow(ctx, paths, transforms, clip=None):
106
108
107
109
def _convert_paths_fast (ctx , paths , transforms , clip = None ):
108
110
# We directly convert to the internal representation used by cairo, for
109
- # which ABI compatibility is guaranteed. The layout is for each item is
111
+ # which ABI compatibility is guaranteed. The layout for each item is
110
112
# --CODE(4)-- -LENGTH(4)- ---------PAD(8)---------
111
113
# ----------X(8)---------- ----------Y(8)----------
112
114
# with the size in bytes in parentheses, and (X, Y) repeated as many times
@@ -230,8 +232,7 @@ def draw_markers(self, gc, marker_path, marker_trans, path, transform,
230
232
231
233
ctx .new_path ()
232
234
# Create the path for the marker; it needs to be flipped here already!
233
- _convert_path (
234
- ctx , marker_path , marker_trans + Affine2D ().scale (1 , - 1 ))
235
+ _convert_path (ctx , marker_path , marker_trans + Affine2D ().scale (1 , - 1 ))
235
236
marker_path = ctx .copy_path_flat ()
236
237
237
238
# Figure out whether the path has a fill
@@ -295,7 +296,7 @@ def _draw_paths():
295
296
for k , v in gc_vars .items ():
296
297
try :
297
298
getattr (gc , "set" + k )(v )
298
- except (AttributeError , TypeError ):
299
+ except (AttributeError , TypeError ) as e :
299
300
pass
300
301
gc .ctx .new_path ()
301
302
paths , transforms = zip (* grouped_draw )
@@ -309,8 +310,8 @@ def _draw_paths():
309
310
offsetTrans , facecolors , edgecolors , linewidths , linestyles ,
310
311
antialiaseds , urls , offset_position ):
311
312
path , transform = path_id
312
- transform = (Affine2D (transform .get_matrix ()). translate ( xo , yo )
313
- + Affine2D (). scale ( 1 , - 1 ). translate ( 0 , self . height ))
313
+ transform = (Affine2D (transform .get_matrix ())
314
+ . translate ( xo , yo - self . height ). scale ( 1 , - 1 ))
314
315
# rgb_fc could be a ndarray, for which equality is elementwise.
315
316
new_key = vars (gc0 ), tuple (rgb_fc ) if rgb_fc is not None else None
316
317
if new_key == reuse_key :
0 commit comments