Skip to content

Releases: JetBrains/skiko

Version 0.8.10.1

05 Aug 10:37
Compare
Choose a tag to compare
v0.8.10.1

update to skia m126

Version 0.8.10

10 Jul 09:00
c4db278
Compare
Choose a tag to compare
Add Windows Jump Lists support in AWT (#943)

This PR adds Windows Jump Lists support to AWT and fixes compilation on
Visual Studio 2022.

Version 0.8.9

19 Jun 12:49
45c1a7d
Compare
Choose a tag to compare
Add API to configure the fallback fonts provider when all default met…

…hods return null  (#935)

New API:

```kotlin
fun TypefaceFontProvider.createAsFallbackProvider(): TypefaceFontProvider
fun FontMgr.defaultWithFallbackFontProvider(fallback: TypefaceFontProvider): FontMgr
```

Usage:

```kotlin
val fontCollection = FontCollection()

val notoEmojiTypeface = Typeface.makeFromData(Data.makeFromBytes(notoEmojisBytes))
val fallbackProvider = TypefaceFontProvider.createAsFallbackProvider().apply {
    registerTypeface(notoEmojiTypeface)
}

fontCollection.setDefaultFontManager(FontMgr.defaultWithFallbackFontProvider(fallbackProvider))
```

<img width="400" alt="Screenshot 2024-06-07 at 14 48 28"
src="https://github.com/JetBrains/skiko/assets/7372778/76dc1330-d8e2-4be7-ad92-68214b058b4f">

Version 0.8.8

14 Jun 09:03
a03d0a5
Compare
Choose a tag to compare
Allow paint before showing (#941)

Fix compose tests after #923

Version 0.8.7

12 Jun 13:24
3e41541
Compare
Choose a tag to compare
v0.8.7

Make getAccessibleContext return nullable AccessibleContext (#940)

Version 0.8.6

12 Jun 10:04
5ed970f
Compare
Choose a tag to compare
v0.8.6

Expose SkiaLayerProperties (#938)

Version 0.8.5

30 May 02:46
c66eebc
Compare
Choose a tag to compare
Redraw immediately on panel size change (#923)

Fixes a couple of issues like:
https://github.com/JetBrains/compose-multiplatform/issues/4744 (TODO:
collect all references)

Before (slow-mo)


https://github.com/JetBrains/skiko/assets/1836384/5768b139-d08f-4142-8c14-2969107807f9



After (slow-mo)


https://github.com/JetBrains/skiko/assets/1836384/cc9a5103-3d30-412e-a5a4-baf590d657b8

Version 0.8.4

26 Apr 10:10
57dea50
Compare
Choose a tag to compare
Fix crash when creating SwingRedrawer on DirectX (#917)

### Changes
Throw `RenderException` when constructing `Direct3DSwingRedrawer` with
`nullptr` device. (Similar to `Direct3DRedrawer`)

To avoid crash in:
```
DirectXOffscreenDevice *d3dDevice = fromJavaPointer<DirectXOffscreenDevice *>(devicePtr);
GrD3DBackendContext backendContext = d3dDevice->backendContext;
return toJavaPointer(GrDirectContext::MakeDirect3D(backendContext).release());
```

### Fixes

Speculative fix for crash with a stack head below:
```
---------------  T H R E A D  ---------------

Current thread (0x000001cbcb0793f0):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=16744, stack(0x0000009488c00000,0x0000009488d00000)]

Stack: [0x0000009488c00000,0x0000009488d00000],  sp=0x0000009488cfc670,  free space=1009k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [skiko-windows-x64.dll+0x58afa]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.jetbrains.skiko.swing.Direct3DSwingRedrawer.makeDirectXContext(J)J+0
```

### Note
I've found suspicious place in
```kotlin
// RedrawManager.kt:30
_renderApi = fallbackRenderApiQueue.removeAt(0)
_redrawer = redrawerFactory(_renderApi, redrawer)
```
Seems like `redrawer` is disposed twice if `redrawerFactory` throws
(both paths constructing `RedrawerManager` are affected).

@igordmn can you have a look?
It's a universal path for all desktop users, so I wonder why it didn't
backfire, if it's indeed incorrect.
May be it's because we don't really call `redrawerFactory` if a redrawer
was constructed correctly, so disposal of old one doesn't ever get
called in this context. I'm not sure where are the invariant boundaries
here.

Version 0.8.3

25 Apr 11:23
37ef84b
Compare
Choose a tag to compare
Option to not throw RenderException when use OpenGL on macOS (#915)

To allow using OpenGL on macOs, call:
```
System.setProperty("skiko.macos.opengl.enabled", "true")
```

By request from user in DM who uses LWJGL+Skiko on macOS.

Version 0.8.1

16 Apr 11:54
7a6f62b
Compare
Choose a tag to compare
Windows. Fix a crash on CI without `dcomp.dll` (#909)

## Issues fixed

Some CI don't have this library and when we run an application we have a
crash:
```
...\skiko-windows-x64.dll: Can't find dependent libraries
java.lang.UnsatisfiedLinkError: ...\skiko-windows-x64.dll: Can't find dependent libraries
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)
	at java.base/java.lang.Runtime.load0(Runtime.java:755)
	at java.base/java.lang.System.load(System.java:1957)
	at org.jetbrains.skiko.Library.loadLibraryOrCopy(Library.kt:17)
	at org.jetbrains.skiko.Library.findAndLoad(Library.kt:111)
	at org.jetbrains.skiko.Library.load(Library.kt:56)
	at org.jetbrains.skia.impl.Library$Companion.staticLoad(Library.jvm.kt:12)
	at org.jetbrains.skia.Surface.<clinit>(Surface.kt:539)
	at androidx.compose.ui.test.SkikoComposeUiTest.<init>(ComposeUiTest.skikoMain.kt:172)
	at androidx.compose.ui.test.SkikoComposeUiTest.<init>(ComposeUiTest.skikoMain.kt:118)
	at androidx.compose.ui.test.SkikoComposeUiTest.<init>(ComposeUiTest.skikoMain.kt:139)
	at androidx.compose.ui.test.SkikoComposeUiTest.<init>(ComposeUiTest.skikoMain.kt:134)
	at androidx.compose.ui.test.junit4.DesktopComposeTestRule.<init>(DesktopComposeTestRule.desktop.kt:54)
	at androidx.compose.ui.test.junit4.DesktopComposeTestRule_desktopKt.createComposeRule(DesktopComposeTestRule.desktop.kt:41)
```

Reported in
https://jetbrains.slack.com/archives/C5VQN94SH/p1712564847131459?thread_ts=1712091431.760099&cid=C5VQN94SH

## Proposed changes
Load this library in runtime, and fallback to
`CreateSwapChainForComposition`

## Testing
1. Run Compose with transparent window:
```
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Surface
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.shadow
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import androidx.compose.material.Text
import androidx.compose.runtime.*

fun main() = application {
    var isOpen by remember { mutableStateOf(true) }
    if (isOpen) {
        Window(
            onCloseRequest = { isOpen = false },
            title = "Transparent Window Example",
            transparent = true,
            undecorated = true, //transparent window must be undecorated
        ) {
            Surface(
                modifier = Modifier.fillMaxSize().padding(5.dp).shadow(3.dp, RoundedCornerShape(20.dp)),
                color = Color(55, 55, 55),
                shape = RoundedCornerShape(20.dp) //window has round corners now
            ) {
                Text("Hello World!", color = Color.White)
            }
        }
    }
}
```
Transparency should work, there shouldn't be errors in the log.

2. change `transparent = false`

Transparency shouldn't work, there shouldn't be errors in the log.

This should be tested by QA.

---------

Co-authored-by: Ivan Matkov <ivan.matkov@jetbrains.com>