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

Expose BBHFactory to record bounds in Picture #889

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

MatkovIvan
Copy link
Member

No description provided.

@MatkovIvan MatkovIvan requested a review from igordmn March 11, 2024 16:34
@m-sasha
Copy link
Contributor

m-sasha commented Mar 11, 2024

Is it doing this always now? I don't have any specific knowledge, but it could slow drawing...

See JetBrains/compose-multiplatform-core#1090 and https://issues.skia.org/issues/324465764
I considered using BBHFactory but decided against it just in case it worsens performance.

@MatkovIvan
Copy link
Member Author

Is it doing this always now?

no, it just exposes a parameter. null (as before) by default

@m-sasha
Copy link
Contributor

m-sasha commented Mar 11, 2024

I'd recommend checking whether it affects performance when there are many objects drawn, before using it for drawing arbitrary user-provided objects in Compose.

If it doesn't affect performance, we should use it instead of my hack with the large picture size.

@MatkovIvan MatkovIvan merged commit 574e3ee into master Mar 11, 2024
5 checks passed
@MatkovIvan MatkovIvan deleted the ivan.matkov/record-cullrect branch March 11, 2024 18:27
@m-sasha
Copy link
Contributor

m-sasha commented Mar 12, 2024

Had another thought - is it possible to avoid managing and passing the BBH factory in/out of the JVM? We only need it there to know when to delete it.

Maybe an API like a drawPictureWithBBH(block: (SkCanvas) -> Unit) with native code being responsible for both allocating and deleting the BBH factory?

@MatkovIvan
Copy link
Member Author

If it doesn't affect performance, we should use it instead of my hack with the large picture size.

It does, so we decided not to use it always, only when it is really needed

Maybe an API like

It can be even simpler, but we decided to keep original skia API

MatkovIvan added a commit to JetBrains/compose-multiplatform-core that referenced this pull request Mar 22, 2024
## Proposed Changes

- Use skia's BBHFactory to track real drawing bounds - requires
JetBrains/skiko#889 (skiko `0.7.98`)
- Adding additional click filtering to handle clicks on "shadow" area as
click outside

## Testing

Test: Try to use new platform layers with shadows

<img width="695" alt="image"
src="https://github.com/JetBrains/compose-multiplatform-core/assets/1836384/80dce85f-814d-4d51-ab5e-6535ed976d48">

## Issues Fixed

Fixes: JetBrains/compose-multiplatform#4460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants