Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
875ff2dd
Commit
875ff2dd
authored
Nov 23, 2020
by
Nikolay Igotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make proper lazy loading.
parent
3a01ba64
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
33 deletions
+17
-33
.gitignore
.gitignore
+1
-2
SwingSkia.kt
...jectSample/src/main/kotlin/SkijaInjectSample/SwingSkia.kt
+0
-2
gradle.properties
skiko/gradle.properties
+1
-1
CustomLoader.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skija/CustomLoader.kt
+7
-0
Library.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
+8
-3
Main.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Main.kt
+0
-19
SkiaWindow.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkiaWindow.kt
+0
-6
No files found.
.gitignore
View file @
875ff2dd
skija
build
build
.gradle
.gradle
local.properties
local.properties
...
...
samples/SkijaInjectSample/src/main/kotlin/SkijaInjectSample/SwingSkia.kt
View file @
875ff2dd
...
@@ -9,7 +9,6 @@ import javax.swing.JFrame
...
@@ -9,7 +9,6 @@ import javax.swing.JFrame
import
javax.swing.JButton
import
javax.swing.JButton
import
javax.swing.event.MouseInputAdapter
import
javax.swing.event.MouseInputAdapter
import
javax.swing.WindowConstants
import
javax.swing.WindowConstants
import
org.jetbrains.skiko.Library
import
org.jetbrains.skiko.SkiaLayer
import
org.jetbrains.skiko.SkiaLayer
fun
Button
(
text
:
String
):
JButton
{
fun
Button
(
text
:
String
):
JButton
{
...
@@ -19,7 +18,6 @@ fun Button(text: String): JButton {
...
@@ -19,7 +18,6 @@ fun Button(text: String): JButton {
}
}
fun
SwingSkia
()
{
fun
SwingSkia
()
{
Library
.
load
(
"/"
,
"skiko"
)
val
window
=
JFrame
()
val
window
=
JFrame
()
window
.
defaultCloseOperation
=
WindowConstants
.
EXIT_ON_CLOSE
window
.
defaultCloseOperation
=
WindowConstants
.
EXIT_ON_CLOSE
...
...
skiko/gradle.properties
View file @
875ff2dd
kotlin.code.style
=
official
kotlin.code.style
=
official
deploy.version
=
0.1
deploy.version
=
0.1
dependencies.skija.git.commit
=
8fc45764727610bd4b3d228198432f6f327a34ad
dependencies.skija.git.commit
=
6652e622a76604278c0156dc8acf40b66b05c0e9
dependencies.skia.windows-x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-windows-Release-x64
dependencies.skia.windows-x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-windows-Release-x64
dependencies.skia.linux-x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-linux-Release-x64
dependencies.skia.linux-x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-linux-Release-x64
dependencies.skia.macos-x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-macos-Release-x64
dependencies.skia.macos-x64
=
m88-59bafeeaa7/Skia-m88-59bafeeaa7-macos-Release-x64
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skija/CustomLoader.kt
0 → 100644
View file @
875ff2dd
package
org.jetbrains.skija
class
CustomLoader
:
Runnable
{
override
fun
run
()
{
org
.
jetbrains
.
skiko
.
Library
.
run
()
}
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
View file @
875ff2dd
...
@@ -7,7 +7,7 @@ import java.nio.file.Files
...
@@ -7,7 +7,7 @@ import java.nio.file.Files
import
java.nio.file.StandardCopyOption
import
java.nio.file.StandardCopyOption
import
javax.swing.UIManager
import
javax.swing.UIManager
object
Library
{
object
Library
:
Runnable
{
private
var
loaded
=
false
private
var
loaded
=
false
private
val
cacheRoot
=
"${System.getProperty("
user
.
home
")}/.skiko/"
private
val
cacheRoot
=
"${System.getProperty("
user
.
home
")}/.skiko/"
...
@@ -31,10 +31,11 @@ object Library {
...
@@ -31,10 +31,11 @@ object Library {
// in Skiko's home, and if not - unpacks it. Also, it could load additional
// in Skiko's home, and if not - unpacks it. Also, it could load additional
// localization resource on platforms wher it is needed.
// localization resource on platforms wher it is needed.
@Synchronized
@Synchronized
fun
load
(
resourcePath
:
String
=
"/"
,
name
:
String
=
"skiko"
)
{
private
fun
load
()
{
// TODO: remove arguments.
if
(
loaded
)
return
if
(
loaded
)
return
val
resourcePath
=
"/"
val
name
=
"skiko"
val
platformName
=
System
.
mapLibraryName
(
name
)
val
platformName
=
System
.
mapLibraryName
(
name
)
val
hash
=
Library
::
class
.
java
.
getResourceAsStream
(
"$resourcePath$platformName.sha256"
).
use
{
val
hash
=
Library
::
class
.
java
.
getResourceAsStream
(
"$resourcePath$platformName.sha256"
).
use
{
...
@@ -73,4 +74,8 @@ object Library {
...
@@ -73,4 +74,8 @@ object Library {
// Not all platforms allow this.
// Not all platforms allow this.
}
}
}
}
override
fun
run
()
{
load
()
}
}
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Main.kt
deleted
100644 → 0
View file @
3a01ba64
package
org.jetbrains.skiko
import
org.jetbrains.skija.Surface
fun
main
()
{
println
(
SkiaLibraryTester
().
nativeMethod
(
41
))
val
surface
=
Surface
.
makeRasterN32Premul
(
100
,
100
)
println
(
surface
)
}
private
class
SkiaLibraryTester
{
companion
object
{
init
{
Library
.
load
()
}
}
external
fun
nativeMethod
(
param
:
Long
):
Long
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkiaWindow.kt
View file @
875ff2dd
...
@@ -123,12 +123,6 @@ open class SkiaLayer() : HardwareLayer() {
...
@@ -123,12 +123,6 @@ open class SkiaLayer() : HardwareLayer() {
}
}
open
class
SkiaWindow
:
JFrame
()
{
open
class
SkiaWindow
:
JFrame
()
{
companion
object
{
init
{
Library
.
load
()
}
}
val
layer
:
SkiaLayer
=
SkiaLayer
()
val
layer
:
SkiaLayer
=
SkiaLayer
()
init
{
init
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment