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

[skwasm] Fix platform view occlusion logic. #54061

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eyebrowsoffire
Copy link
Contributor

The occlusion rectangle for platform views was going through this inverseMapRect code path, which actually was giving us the wrong results. The operations should just be doing the normal transformation on the rectangles to get the right result. It actually turns out we don't need the inverse mapping function, so I removed it, and I renamed the somewhat confusingly named cullRect function to mapRect which I think makes a bit more sense.

This should resolve flutter/flutter#152139

@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jul 23, 2024
Copy link
Contributor

@yjbanov yjbanov left a comment

Choose a reason for hiding this comment

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

A couple of nitpicky optimization suggestions, but LGTM.


@override
ui.Rect inverseMapRect(ui.Rect rect) => rect;
ui.Rect mapRect(ui.Rect contentRect) => (filter as SceneImageFilter).filterBounds(contentRect);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we cast it in the constructor so we don't have to cast on every usage?

final Matrix4 matrix = getMatrix()..invert();
return matrix.transformRect(rect);
}
ui.Rect mapRect(ui.Rect contentRect) => getMatrix().transformRect(contentRect);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the matrix immutable? If so, can we create the matrix in the constructor and reuse it when rendering?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-web Code specifically for the web engine
Projects
None yet
2 participants