Fix reset_transform in Cocoa/iOS#4045
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
This and the |
|
Interesting. Apparently while Cocoa uses a standard identity matrix when rendering to the screen and a different one for rendering to a cache, iOS never uses identity. I guess they handle flipping differently, somewhere along the way. |
| if not context.using_standard_coords: | ||
| context.inverse_original = core_graphics.CGAffineTransformInvert( | ||
| context.original_matrix | ||
| ) |
There was a problem hiding this comment.
I understand why we need to store these reference matrices - but do we ned to re-create them on every call to draw the widget? Won't they be the same on every usage?
There was a problem hiding this comment.
At least on Cocoa, they'll be different if the call is to draw it to the screen, or to draw it to the buffer for as_image(). But that's a good point, we could just store each of those separately, as cached properties. And I think on iOS it's always the same — at least I know it's never the actual identity matrix. If I can figure out why Briefcase won't run iOS for me lately, I can go back in and double-check that.
There was a problem hiding this comment.
Having refamiliarized myself with this a bit more: the original matrix (and its inverse) are dependent on the canvas's height. Granted, it should still be the same from draw to draw as long as the widget isn't resized, but we'd need to make sure to update it on resize. However, I've put the inverse inside a cached property, so it's only called if and when reset_transform is actually called (and still only once per draw).
|
(The test failure is from the Ubuntu domains being down again.) |
freakboy3742
left a comment
There was a problem hiding this comment.
I think this all makes sense - thanks for getting to the bottom of all this.
Fixes #4044
Adding the test first...
So far I have a fix that seems to work for Cocoa, but breaks iOS in new and interesting ways.
PR Checklist: