Skip to content

Add support for blitting in qt5cairo. #17478

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 1 commit into from
May 22, 2020
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 21, 2020

Test with e.g. examples/event_handling/poly_editor.py.

Doing the same for the other foocairo backends is left as an exercise to
the reader.

cf. #10187 (comment).

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v3.3.0 milestone May 21, 2020
Test with e.g. examples/event_handling/poly_editor.py.

Doing the same for the other foocairo backends is left as an exercise to
the reader.
@anntzer
Copy link
Contributor Author

anntzer commented May 21, 2020

edit: moved blit() to the Qt5 base class, avoiding duplication -- and now mplcairo can use it too.

Copy link
Contributor

@brunobeltran brunobeltran left a comment

Choose a reason for hiding this comment

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

LGTM (and runs correctly on my machine!)

# repaint uses logical pixels, not physical pixels like the renderer.
l, b, w, h = [pt / self._dpi_ratio for pt in bbox.bounds]
t = b + h
self.repaint(l, self.rect().height() - t, w, h)
Copy link
Member

Choose a reason for hiding this comment

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

OK, I can't find it - does qt5agg have a rect method? an is self.rect().height() equal to self.renderer.height / self._dpi_ratio?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that comes to us from qt directly: https://doc.qt.io/qt-5/qwidget.html#rect-prop.

@jklymak jklymak merged commit df67aaf into matplotlib:master May 22, 2020
@anntzer anntzer deleted the qt5cblit branch May 22, 2020 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants