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 #3076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

SimonvBez
Copy link

@SimonvBez SimonvBez commented Nov 24, 2024

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

I just came across #2445 and added it to the PR description, as I suspect this PR will solve that as well.
The lack of redrawing is probably not exclusive to TabBar pages only, but applies to Shell Pages in general (since those pages will be reused, compared to stack-based navigation pages which are usually constructed and destructed on demand)

Please let me know if I need to do anything like rebasing on top of the latest main, provide more details or conduct more tests 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
1 participant