Browse Source
Merge pull request #9379 from tristanlabelle/fixes/9230-gray-screen
Android: Force punch a hole in the SurfaceView to workaround issue #9230
pull/9395/head
Dan Walmsley
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
22 additions and
0 deletions
-
src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
|
|
|
@ -165,6 +165,28 @@ namespace Avalonia.Android.Platform.SkiaPlatform |
|
|
|
_tl.Draw(); |
|
|
|
} |
|
|
|
|
|
|
|
protected override void DispatchDraw(global::Android.Graphics.Canvas canvas) |
|
|
|
{ |
|
|
|
// Workaround issue #9230 on where screen remains gray after splash screen.
|
|
|
|
// base.DispatchDraw should punch a hole into the canvas so the surface
|
|
|
|
// can be seen below, but it does not.
|
|
|
|
if (OperatingSystem.IsAndroidVersionAtLeast(29)) |
|
|
|
{ |
|
|
|
// Android 10+ does this (BlendMode was new)
|
|
|
|
var paint = new Paint(); |
|
|
|
paint.SetColor(0); |
|
|
|
paint.BlendMode = BlendMode.Clear; |
|
|
|
canvas.DrawRect(0, 0, Width, Height, paint); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
// Android 9 did this
|
|
|
|
canvas.DrawColor(Color.Transparent, PorterDuff.Mode.Clear); |
|
|
|
} |
|
|
|
|
|
|
|
base.DispatchDraw(canvas); |
|
|
|
} |
|
|
|
|
|
|
|
protected override bool DispatchGenericPointerEvent(MotionEvent e) |
|
|
|
{ |
|
|
|
bool callBase; |
|
|
|
|