SKGLView much darker than SKCanvasView

794 views Asked by At

My app's main screen is rendered via SKCanvasView. The colors accurately reflect the values I specified in code.

If I swap-in SKGLView (hardware-accelerated version), changing no other code, the result is 60% darker:

    <!--<skia:SKCanvasView PaintSurface="OnCanvasViewPaintSurface" />-->
    <skia:SKGLView PaintSurface="OnCanvasViewPaintSurface" />

Why is this happening and how do I fix it?

1

There are 1 answers

0
Matthew On BEST ANSWER

The answer can be found here: https://github.com/mono/SkiaSharp/issues/299#issuecomment-331990904

I found the solution to the problem. There is a specific attribute that is set in the splash screen style, but is not unset (for some reason) when the style is changed.

In the splashscreen style, note this:

<item name="android:backgroundDimEnabled">true</item>

Docs: https://developer.xamarin.com/api/field/Android.Resource+Attribute.BackgroundDimEnabled

This is not unset when the style is switched. So, to fix this, just set it to false:

<item name="android:backgroundDimEnabled">false</item>

Here is a repository that demonstrates this: https://github.com/mattleibow/AndroidGLSurfaceViewTests