(draw)
| 21 | |
| 22 | |
| 23 | def _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 | |
| 44 | def allow_rasterization(draw): |
no outgoing calls
no test coverage detected
searching dependent graphs…