-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Merge consecutive rasterizations #17159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Consecutive rasterized draws now merged | ||
--------------------------------------- | ||
|
||
Tracking of depth of raster draws has moved from | ||
`.backend_mixed.MixedModeRenderer.start_rasterizing` and | ||
`.backend_mixed.MixedModeRenderer.stop_rasterizing` into | ||
`.artist.allow_rasterization`. This means the start and stop functions are | ||
only called when the rasterization actually needs to be started and stopped. | ||
|
||
The output of vector backends will change in the case that rasterized | ||
elements are merged. This should not change the appearance of outputs. | ||
|
||
The renders in 3rd party backends are now expected to have | ||
``self._raster_depth`` and ``self._rasterizing`` initialized to ``0`` and | ||
``False`` respectively. |
13 changes: 13 additions & 0 deletions
13
doc/users/next_whats_new/2020-04-26-merged-rasterizations.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Consecutive rasterized draws now merged | ||
--------------------------------------- | ||
|
||
Elements of a vector output can be individually set to rasterized, using | ||
the ``rasterized`` keyword, or `~.artist.Artist.set_rasterized()`. This can | ||
be useful to reduce file sizes. For figures with multiple raster elements | ||
they are now automatically merged into a smaller number of bitmaps where | ||
this will not effect the visual output. For cases with many elements this | ||
can result in significantly smaller file sizes. | ||
|
||
To ensure this happens do not place vector elements between raster ones. | ||
|
||
To inhibit this merging set ``Figure.suppressComposite`` to True. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is ok to try and monkey-patch these attributes on if they don't exist.
It is a little bit dirty, but greatly reduces the chances we break anyone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't really work if the renderer class has no
__dict__
(given that renderer classes can easily be defined in extension modules this is not just a hypothetical).I think saying "you have to inherit from RendererBase" (or are responsible for tracking changes upstream) is the reasonable way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new requirement for those attributes is noted in the API changes. Should I add the text about inheriting from RenderBase there? or somewhere else? I would think that is it implicit that if a 3rd party replaces a class without inheriting from the original that they need to track upstream changes.
In #17159 (comment) you say that mplcairo can handle the change.