Skip to content
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

Use a large rectangle for the picture bounds in RenderNodeLayer.drawLayer to prevent clipping #1090

Merged
merged 2 commits into from Feb 9, 2024

Conversation

m-sasha
Copy link

@m-sasha m-sasha commented Feb 9, 2024

PictureRecorder.beginRecording explicitly states that:

bounds the cull rect used when recording this picture. Any drawing the falls outside
of this rect is undefined, and may be drawn or it may not.

It happens that on the desktop it is drawn, but then drawPicture legitimately assumes that it can ignore anything outside these bounds, so if the bounds of the picture don't intersect with the bounds of the canvas, nothing is drawn.

Proposed Changes

Pass a large rectange to PictureRecorder.beginRecording. Note that it can't be too large due to a float overflow in Skia. I decided that ±2^30 is large enough for the XY plane, and leaves plenty of range for the scale "axis".

Testing

Test: Tested manually all the scenarios reported in the various relevant tickets. Added two unit tests.

Issues Fixed

Fixes:
JetBrains/compose-multiplatform#2807
JetBrains/compose-multiplatform#3904
JetBrains/compose-multiplatform#1559
JetBrains/compose-multiplatform#2198

@m-sasha m-sasha requested a review from igordmn February 9, 2024 10:05
@m-sasha m-sasha merged commit af0ecd4 into jb-main Feb 9, 2024
6 checks passed
@m-sasha m-sasha deleted the m-sasha/prevent-clipping-in-drawLayer branch February 9, 2024 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants