Unverified Commit 20f8941e authored by Igor Demin's avatar Igor Demin Committed by GitHub

Offscreen, Linux. Fix native crash when OpenGL isn't available (#877)

Instead, fallback to Software.

Discovered during https://github.com/JetBrains/skiko/issues/876
investigation

## Explanation

We throw RenderException, and Fallback mechanism catches it and switches
to Software

## Testing

1. Setup the system without OpenGL
2. Run SkiaSwingLayer
3. See the native crash
parent c0f01520
...@@ -15,7 +15,12 @@ internal class LinuxOpenGLSwingRedrawer( ...@@ -15,7 +15,12 @@ internal class LinuxOpenGLSwingRedrawer(
private val swingOffscreenDrawer = SwingOffscreenDrawer(swingLayerProperties) private val swingOffscreenDrawer = SwingOffscreenDrawer(swingLayerProperties)
private val offScreenContextPtr: Long = makeOffScreenContext() private val offScreenContextPtr: Long = makeOffScreenContext().also {
if (it == 0L) {
throw RenderException("Cannot create OpenGL context")
}
}
private var offScreenBufferPtr: Long = 0L private var offScreenBufferPtr: Long = 0L
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment