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

Fixed SKGLView on Android not being rendered when using a TabBar #3075

Closed
wants to merge 1 commit into from

Conversation

SimonvBez
Copy link

Description of Change

Currently an SKGLView on Android will not render when it appears for a second time, such as when the SKGLView is placed on a MAUI Tab Page in a TabBar. The first time the Tab with the SKGLView is displayed it correctly renders, however when switching to a different Tab and then coming back, the SKGLView will not render anymore.

This PR solves this issue by constructing the internal GLThread with the current size of the View, instead of relying on Android to call GLTextureView.OnLayoutChange(). If the size of the View has not been set yet by Android (which happens when the SKGLView is displayed for the first time), the GLTextureView's Width and Height are both 0, just as the default of the GLThread used to be, so it is safe to use these values when constructing the GLThread.

Bugs Fixed

API Changes

No public API changes.

Private API Change:

  • SkiaSharp.Views.Android.GLTextureView.GLThread(WeakReference<GLTextureView> glTextureViewWeakRef) => GLThread(WeakReference<GLTextureView> glTextureViewWeakRef, int initialWidth, int initialHeight)

Behavioral Changes

None.

Required skia PR

None.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

@SimonvBez
Copy link
Author

@dotnet-policy-service agree

@SimonvBez SimonvBez changed the title Fixed SKGLView on Android not being rendered when using a TabBar (#2550) Fixed SKGLView on Android not being rendered when using a TabBar Nov 24, 2024
@SimonvBez
Copy link
Author

SimonvBez commented Nov 24, 2024

I accidentally pushed this to my main branch instead of a new branch. I'm closing this PR and making a new one just in case this may be annoying: #3076

@SimonvBez SimonvBez closed this Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] SKGLView doesn't repaint if it's in a TabBar MAUI with multiple pages only work first time
1 participant