@@ -303,14 +303,14 @@ def _draw_paths():
303
303
gc_vars , rgb_fc = reuse_key
304
304
gc = copy .copy (gc0 )
305
305
# We actually need to call the setters to reset the internal state.
306
- vars (gc ).update (gc_vars )
307
306
for k , v in gc_vars .items ():
308
307
if k == "_linestyle" : # Deprecated, no effect.
309
308
continue
310
309
try :
311
310
getattr (gc , "set" + k )(v )
312
311
except (AttributeError , TypeError ) as e :
313
312
pass
313
+ vars (gc ).update (gc_vars )
314
314
gc .ctx .new_path ()
315
315
paths , transforms = zip (* grouped_draw )
316
316
grouped_draw .clear ()
@@ -327,7 +327,11 @@ def _draw_paths():
327
327
.translate (xo , yo - self .height ).scale (1 , - 1 ))
328
328
# rgb_fc could be a ndarray, for which equality is elementwise.
329
329
new_key = vars (gc0 ), tuple (rgb_fc ) if rgb_fc is not None else None
330
- if new_key == reuse_key :
330
+ # don't do grouped draw when doing alpha blending
331
+ alpha_blending = gc0 .get_forced_alpha () and gc0 .get_alpha () < 1.0
332
+ if not alpha_blending and rgb_fc is not None :
333
+ alpha_blending = len (rgb_fc ) == 4 and rgb_fc [- 1 ] < 1.0
334
+ if new_key == reuse_key and not alpha_blending :
331
335
grouped_draw .append ((path , transform ))
332
336
else :
333
337
_draw_paths ()
0 commit comments