MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _prevent_rasterization

Function _prevent_rasterization

lib/matplotlib/artist.py:23–41  ·  view source on GitHub ↗
(draw)

Source from the content-addressed store, hash-verified

21
22
23def _prevent_rasterization(draw):
24 # We assume that by default artists are not allowed to rasterize (unless
25 # its draw method is explicitly decorated). If it is being drawn after a
26 # rasterized artist and it has reached a raster_depth of 0, we stop
27 # rasterization so that it does not affect the behavior of normal artist
28 # (e.g., change in dpi).
29
30 @wraps(draw)
31 def draw_wrapper(artist, renderer, *args, **kwargs):
32 if renderer._raster_depth == 0 and renderer._rasterizing:
33 # Only stop when we are not in a rasterized parent
34 # and something has been rasterized since last stop.
35 renderer.stop_rasterizing()
36 renderer._rasterizing = False
37
38 return draw(artist, renderer, *args, **kwargs)
39
40 draw_wrapper._supports_rasterization = False
41 return draw_wrapper
42
43
44def allow_rasterization(draw):

Callers 1

__init_subclass__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…