-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Make RendererCairo auto-infer surface size. #22004
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
Conversation
This avoids a redundant set_width_height on the caller side, and prevents the width/height from getting out of sync from the actual surface size.
It seems like all the cases you've changed had the size available, and the |
Mostly, this was motivated by the hidpi changes in gtk3/4agg, where having to fiddle with the dpi scale seems a bit inelegant, when the info is in fact already carried by the context. |
Milestoning as 3.6, as this modifies the semantics of an API introduced in #21981 for 3.6. |
@oscargus is there a reason you approved but did not merge? Our policy is that PRs need two positive reviews. With giving you review permissions we also trust you to push the merge button if the two approvals are there. |
I may not recall exactly, but I believe that it wasn't clear to me if the query from @QuLogic was settled or not. With the assumption that two approvals may not override a concern. |
That's a valid point. In that case I suggest to explicitly mention the open issue, so that it's clear what is still missing for the merge, e.g.
or
|
Fair enough. I try that now then: @QuLogic are you OK with merging? (Reading the code again, it may make sense to factor out a method, |
Marking as RC as this modifies a new API for mpl3.6 (so it's better to do this with no intervening deprecation), and there's at least one user that would benefit from this at https://discourse.matplotlib.org/t/draw-plot-into-existing-cairo-context/22687. |
ping @QuLogic again - this is waiting for your OK.... |
With GTK3, the Cairo surface we get is for the whole window, which means the automatic size inference from matplotlib#22004 gets the wrong size. For the GtkDrawingArea, the Cairo context is aligned and clipped to the widget, so nothing goes out-of-bounds. However, since the Cairo renderer flips the origin using the height in the calculation (which is, for the window, bigger than the drawing widget), everything is drawn lower than it should.
This avoids a redundant set_width_height on the caller side, and
prevents the width/height from getting out of sync from the actual
surface size.
Followup to #21981, which conveniently introduces a new API whose
semantics we can still modify :)
PR Summary
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).