@@ -82,8 +82,10 @@ def _convert_path(ctx, path, transform, clip=None):
8282
8383
8484def _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 )
8789
8890
8991def _convert_paths_slow (ctx , paths , transforms , clip = None ):
@@ -106,7 +108,7 @@ def _convert_paths_slow(ctx, paths, transforms, clip=None):
106108
107109def _convert_paths_fast (ctx , paths , transforms , clip = None ):
108110 # 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
110112 # --CODE(4)-- -LENGTH(4)- ---------PAD(8)---------
111113 # ----------X(8)---------- ----------Y(8)----------
112114 # 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,
230232
231233 ctx .new_path ()
232234 # 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 ))
235236 marker_path = ctx .copy_path_flat ()
236237
237238 # Figure out whether the path has a fill
@@ -295,7 +296,7 @@ def _draw_paths():
295296 for k , v in gc_vars .items ():
296297 try :
297298 getattr (gc , "set" + k )(v )
298- except (AttributeError , TypeError ):
299+ except (AttributeError , TypeError ) as e :
299300 pass
300301 gc .ctx .new_path ()
301302 paths , transforms = zip (* grouped_draw )
@@ -309,8 +310,8 @@ def _draw_paths():
309310 offsetTrans , facecolors , edgecolors , linewidths , linestyles ,
310311 antialiaseds , urls , offset_position ):
311312 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 ))
314315 # rgb_fc could be a ndarray, for which equality is elementwise.
315316 new_key = vars (gc0 ), tuple (rgb_fc ) if rgb_fc is not None else None
316317 if new_key == reuse_key :
0 commit comments