Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Simplify webagg blitting.#23182

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
oscargus merged 1 commit intomatplotlib:mainfromanntzer:webagg_blit
Jun 3, 2022
Merged

Conversation

anntzer
Copy link
Contributor

  • Directly reuse FigureCanvasAgg.get_renderer. We don't need to init
    _last_buff there as we can just use buff.copy() in get_diff_image()
    (If we really care about reusing the same array whenever possible, we
    could add a shape check before the removed copyto() and reuse the old
    array if the shapes match, but I doubt it matters.) Instead, init it
    once to a non-valid shape in the constructor.

    Note that the comments in the function were outdated since78c182d.

  • First creatingpixels and then viewing it asbuff is slighly
    simpler than doing it the other way round.

The animation example in#19059 works for me.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

Copy link
Contributor

@ianhiianhi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

nice! much simpler


if self._force_full or np.any(pixels[:, :, 3] != 255):
if (self._force_full
or buff.shape != self._last_buff.shape
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

may be nice to add a comment as well about this line. It took me a while to hunt down why it was ok to compare the initialnp.empty((0,0)) with the buffer and this line is the escape


if self._force_full or np.any(pixels[:, :, 3] != 255):
if (self._force_full
or buff.shape != self._last_buff.shape
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
orbuff.shape!=self._last_buff.shape
# If the buffer has changed size we need to do a full draw
orbuff.shape!=self._last_buff.shape

- Directly reuse FigureCanvasAgg.get_renderer.  We don't need to init  _last_buff there as we can just use buff.copy() in get_diff_image()  (If we really care about reusing the same array whenever possible, we  could add a shape check before the removed copyto() and reuse the old  array if the shapes match, but I doubt it matters.)  Instead, init it  once to a non-valid shape in the constructor.  Note that the comments in the function were outdated since78c182d.- First creating `pixels` and then viewing it as `buff` is slighly  simpler than doing it the other way round.
@anntzer
Copy link
ContributorAuthor

Added comment as requested.

@oscargusoscargus merged commit8ab732d intomatplotlib:mainJun 3, 2022
@anntzeranntzer deleted the webagg_blit branchJune 3, 2022 09:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@oscargusoscargusoscargus approved these changes

@ianhiianhiianhi approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.6.0
Development

Successfully merging this pull request may close these issues.

4 participants
@anntzer@tacaswell@oscargus@ianhi

[8]ページ先頭

©2009-2025 Movatter.jp