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

[1.7.0-alpha01] GraphicsLayer do not seems to like being drawn multiple times #5066

Open
chrisbanes opened this issue Jul 4, 2024 · 2 comments
Assignees
Labels
bug Something isn't working p:high High priority rendering Low level rendering reproduced

Comments

@chrisbanes
Copy link

Describe the bug
This morning I've be updating my Haze library to CMP 1.7.0-alpha01, which gives us access to the new GraphicsLayer APIs. My Android implementation already used RenderNode (which is basically the same), so I've moved that impl over to commonMain and now have a single implementation for all platforms.

It works as expected on Android, but on Skiko backed platforms it seems to have issues when you have multiple child layers drawing another layer. The first child layer is drawn fine, but others are not

I've also seen issues when a layer's position is outside the window bounds, the layer just doesn't draw anything.

Haze is a bit of a stress test for the graphics layers integration, so it might be worth investigating. The sample app is an easy way to see play around. chrisbanes/haze#250

Affected platforms
Skiko-backed platforms (JVM, iOS, etc)

Versions

  • Libraries:
    • Compose Multiplatform version: 1.7.0-alpha01
  • Kotlin version: 2.0/0
@chrisbanes chrisbanes added bug Something isn't working submitted labels Jul 4, 2024
@igordmn igordmn added rendering Low level rendering p:high High priority reproduced and removed submitted labels Jul 4, 2024
@chrisbanes
Copy link
Author

chrisbanes commented Jul 5, 2024

Went a bit deeper into this today.

The way Haze works is by drawing the main content into a graphics layer (and keeping that around), and then creating more graphics layers for each blurred area (which have the main content drawn into them). This works fine on Android, but on the Skiko platforms the layer stops drawing at certain positions. You can see the issue in the videos below.

Screen.Recording.2024-07-05.at.15.46.36.mov
Screen.Recording.2024-07-05.at.16.28.13.mov

@chrisbanes
Copy link
Author

chrisbanes commented Jul 5, 2024

Ok, I've worked out the trigger for this.

My current code updates the layer's topLeft property, to tell it where to draw. If I stop setting the topLeft, and instead use GraphicsLayer.translationX/Y (or a Canvas translate when drawing the graphics layer) it works fine.

My guess is that somewhere in PictureRecorder (or below) is coercing or rejecting the bounds if they become too far out of the size?

My workaround commit: chrisbanes/haze@9c0bf63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p:high High priority rendering Low level rendering reproduced
Projects
None yet
Development

No branches or pull requests

3 participants