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
8e84e9e0
Unverified
Commit
8e84e9e0
authored
Feb 07, 2022
by
Nikolay Igotti
Committed by
GitHub
Feb 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate docs (#480)
parent
9a95f214
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
165 additions
and
93 deletions
+165
-93
ci.yml
.github/workflows/ci.yml
+3
-2
docs.yml
.github/workflows/docs.yml
+33
-0
build.gradle.kts
skiko/build.gradle.kts
+1
-0
SkiaLayer.awt.kt
...o/src/awtMain/kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt
+7
-1
AnimationDisposalMethod.kt
...Main/kotlin/org/jetbrains/skia/AnimationDisposalMethod.kt
+4
-1
AnimationDisposalMode.kt
...onMain/kotlin/org/jetbrains/skia/AnimationDisposalMode.kt
+4
-1
ColorInfo.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/ColorInfo.kt
+4
-4
Data.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Data.kt
+2
-2
EncodedOrigin.kt
...src/commonMain/kotlin/org/jetbrains/skia/EncodedOrigin.kt
+4
-1
Expects.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Expects.kt
+4
-4
Font.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Font.kt
+1
-1
ImageFilter.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/ImageFilter.kt
+1
-1
Paint.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Paint.kt
+1
-1
Path.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Path.kt
+1
-1
StdVectorDecoder.kt
.../commonMain/kotlin/org/jetbrains/skia/StdVectorDecoder.kt
+1
-1
Typeface.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Typeface.kt
+1
-1
Library.kt
.../src/commonMain/kotlin/org/jetbrains/skia/impl/Library.kt
+3
-0
Managed.kt
.../src/commonMain/kotlin/org/jetbrains/skia/impl/Managed.kt
+13
-0
Native.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/impl/Native.kt
+20
-24
RefCnt.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/impl/RefCnt.kt
+7
-1
Stats.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Stats.kt
+3
-0
LineMetrics.kt
...onMain/kotlin/org/jetbrains/skia/paragraph/LineMetrics.kt
+1
-1
ParagraphStyle.kt
...ain/kotlin/org/jetbrains/skia/paragraph/ParagraphStyle.kt
+1
-1
Shadow.kt
.../commonMain/kotlin/org/jetbrains/skia/paragraph/Shadow.kt
+1
-1
StrutStyle.kt
...monMain/kotlin/org/jetbrains/skia/paragraph/StrutStyle.kt
+1
-1
TextStyle.kt
...mmonMain/kotlin/org/jetbrains/skia/paragraph/TextStyle.kt
+1
-1
SVGLength.kt
...src/commonMain/kotlin/org/jetbrains/skia/svg/SVGLength.kt
+1
-1
ClipRectangle.kt
...rc/commonMain/kotlin/org/jetbrains/skiko/ClipRectangle.kt
+3
-0
TestUtils.kt
.../commonTest/kotlin/org/jetbrains/skiko/tests/TestUtils.kt
+1
-1
Actuals.js.kt
skiko/src/jsMain/kotlin/org/jetbrains/skia/Actuals.js.kt
+1
-1
Managed.js.kt
...o/src/jsMain/kotlin/org/jetbrains/skia/impl/Managed.js.kt
+1
-1
Native.js.kt
skiko/src/jsMain/kotlin/org/jetbrains/skia/impl/Native.js.kt
+6
-8
RefCnt.js.kt
skiko/src/jsMain/kotlin/org/jetbrains/skia/impl/RefCnt.js.kt
+1
-1
TestUtils.js.kt
skiko/src/jsTest/kotlin/TestUtils.js.kt
+2
-2
Actuals.jvm.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Actuals.jvm.kt
+3
-3
Native.jvm.kt
.../src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.jvm.kt
+7
-7
RefCnt.jvm.kt
.../src/jvmMain/kotlin/org/jetbrains/skia/impl/RefCnt.jvm.kt
+1
-1
TestUtils.jvm.kt
skiko/src/jvmTest/kotlin/TestUtils.jvm.kt
+1
-1
Shaper.nativejs.kt
...sMain/kotlin/org/jetbrains/skia/shaper/Shaper.nativejs.kt
+1
-1
Actuals.native.kt
...rc/nativeMain/kotlin/org/jetbrains/skia/Actuals.native.kt
+4
-4
Managed.native.kt
...tiveMain/kotlin/org/jetbrains/skia/impl/Managed.native.kt
+1
-1
Native.native.kt
...ativeMain/kotlin/org/jetbrains/skia/impl/Native.native.kt
+6
-6
RefCnt.native.kt
...ativeMain/kotlin/org/jetbrains/skia/impl/RefCnt.native.kt
+1
-1
TestUtils.native.kt
...Test/kotlin/org/jetbrains/skiko/tests/TestUtils.native.kt
+1
-1
No files found.
.github/workflows/
blank
.yml
→
.github/workflows/
ci
.yml
View file @
8e84e9e0
# This is a basic workflow to help you get started with Actions
# Default Skiko CI
name
:
CI
name
:
CI
# Controls when the action will run.
# Controls when the action will run.
...
@@ -7,6 +6,7 @@ on:
...
@@ -7,6 +6,7 @@ on:
# Triggers the workflow on push or pull request events but only for the master branch
# Triggers the workflow on push or pull request events but only for the master branch
push
:
push
:
branches
:
[
master
]
branches
:
[
master
]
# TODO: temporary for faster tests, restore!
pull_request
:
pull_request
:
branches
:
[
master
]
branches
:
[
master
]
...
@@ -160,3 +160,4 @@ jobs:
...
@@ -160,3 +160,4 @@ jobs:
name
:
test-reports-windows
name
:
test-reports-windows
path
:
./skiko/build/reports/tests
path
:
./skiko/build/reports/tests
retention-days
:
5
retention-days
:
5
.github/workflows/docs.yml
0 → 100644
View file @
8e84e9e0
# Build Skiko documentation
name
:
Doc
# Controls when the action will run.
on
:
# Triggers the workflow on push or pull request events but only for the master branch
push
:
branches
:
[
master
]
# Temporary, for testing. Remove!
#pull_request:
# branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch
:
# See https://github.com/marketplace/actions/deploy-to-github-pages
jobs
:
dokka
:
runs-on
:
ubuntu-20.04
steps
:
-
uses
:
actions/checkout@v2
-
uses
:
actions/setup-java@v2
with
:
distribution
:
'
adopt'
java-version
:
'
11'
-
name
:
Build docs
run
:
bash -c 'JAVA_OPTS="-Xmx4g" ./gradlew --no-daemon -Pskiko.native.enabled=true -Pskiko.wasm.enabled=true -Pskiko.android.enabled=true :skiko:dokkaHtml'
-
name
:
Publish documentation
uses
:
JamesIves/github-pages-deploy-action@releases/v3
with
:
ACCESS_TOKEN
:
${{ secrets.ACCESS_TOKEN }}
BRANCH
:
gh-pages
FOLDER
:
./skiko/build/dokka/html
\ No newline at end of file
skiko/build.gradle.kts
View file @
8e84e9e0
...
@@ -9,6 +9,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
...
@@ -9,6 +9,7 @@ import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins
{
plugins
{
kotlin
(
"multiplatform"
)
version
"1.6.10"
kotlin
(
"multiplatform"
)
version
"1.6.10"
id
(
"org.jetbrains.dokka"
)
version
"1.6.10"
`
maven
-
publish
`
`
maven
-
publish
`
signing
signing
id
(
"org.gradle.crypto.checksum"
)
version
"1.1.0"
id
(
"org.gradle.crypto.checksum"
)
version
"1.1.0"
...
...
skiko/src/awtMain/kotlin/org/jetbrains/skiko/SkiaLayer.awt.kt
View file @
8e84e9e0
...
@@ -22,7 +22,7 @@ actual open class SkiaLayer internal constructor(
...
@@ -22,7 +22,7 @@ actual open class SkiaLayer internal constructor(
private
val
renderFactory
:
RenderFactory
=
RenderFactory
.
Default
private
val
renderFactory
:
RenderFactory
=
RenderFactory
.
Default
)
:
JPanel
()
{
)
:
JPanel
()
{
companion
object
{
internal
companion
object
{
init
{
init
{
Library
.
load
()
Library
.
load
()
}
}
...
@@ -527,10 +527,16 @@ actual open class SkiaLayer internal constructor(
...
@@ -527,10 +527,16 @@ actual open class SkiaLayer internal constructor(
}
}
}
}
/**
* Disable showing window title bar.
*/
fun
SkiaLayer
.
disableTitleBar
(
customHeaderHeight
:
Float
)
{
fun
SkiaLayer
.
disableTitleBar
(
customHeaderHeight
:
Float
)
{
backedLayer
.
disableTitleBar
(
customHeaderHeight
)
backedLayer
.
disableTitleBar
(
customHeaderHeight
)
}
}
/**
* Request to show emoji and symbols popup.
*/
fun
orderEmojiAndSymbolsPopup
()
{
fun
orderEmojiAndSymbolsPopup
()
{
platformOperations
.
orderEmojiAndSymbolsPopup
()
platformOperations
.
orderEmojiAndSymbolsPopup
()
}
}
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/AnimationDisposalMethod.kt
View file @
8e84e9e0
...
@@ -8,7 +8,10 @@ package org.jetbrains.skia
...
@@ -8,7 +8,10 @@ package org.jetbrains.skia
* Names are based on the GIF 89a spec.
* Names are based on the GIF 89a spec.
*/
*/
enum
class
AnimationDisposalMethod
{
enum
class
AnimationDisposalMethod
{
_UNUSED
,
/**
* Do not use
*/
UNUSED
,
/**
/**
*
*
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/AnimationDisposalMode.kt
View file @
8e84e9e0
...
@@ -8,7 +8,10 @@ package org.jetbrains.skia
...
@@ -8,7 +8,10 @@ package org.jetbrains.skia
* Names are based on the GIF 89a spec.
* Names are based on the GIF 89a spec.
*/
*/
enum
class
AnimationDisposalMode
{
enum
class
AnimationDisposalMode
{
_UNUSED
,
/**
* Do not use
*/
UNUSED
,
/**
/**
*
*
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/ColorInfo.kt
View file @
8e84e9e0
...
@@ -46,11 +46,11 @@ class ColorInfo(val colorType: ColorType, val alphaType: ColorAlphaType, val col
...
@@ -46,11 +46,11 @@ class ColorInfo(val colorType: ColorType, val alphaType: ColorAlphaType, val col
}
}
override
fun
hashCode
():
Int
{
override
fun
hashCode
():
Int
{
val
PRIME
=
59
val
prime
=
59
var
result
=
1
var
result
=
1
result
=
result
*
PRIME
+
colorType
.
hashCode
()
result
=
result
*
prime
+
colorType
.
hashCode
()
result
=
result
*
PRIME
+
alphaType
.
hashCode
()
result
=
result
*
prime
+
alphaType
.
hashCode
()
result
=
result
*
PRIME
+
colorSpace
.
hashCode
()
result
=
result
*
prime
+
colorSpace
.
hashCode
()
return
result
return
result
}
}
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Data.kt
View file @
8e84e9e0
...
@@ -87,14 +87,14 @@ class Data internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHol
...
@@ -87,14 +87,14 @@ class Data internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHol
override
fun
equals
(
other
:
Any
?):
Boolean
{
override
fun
equals
(
other
:
Any
?):
Boolean
{
val
otherData
=
other
as
?
Data
?:
return
false
val
otherData
=
other
as
?
Data
?:
return
false
return
_
nativeEquals
(
otherData
)
return
nativeEquals
(
otherData
)
}
}
/**
/**
* Returns true if these two objects have the same length and contents,
* Returns true if these two objects have the same length and contents,
* effectively returning 0 == memcmp(...)
* effectively returning 0 == memcmp(...)
*/
*/
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nEquals
(
_ptr
,
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/EncodedOrigin.kt
View file @
8e84e9e0
package
org.jetbrains.skia
package
org.jetbrains.skia
enum
class
EncodedOrigin
{
enum
class
EncodedOrigin
{
_UNUSED
,
/**
* Do not use
*/
UNUSED
,
/**
/**
* Default
* Default
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Expects.kt
View file @
8e84e9e0
package
org.jetbrains.skia
package
org.jetbrains.skia
expect
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
internal
expect
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
expect
fun
String
.
intCodePoints
():
IntArray
internal
expect
fun
String
.
intCodePoints
():
IntArray
expect
fun
defaultLanguageTag
():
String
internal
expect
fun
defaultLanguageTag
():
String
expect
abstract
class
OutputStream
expect
abstract
class
OutputStream
...
@@ -19,7 +19,7 @@ expect class Matcher {
...
@@ -19,7 +19,7 @@ expect class Matcher {
fun
matches
():
Boolean
fun
matches
():
Boolean
}
}
expect
fun
compilePattern
(
regex
:
String
):
Pattern
internal
expect
fun
compilePattern
(
regex
:
String
):
Pattern
@OptIn
(
ExperimentalMultiplatform
::
class
)
@OptIn
(
ExperimentalMultiplatform
::
class
)
@OptionalExpectation
@OptionalExpectation
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Font.kt
View file @
8e84e9e0
...
@@ -77,7 +77,7 @@ class Font : Managed {
...
@@ -77,7 +77,7 @@ class Font : Managed {
* Compares fonts, and returns true if they are equivalent.
* Compares fonts, and returns true if they are equivalent.
* May return false if Typeface has identical contents but different pointers.
* May return false if Typeface has identical contents but different pointers.
*/
*/
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Font_nEquals
(
_ptr
,
getPtr
(
other
))
Font_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/ImageFilter.kt
View file @
8e84e9e0
...
@@ -659,7 +659,7 @@ private external fun _nMakeArithmetic(
...
@@ -659,7 +659,7 @@ private external fun _nMakeArithmetic(
enforcePMColor
:
Boolean
,
enforcePMColor
:
Boolean
,
bg
:
NativePointer
,
bg
:
NativePointer
,
fg
:
NativePointer
,
fg
:
NativePointer
,
crop
:
InteropPointer
?
crop
:
InteropPointer
):
NativePointer
):
NativePointer
@ExternalSymbolName
(
"org_jetbrains_skia_ImageFilter__1nMakeBlend"
)
@ExternalSymbolName
(
"org_jetbrains_skia_ImageFilter__1nMakeBlend"
)
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Paint.kt
View file @
8e84e9e0
...
@@ -49,7 +49,7 @@ class Paint : Managed {
...
@@ -49,7 +49,7 @@ class Paint : Managed {
}
}
}
}
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Paint_nEquals
(
_ptr
,
getPtr
(
other
))
Paint_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Path.kt
View file @
8e84e9e0
...
@@ -239,7 +239,7 @@ class Path internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHol
...
@@ -239,7 +239,7 @@ class Path internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHol
* @param other Path to compare
* @param other Path to compare
* @return true if this and Path are equivalent
* @return true if this and Path are equivalent
*/
*/
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Path_nEquals
(
_ptr
,
getPtr
(
other
))
Path_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/StdVectorDecoder.kt
View file @
8e84e9e0
...
@@ -25,7 +25,7 @@ class ArrayDecoder(private val ptr: NativePointer, private val disposePtr: Nativ
...
@@ -25,7 +25,7 @@ class ArrayDecoder(private val ptr: NativePointer, private val disposePtr: Nativ
get
()
=
StdVectorDecoder_nGetArraySize
(
ptr
)
get
()
=
StdVectorDecoder_nGetArraySize
(
ptr
)
}
}
inline
fun
<
T
>
arrayDecoderScope
(
arrayDecoderBlock
:
()
->
ArrayDecoder
,
block
:
(
arrayCode
:
ArrayDecoder
)
->
T
):
T
{
in
ternal
in
line
fun
<
T
>
arrayDecoderScope
(
arrayDecoderBlock
:
()
->
ArrayDecoder
,
block
:
(
arrayCode
:
ArrayDecoder
)
->
T
):
T
{
var
arrayDecoder
:
ArrayDecoder
?
=
null
var
arrayDecoder
:
ArrayDecoder
?
=
null
return
try
{
return
try
{
arrayDecoder
=
arrayDecoderBlock
()
arrayDecoder
=
arrayDecoderBlock
()
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Typeface.kt
View file @
8e84e9e0
...
@@ -155,7 +155,7 @@ class Typeface internal constructor(ptr: NativePointer) : RefCnt(ptr) {
...
@@ -155,7 +155,7 @@ class Typeface internal constructor(ptr: NativePointer) : RefCnt(ptr) {
/**
/**
* @return true if the two typefaces reference the same underlying font, treating null as the default font
* @return true if the two typefaces reference the same underlying font, treating null as the default font
*/
*/
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Typeface_nEquals
(
_ptr
,
getPtr
(
other
))
Typeface_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Library.kt
View file @
8e84e9e0
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
/**
* Object representing native library containing non-Kotlin part of Skiko.
*/
expect
class
Library
{
expect
class
Library
{
companion
object
{
companion
object
{
fun
staticLoad
()
fun
staticLoad
()
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Managed.kt
View file @
8e84e9e0
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
/**
* Peer for a native object.
*/
expect
abstract
class
Managed
(
ptr
:
NativePointer
,
finalizer
:
NativePointer
,
managed
:
Boolean
=
true
)
:
Native
{
expect
abstract
class
Managed
(
ptr
:
NativePointer
,
finalizer
:
NativePointer
,
managed
:
Boolean
=
true
)
:
Native
{
/**
* Free underlying native resource, peer is useless afterwards.
*/
open
fun
close
()
open
fun
close
()
/**
* Check if underlying resource is closed.
*/
open
val
isClosed
:
Boolean
open
val
isClosed
:
Boolean
}
}
/**
* Utility function to use managed object and them immediately release it.
*/
inline
fun
<
T
:
Managed
,
R
>
T
.
use
(
block
:
(
T
)
->
R
):
R
{
inline
fun
<
T
:
Managed
,
R
>
T
.
use
(
block
:
(
T
)
->
R
):
R
{
return
try
{
return
try
{
block
(
this
)
block
(
this
)
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Native.kt
View file @
8e84e9e0
...
@@ -7,8 +7,8 @@ expect class NativePointer
...
@@ -7,8 +7,8 @@ expect class NativePointer
expect
class
InteropPointer
expect
class
InteropPointer
expect
abstract
class
Native
(
ptr
:
NativePointer
)
{
expect
abstract
class
Native
(
ptr
:
NativePointer
)
{
var
_ptr
:
NativePointer
internal
var
_ptr
:
NativePointer
open
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
internal
open
fun
nativeEquals
(
other
:
Native
?):
Boolean
companion
object
{
companion
object
{
val
NullPointer
:
NativePointer
val
NullPointer
:
NativePointer
...
@@ -17,11 +17,11 @@ expect abstract class Native(ptr: NativePointer) {
...
@@ -17,11 +17,11 @@ expect abstract class Native(ptr: NativePointer) {
override
fun
toString
():
String
override
fun
toString
():
String
}
}
expect
fun
reachabilityBarrier
(
obj
:
Any
?)
internal
expect
fun
reachabilityBarrier
(
obj
:
Any
?)
fun
getPtr
(
n
:
Native
?):
NativePointer
=
n
?.
_ptr
?:
Native
.
NullPointer
internal
fun
getPtr
(
n
:
Native
?):
NativePointer
=
n
?.
_ptr
?:
Native
.
NullPointer
expect
class
InteropScope
()
{
internal
expect
class
InteropScope
()
{
fun
toInterop
(
string
:
String
?):
InteropPointer
fun
toInterop
(
string
:
String
?):
InteropPointer
fun
toInterop
(
array
:
ByteArray
?):
InteropPointer
fun
toInterop
(
array
:
ByteArray
?):
InteropPointer
...
@@ -74,16 +74,16 @@ expect class InteropScope() {
...
@@ -74,16 +74,16 @@ expect class InteropScope() {
fun
release
()
fun
release
()
}
}
expect
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
internal
expect
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
inline
fun
withResult
(
result
:
ByteArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
ByteArray
=
interopScope
{
in
ternal
in
line
fun
withResult
(
result
:
ByteArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
ByteArray
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
block
(
handle
)
block
(
handle
)
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
result
result
}
}
inline
fun
withNullableResult
(
result
:
ByteArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Boolean
):
ByteArray
?
=
interopScope
{
in
ternal
in
line
fun
withNullableResult
(
result
:
ByteArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Boolean
):
ByteArray
?
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
return
if
(
block
(
handle
))
{
return
if
(
block
(
handle
))
{
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
...
@@ -93,14 +93,14 @@ inline fun withNullableResult(result: ByteArray, block: InteropScope.(InteropPoi
...
@@ -93,14 +93,14 @@ inline fun withNullableResult(result: ByteArray, block: InteropScope.(InteropPoi
}
}
}
}
inline
fun
withResult
(
result
:
FloatArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
FloatArray
=
interopScope
{
in
ternal
in
line
fun
withResult
(
result
:
FloatArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
FloatArray
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
block
(
handle
)
block
(
handle
)
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
result
result
}
}
inline
fun
withNullableResult
(
result
:
FloatArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Boolean
):
FloatArray
?
=
interopScope
{
in
ternal
in
line
fun
withNullableResult
(
result
:
FloatArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Boolean
):
FloatArray
?
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
val
blockResult
=
block
(
handle
)
val
blockResult
=
block
(
handle
)
if
(
blockResult
)
{
if
(
blockResult
)
{
...
@@ -111,14 +111,14 @@ inline fun withNullableResult(result: FloatArray, block: InteropScope.(InteropPo
...
@@ -111,14 +111,14 @@ inline fun withNullableResult(result: FloatArray, block: InteropScope.(InteropPo
}
}
}
}
inline
fun
withResult
(
result
:
IntArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
IntArray
=
interopScope
{
in
ternal
in
line
fun
withResult
(
result
:
IntArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
IntArray
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
block
(
handle
)
block
(
handle
)
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
result
result
}
}
inline
fun
withNullableResult
(
result
:
IntArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Boolean
):
IntArray
?
=
interopScope
{
in
ternal
in
line
fun
withNullableResult
(
result
:
IntArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Boolean
):
IntArray
?
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
return
if
(
block
(
handle
))
{
return
if
(
block
(
handle
))
{
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
...
@@ -128,21 +128,21 @@ inline fun withNullableResult(result: IntArray, block: InteropScope.(InteropPoin
...
@@ -128,21 +128,21 @@ inline fun withNullableResult(result: IntArray, block: InteropScope.(InteropPoin
}
}
}
}
inline
fun
withResult
(
result
:
ShortArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
ShortArray
=
interopScope
{
in
ternal
in
line
fun
withResult
(
result
:
ShortArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
ShortArray
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
block
(
handle
)
block
(
handle
)
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
result
result
}
}
inline
fun
withResult
(
result
:
DoubleArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
DoubleArray
=
interopScope
{
in
ternal
in
line
fun
withResult
(
result
:
DoubleArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
DoubleArray
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
block
(
handle
)
block
(
handle
)
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
result
result
}
}
inline
fun
withResult
(
result
:
NativePointerArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
NativePointerArray
=
interopScope
{
in
ternal
in
line
fun
withResult
(
result
:
NativePointerArray
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
NativePointerArray
=
interopScope
{
val
handle
=
toInteropForResult
(
result
)
val
handle
=
toInteropForResult
(
result
)
block
(
handle
)
block
(
handle
)
handle
.
fromInterop
(
result
)
handle
.
fromInterop
(
result
)
...
@@ -153,13 +153,11 @@ inline fun withResult(result: NativePointerArray, block: InteropScope.(InteropPo
...
@@ -153,13 +153,11 @@ inline fun withResult(result: NativePointerArray, block: InteropScope.(InteropPo
/**
/**
* Creates String from SkString* result and deletes SkString*.
* Creates String from SkString* result and deletes SkString*.
*/
*/
@Suppress
(
"NON_PUBLIC_CALL_FROM_PUBLIC_INLINE"
)
internal
inline
fun
withStringResult
(
block
:
()
->
NativePointer
):
String
{
inline
fun
withStringResult
(
block
:
()
->
NativePointer
):
String
{
return
ManagedString
(
block
()).
use
{
it
.
toString
()
}
return
ManagedString
(
block
()).
use
{
it
.
toString
()
}
}
}
@Suppress
(
"NON_PUBLIC_CALL_FROM_PUBLIC_INLINE"
)
internal
inline
fun
withStringResult
(
pointer
:
NativePointer
):
String
{
inline
fun
withStringResult
(
pointer
:
NativePointer
):
String
{
return
ManagedString
(
pointer
).
use
{
it
.
toString
()
}
return
ManagedString
(
pointer
).
use
{
it
.
toString
()
}
}
}
...
@@ -168,14 +166,12 @@ inline fun withStringResult(pointer: NativePointer): String {
...
@@ -168,14 +166,12 @@ inline fun withStringResult(pointer: NativePointer): String {
* It is caller responsibility to destroy underlying SkString. Use it if pointer
* It is caller responsibility to destroy underlying SkString. Use it if pointer
* is received from reference (SkString&)
* is received from reference (SkString&)
*/
*/
@Suppress
(
"NON_PUBLIC_CALL_FROM_PUBLIC_INLINE"
)
internal
inline
fun
withStringReferenceResult
(
block
:
()
->
NativePointer
):
String
{
inline
fun
withStringReferenceResult
(
block
:
()
->
NativePointer
):
String
{
val
string
=
ManagedString
(
block
(),
false
)
val
string
=
ManagedString
(
block
(),
false
)
return
string
.
toString
()
return
string
.
toString
()
}
}
@Suppress
(
"NON_PUBLIC_CALL_FROM_PUBLIC_INLINE"
)
internal
inline
fun
withStringReferenceNullableResult
(
block
:
()
->
NativePointer
):
String
?
{
inline
fun
withStringReferenceNullableResult
(
block
:
()
->
NativePointer
):
String
?
{
val
ptr
=
block
()
val
ptr
=
block
()
if
(
ptr
==
Native
.
NullPointer
)
return
null
if
(
ptr
==
Native
.
NullPointer
)
return
null
...
@@ -184,7 +180,7 @@ inline fun withStringReferenceNullableResult(block: () -> NativePointer): String
...
@@ -184,7 +180,7 @@ inline fun withStringReferenceNullableResult(block: () -> NativePointer): String
}
}
interface
ArrayInteropDecoder
<
T
>
{
inter
nal
inter
face
ArrayInteropDecoder
<
T
>
{
fun
getArrayElement
(
array
:
InteropPointer
,
index
:
Int
):
T
fun
getArrayElement
(
array
:
InteropPointer
,
index
:
Int
):
T
fun
getArraySize
(
array
:
InteropPointer
):
Int
fun
getArraySize
(
array
:
InteropPointer
):
Int
fun
disposeArray
(
array
:
InteropPointer
)
fun
disposeArray
(
array
:
InteropPointer
)
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/RefCnt.kt
View file @
8e84e9e0
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
/**
* Peer for reference counted native object.
*/
expect
abstract
class
RefCnt
:
Managed
{
expect
abstract
class
RefCnt
:
Managed
{
protected
constructor
(
ptr
:
NativePointer
)
protected
constructor
(
ptr
:
NativePointer
)
protected
constructor
(
ptr
:
NativePointer
,
allowClose
:
Boolean
)
protected
constructor
(
ptr
:
NativePointer
,
allowClose
:
Boolean
)
/**
* Number of references on underlying native object.
*/
val
refCount
:
Int
val
refCount
:
Int
}
}
expect
fun
RefCnt_nGetFinalizer
():
NativePointer
internal
expect
fun
RefCnt_nGetFinalizer
():
NativePointer
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Stats.kt
View file @
8e84e9e0
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
/**
* Statistics of native operations.
*/
expect
object
Stats
{
expect
object
Stats
{
fun
onNativeCall
()
fun
onNativeCall
()
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/paragraph/LineMetrics.kt
View file @
8e84e9e0
...
@@ -134,7 +134,7 @@ class LineMetrics(
...
@@ -134,7 +134,7 @@ class LineMetrics(
return
result
return
result
}
}
companion
object
:
ArrayInteropDecoder
<
LineMetrics
>
{
internal
companion
object
:
ArrayInteropDecoder
<
LineMetrics
>
{
override
fun
getArraySize
(
array
:
InteropPointer
)
=
LineMetrics_nGetArraySize
(
array
)
override
fun
getArraySize
(
array
:
InteropPointer
)
=
LineMetrics_nGetArraySize
(
array
)
override
fun
disposeArray
(
array
:
InteropPointer
)
=
LineMetrics_nDisposeArray
(
array
)
override
fun
disposeArray
(
array
:
InteropPointer
)
=
LineMetrics_nDisposeArray
(
array
)
override
fun
getArrayElement
(
array
:
InteropPointer
,
index
:
Int
):
LineMetrics
{
override
fun
getArrayElement
(
array
:
InteropPointer
,
index
:
Int
):
LineMetrics
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/paragraph/ParagraphStyle.kt
View file @
8e84e9e0
...
@@ -19,7 +19,7 @@ class ParagraphStyle : Managed(ParagraphStyle_nMake(), _FinalizerHolder.PTR) {
...
@@ -19,7 +19,7 @@ class ParagraphStyle : Managed(ParagraphStyle_nMake(), _FinalizerHolder.PTR) {
}
}
}
}
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nEquals
(
_ptr
,
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/paragraph/Shadow.kt
View file @
8e84e9e0
...
@@ -55,7 +55,7 @@ class Shadow(val color: Int, val offsetX: Float, val offsetY: Float, val blurSig
...
@@ -55,7 +55,7 @@ class Shadow(val color: Int, val offsetX: Float, val offsetY: Float, val blurSig
companion
object
companion
object
}
}
fun
Shadow
.
Companion
.
fromInteropPointer
(
shadowsCount
:
Int
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
Array
<
Shadow
>
{
internal
fun
Shadow
.
Companion
.
fromInteropPointer
(
shadowsCount
:
Int
,
block
:
InteropScope
.(
InteropPointer
)
->
Unit
):
Array
<
Shadow
>
{
return
withResult
(
IntArray
(
shadowsCount
*
5
),
block
).
toList
().
chunked
(
5
).
map
{
(
color
,
offsetX
,
offsetY
,
blurSigmaA
,
blurSigmaB
)
->
return
withResult
(
IntArray
(
shadowsCount
*
5
),
block
).
toList
().
chunked
(
5
).
map
{
(
color
,
offsetX
,
offsetY
,
blurSigmaA
,
blurSigmaB
)
->
val
blurSigma
=
(
blurSigmaA
.
toLong
()
shl
32
)
or
(
blurSigmaB
.
toLong
()
and
0
xFFFFFFFFL
)
val
blurSigma
=
(
blurSigmaA
.
toLong
()
shl
32
)
or
(
blurSigmaB
.
toLong
()
and
0
xFFFFFFFFL
)
Shadow
(
color
,
Float
.
fromBits
(
offsetX
),
Float
.
fromBits
(
offsetY
),
Double
.
fromBits
(
blurSigma
))
Shadow
(
color
,
Float
.
fromBits
(
offsetX
),
Float
.
fromBits
(
offsetY
),
Double
.
fromBits
(
blurSigma
))
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/paragraph/StrutStyle.kt
View file @
8e84e9e0
...
@@ -25,7 +25,7 @@ class StrutStyle internal constructor(ptr: NativePointer) : Managed(ptr, _Finali
...
@@ -25,7 +25,7 @@ class StrutStyle internal constructor(ptr: NativePointer) : Managed(ptr, _Finali
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
}
}
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
StrutStyle_nEquals
(
_ptr
,
getPtr
(
other
))
StrutStyle_nEquals
(
_ptr
,
getPtr
(
other
))
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/paragraph/TextStyle.kt
View file @
8e84e9e0
...
@@ -15,7 +15,7 @@ class TextStyle internal constructor(ptr: NativePointer) : Managed(ptr, _Finaliz
...
@@ -15,7 +15,7 @@ class TextStyle internal constructor(ptr: NativePointer) : Managed(ptr, _Finaliz
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
}
}
override
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
TextStyle_nEquals
(
TextStyle_nEquals
(
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGLength.kt
View file @
8e84e9e0
...
@@ -40,6 +40,6 @@ class SVGLength(val value: Float, val unit: SVGLengthUnit) {
...
@@ -40,6 +40,6 @@ class SVGLength(val value: Float, val unit: SVGLengthUnit) {
}
}
fun
withUnit
(
_unit
:
SVGLengthUnit
):
SVGLength
{
fun
withUnit
(
_unit
:
SVGLengthUnit
):
SVGLength
{
return
if
(
this
.
unit
===
unit
)
this
else
SVGLength
(
value
,
unit
)
return
if
(
this
.
unit
===
_
unit
)
this
else
SVGLength
(
value
,
unit
)
}
}
}
}
\ No newline at end of file
skiko/src/commonMain/kotlin/org/jetbrains/skiko/ClipRectangle.kt
View file @
8e84e9e0
package
org.jetbrains.skiko
package
org.jetbrains.skiko
/**
* Rectangle used for clipping.
*/
interface
ClipRectangle
{
interface
ClipRectangle
{
val
x
:
Float
val
x
:
Float
val
y
:
Float
val
y
:
Float
...
...
skiko/src/commonTest/kotlin/org/jetbrains/skiko/tests/TestUtils.kt
View file @
8e84e9e0
...
@@ -6,7 +6,7 @@ import org.jetbrains.skia.impl.NativePointer
...
@@ -6,7 +6,7 @@ import org.jetbrains.skia.impl.NativePointer
expect
fun
runTest
(
block
:
suspend
()
->
Unit
)
expect
fun
runTest
(
block
:
suspend
()
->
Unit
)
expect
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
internal
expect
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
expect
annotation
class
SkipNativeTarget
expect
annotation
class
SkipNativeTarget
...
...
skiko/src/jsMain/kotlin/org/jetbrains/skia/Actuals.js.kt
View file @
8e84e9e0
...
@@ -4,7 +4,7 @@ import kotlinx.browser.window
...
@@ -4,7 +4,7 @@ import kotlinx.browser.window
actual
abstract
class
OutputStream
actual
abstract
class
OutputStream
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
internal
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
block
()
block
()
}
}
...
...
skiko/src/jsMain/kotlin/org/jetbrains/skia/impl/Managed.js.kt
View file @
8e84e9e0
...
@@ -8,7 +8,7 @@ private class FinalizationThunk(private val finalizer: NativePointer, private va
...
@@ -8,7 +8,7 @@ private class FinalizationThunk(private val finalizer: NativePointer, private va
}
}
}
}
external
class
FinalizationRegistry
(
cleanup
:
(
dynamic
)
->
Unit
)
{
internal
external
class
FinalizationRegistry
(
cleanup
:
(
dynamic
)
->
Unit
)
{
fun
register
(
obj
:
dynamic
,
handle
:
dynamic
)
fun
register
(
obj
:
dynamic
,
handle
:
dynamic
)
fun
unregister
(
obj
:
dynamic
)
fun
unregister
(
obj
:
dynamic
)
}
}
...
...
skiko/src/jsMain/kotlin/org/jetbrains/skia/impl/Native.js.kt
View file @
8e84e9e0
...
@@ -9,12 +9,12 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
...
@@ -9,12 +9,12 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
if
(
this
===
other
)
return
true
if
(
this
===
other
)
return
true
if
(
null
==
other
)
return
false
if
(
null
==
other
)
return
false
if
(
other
!
is
Native
)
return
false
if
(
other
!
is
Native
)
return
false
return
if
(
_ptr
==
other
.
_ptr
)
true
else
_
nativeEquals
(
other
)
return
if
(
_ptr
==
other
.
_ptr
)
true
else
nativeEquals
(
other
)
}
}
override
fun
hashCode
():
Int
=
_ptr
override
fun
hashCode
():
Int
=
_ptr
actual
open
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
internal
actual
open
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
false
return
false
}
}
...
@@ -33,14 +33,12 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
...
@@ -33,14 +33,12 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
}
}
}
}
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
internal
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{}
// TODO: impl later
}
actual
typealias
NativePointer
=
Int
actual
typealias
NativePointer
=
Int
actual
typealias
InteropPointer
=
Int
actual
typealias
InteropPointer
=
Int
actual
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
{
internal
actual
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
{
val
scope
=
InteropScope
()
val
scope
=
InteropScope
()
try
{
try
{
return
scope
.
block
()
return
scope
.
block
()
...
@@ -49,7 +47,7 @@ actual inline fun <T> interopScope(block: InteropScope.() -> T): T {
...
@@ -49,7 +47,7 @@ actual inline fun <T> interopScope(block: InteropScope.() -> T): T {
}
}
}
}
actual
class
InteropScope
actual
constructor
()
{
internal
actual
class
InteropScope
actual
constructor
()
{
private
val
elements
=
mutableListOf
<
NativePointer
>()
private
val
elements
=
mutableListOf
<
NativePointer
>()
private
var
callbacksInitialized
=
false
private
var
callbacksInitialized
=
false
...
@@ -216,7 +214,7 @@ actual class InteropScope actual constructor() {
...
@@ -216,7 +214,7 @@ actual class InteropScope actual constructor() {
actual
inline
fun
<
reified
T
>
InteropPointer
.
fromInterop
(
decoder
:
ArrayInteropDecoder
<
T
>):
Array
<
T
>
{
actual
inline
fun
<
reified
T
>
InteropPointer
.
fromInterop
(
decoder
:
ArrayInteropDecoder
<
T
>):
Array
<
T
>
{
val
size
=
decoder
.
getArraySize
(
this
)
val
size
=
decoder
.
getArraySize
(
this
)
val
result
=
Array
<
T
>
(
size
)
{
val
result
=
Array
(
size
)
{
decoder
.
getArrayElement
(
this
,
it
)
decoder
.
getArrayElement
(
this
,
it
)
}
}
decoder
.
disposeArray
(
this
)
decoder
.
disposeArray
(
this
)
...
...
skiko/src/jsMain/kotlin/org/jetbrains/skia/impl/RefCnt.js.kt
View file @
8e84e9e0
...
@@ -23,6 +23,6 @@ private object _FinalizerHolder {
...
@@ -23,6 +23,6 @@ private object _FinalizerHolder {
}
}
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getFinalizer"
)
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getFinalizer"
)
actual
external
fun
RefCnt_nGetFinalizer
():
NativePointer
internal
actual
external
fun
RefCnt_nGetFinalizer
():
NativePointer
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getRefCount"
)
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getRefCount"
)
private
external
fun
_nGetRefCount
(
ptr
:
NativePointer
):
Int
private
external
fun
_nGetRefCount
(
ptr
:
NativePointer
):
Int
skiko/src/jsTest/kotlin/TestUtils.js.kt
View file @
8e84e9e0
...
@@ -13,7 +13,7 @@ actual fun runTest(block: suspend () -> Unit): dynamic = GlobalScope.promise {
...
@@ -13,7 +13,7 @@ actual fun runTest(block: suspend () -> Unit): dynamic = GlobalScope.promise {
block
()
block
()
}
}
actual
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
{
internal
actual
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
{
return
toInterop
(
ByteArray
(
size
))
return
toInterop
(
ByteArray
(
size
))
}
}
...
@@ -23,4 +23,4 @@ actual annotation class SkipJvmTarget
...
@@ -23,4 +23,4 @@ actual annotation class SkipJvmTarget
actual
annotation
class
SkipNativeTarget
actual
annotation
class
SkipNativeTarget
actual
fun
makeFromFileName
(
path
:
String
?):
Data
=
Data
(
0
)
actual
fun
makeFromFileName
(
path
:
String
?):
Data
=
Data
(
0
)
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Actuals.jvm.kt
View file @
8e84e9e0
...
@@ -2,11 +2,11 @@ package org.jetbrains.skia
...
@@ -2,11 +2,11 @@ package org.jetbrains.skia
import
java.util.*
import
java.util.*
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
internal
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
synchronized
(
lock
,
block
)
synchronized
(
lock
,
block
)
}
}
actual
fun
String
.
intCodePoints
():
IntArray
=
this
.
codePoints
().
toArray
()
internal
actual
fun
String
.
intCodePoints
():
IntArray
=
this
.
codePoints
().
toArray
()
actual
typealias
Pattern
=
java
.
util
.
regex
.
Pattern
actual
typealias
Pattern
=
java
.
util
.
regex
.
Pattern
...
@@ -14,6 +14,6 @@ actual typealias Matcher = java.util.regex.Matcher
...
@@ -14,6 +14,6 @@ actual typealias Matcher = java.util.regex.Matcher
actual
fun
defaultLanguageTag
():
String
=
Locale
.
getDefault
().
toLanguageTag
()
actual
fun
defaultLanguageTag
():
String
=
Locale
.
getDefault
().
toLanguageTag
()
actual
fun
compilePattern
(
regex
:
String
):
Pattern
=
Pattern
.
compile
(
regex
)
internal
actual
fun
compilePattern
(
regex
:
String
):
Pattern
=
Pattern
.
compile
(
regex
)
actual
typealias
OutputStream
=
java
.
io
.
OutputStream
actual
typealias
OutputStream
=
java
.
io
.
OutputStream
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.jvm.kt
View file @
8e84e9e0
...
@@ -3,7 +3,7 @@ package org.jetbrains.skia.impl
...
@@ -3,7 +3,7 @@ package org.jetbrains.skia.impl
import
java.lang.ref.Reference
import
java.lang.ref.Reference
actual
abstract
class
Native
actual
constructor
(
ptr
:
NativePointer
)
{
actual
abstract
class
Native
actual
constructor
(
ptr
:
NativePointer
)
{
actual
var
_ptr
:
NativePointer
internal
actual
var
_ptr
:
NativePointer
actual
companion
object
{
actual
companion
object
{
actual
val
NullPointer
:
NativePointer
actual
val
NullPointer
:
NativePointer
...
@@ -20,7 +20,7 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
...
@@ -20,7 +20,7 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
if
(
null
==
other
)
return
false
if
(
null
==
other
)
return
false
if
(!
javaClass
.
isInstance
(
other
))
return
false
if
(!
javaClass
.
isInstance
(
other
))
return
false
val
nOther
=
other
as
Native
val
nOther
=
other
as
Native
if
(
_ptr
==
nOther
.
_ptr
)
true
else
_
nativeEquals
(
nOther
)
if
(
_ptr
==
nOther
.
_ptr
)
true
else
nativeEquals
(
nOther
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
other
)
Reference
.
reachabilityFence
(
other
)
...
@@ -32,7 +32,7 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
...
@@ -32,7 +32,7 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
return
java
.
lang
.
Long
.
hashCode
(
_ptr
)
return
java
.
lang
.
Long
.
hashCode
(
_ptr
)
}
}
actual
open
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
internal
actual
open
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
false
return
false
}
}
...
@@ -42,7 +42,7 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
...
@@ -42,7 +42,7 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
}
}
}
}
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
internal
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
Reference
.
reachabilityFence
(
obj
)
Reference
.
reachabilityFence
(
obj
)
}
}
...
@@ -50,12 +50,12 @@ actual typealias NativePointer = Long
...
@@ -50,12 +50,12 @@ actual typealias NativePointer = Long
actual
typealias
InteropPointer
=
Any
?
actual
typealias
InteropPointer
=
Any
?
object
theScope
:
InteropScope
()
internal
object
theScope
:
InteropScope
()
actual
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
{
internal
actual
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
{
return
theScope
.
block
()
return
theScope
.
block
()
}
}
actual
open
class
InteropScope
actual
constructor
()
{
internal
actual
open
class
InteropScope
actual
constructor
()
{
actual
fun
toInterop
(
string
:
String
?):
InteropPointer
=
string
actual
fun
toInterop
(
string
:
String
?):
InteropPointer
=
string
actual
fun
toInterop
(
array
:
ByteArray
?):
InteropPointer
=
array
actual
fun
toInterop
(
array
:
ByteArray
?):
InteropPointer
=
array
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/RefCnt.jvm.kt
View file @
8e84e9e0
...
@@ -31,4 +31,4 @@ actual abstract class RefCnt : Managed {
...
@@ -31,4 +31,4 @@ actual abstract class RefCnt : Managed {
}
}
}
}
actual
fun
RefCnt_nGetFinalizer
()
=
RefCnt
.
_nGetFinalizer
()
internal
actual
fun
RefCnt_nGetFinalizer
()
=
RefCnt
.
_nGetFinalizer
()
\ No newline at end of file
\ No newline at end of file
skiko/src/jvmTest/kotlin/TestUtils.jvm.kt
View file @
8e84e9e0
...
@@ -12,7 +12,7 @@ actual fun runTest(block: suspend () -> Unit) {
...
@@ -12,7 +12,7 @@ actual fun runTest(block: suspend () -> Unit) {
runBlocking
{
block
()
}
runBlocking
{
block
()
}
}
}
actual
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
{
internal
actual
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
{
return
BufferUtil
.
getPointerFromByteBuffer
(
ByteBuffer
.
allocateDirect
(
size
))
return
BufferUtil
.
getPointerFromByteBuffer
(
ByteBuffer
.
allocateDirect
(
size
))
}
}
...
...
skiko/src/nativeJsMain/kotlin/org/jetbrains/skia/shaper/Shaper.nativejs.kt
View file @
8e84e9e0
...
@@ -78,7 +78,7 @@ sealed class RunIteratorBase(type: Int, ptr: NativePointer) : Managed(ptr, _Fina
...
@@ -78,7 +78,7 @@ sealed class RunIteratorBase(type: Int, ptr: NativePointer) : Managed(ptr, _Fina
}
}
}
}
protected
abstract
fun
InteropScope
.
getOnCurrentCallback
():
InteropPointer
internal
abstract
fun
InteropScope
.
getOnCurrentCallback
():
InteropPointer
companion
object
{
companion
object
{
fun
fromIterator
(
iterator
:
Iterator
<
BidiRun
?
>,
text
:
ManagedString
):
RunIteratorBase
=
fun
fromIterator
(
iterator
:
Iterator
<
BidiRun
?
>,
text
:
ManagedString
):
RunIteratorBase
=
...
...
skiko/src/nativeMain/kotlin/org/jetbrains/skia/Actuals.native.kt
View file @
8e84e9e0
...
@@ -7,11 +7,11 @@ import org.jetbrains.skia.impl.withResult
...
@@ -7,11 +7,11 @@ import org.jetbrains.skia.impl.withResult
actual
abstract
class
OutputStream
actual
abstract
class
OutputStream
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
internal
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
block
()
block
()
}
}
actual
fun
String
.
intCodePoints
():
IntArray
=
IntArray
(
this
.
length
)
{
this
[
it
].
code
}
internal
actual
fun
String
.
intCodePoints
():
IntArray
=
IntArray
(
this
.
length
)
{
this
[
it
].
code
}
actual
class
Pattern
constructor
(
regex
:
String
)
{
actual
class
Pattern
constructor
(
regex
:
String
)
{
private
val
_regex
=
Regex
(
regex
)
private
val
_regex
=
Regex
(
regex
)
...
@@ -42,9 +42,9 @@ private val LANG by lazy {
...
@@ -42,9 +42,9 @@ private val LANG by lazy {
langTag
.
ifEmpty
{
"en-US"
}
langTag
.
ifEmpty
{
"en-US"
}
}
}
actual
fun
defaultLanguageTag
():
String
=
LANG
internal
actual
fun
defaultLanguageTag
():
String
=
LANG
actual
fun
compilePattern
(
regex
:
String
):
Pattern
=
Pattern
(
regex
)
internal
actual
fun
compilePattern
(
regex
:
String
):
Pattern
=
Pattern
(
regex
)
actual
typealias
ExternalSymbolName
=
kotlin
.
native
.
SymbolName
actual
typealias
ExternalSymbolName
=
kotlin
.
native
.
SymbolName
...
...
skiko/src/nativeMain/kotlin/org/jetbrains/skia/impl/Managed.native.kt
View file @
8e84e9e0
...
@@ -59,4 +59,4 @@ actual abstract class Managed actual constructor(
...
@@ -59,4 +59,4 @@ actual abstract class Managed actual constructor(
}
}
@ExternalSymbolName
(
"org_jetbrains_skia_impl_Managed__invokeFinalizer"
)
@ExternalSymbolName
(
"org_jetbrains_skia_impl_Managed__invokeFinalizer"
)
external
fun
_nInvokeFinalizer
(
finalizer
:
NativePointer
,
ptr
:
NativePointer
)
internal
external
fun
_nInvokeFinalizer
(
finalizer
:
NativePointer
,
ptr
:
NativePointer
)
skiko/src/nativeMain/kotlin/org/jetbrains/skia/impl/Native.native.kt
View file @
8e84e9e0
...
@@ -5,20 +5,20 @@ import org.jetbrains.skia.ExternalSymbolName
...
@@ -5,20 +5,20 @@ import org.jetbrains.skia.ExternalSymbolName
import
kotlin.native.internal.NativePtr
import
kotlin.native.internal.NativePtr
actual
abstract
class
Native
actual
constructor
(
ptr
:
NativePointer
)
{
actual
abstract
class
Native
actual
constructor
(
ptr
:
NativePointer
)
{
actual
var
_ptr
:
NativePointer
internal
actual
var
_ptr
:
NativePointer
override
fun
equals
(
other
:
Any
?):
Boolean
{
override
fun
equals
(
other
:
Any
?):
Boolean
{
if
(
this
===
other
)
return
true
if
(
this
===
other
)
return
true
if
(
null
==
other
)
return
false
if
(
null
==
other
)
return
false
if
(
other
!
is
Native
)
return
false
if
(
other
!
is
Native
)
return
false
return
if
(
_ptr
==
other
.
_ptr
)
true
else
_
nativeEquals
(
other
)
return
if
(
_ptr
==
other
.
_ptr
)
true
else
nativeEquals
(
other
)
}
}
override
fun
hashCode
():
Int
{
override
fun
hashCode
():
Int
{
return
_ptr
.
toLong
().
hashCode
()
return
_ptr
.
toLong
().
hashCode
()
}
}
actual
open
fun
_
nativeEquals
(
other
:
Native
?):
Boolean
{
internal
actual
open
fun
nativeEquals
(
other
:
Native
?):
Boolean
{
return
false
return
false
}
}
...
@@ -50,11 +50,11 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
...
@@ -50,11 +50,11 @@ actual abstract class Native actual constructor(ptr: NativePointer) {
actual
typealias
NativePointer
=
NativePtr
actual
typealias
NativePointer
=
NativePtr
actual
typealias
InteropPointer
=
NativePtr
actual
typealias
InteropPointer
=
NativePtr
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
internal
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
// TODO: implement native barrier
// TODO: implement native barrier
}
}
actual
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
{
internal
actual
inline
fun
<
T
>
interopScope
(
block
:
InteropScope
.()
->
T
):
T
{
val
scope
=
InteropScope
()
val
scope
=
InteropScope
()
try
{
try
{
return
scope
.
block
()
return
scope
.
block
()
...
@@ -63,7 +63,7 @@ actual inline fun <T> interopScope(block: InteropScope.() -> T): T {
...
@@ -63,7 +63,7 @@ actual inline fun <T> interopScope(block: InteropScope.() -> T): T {
}
}
}
}
actual
class
InteropScope
actual
constructor
()
{
internal
actual
class
InteropScope
actual
constructor
()
{
actual
fun
toInterop
(
string
:
String
?):
InteropPointer
{
actual
fun
toInterop
(
string
:
String
?):
InteropPointer
{
return
if
(
string
!=
null
)
{
return
if
(
string
!=
null
)
{
// encodeToByteArray encodes to utf8
// encodeToByteArray encodes to utf8
...
...
skiko/src/nativeMain/kotlin/org/jetbrains/skia/impl/RefCnt.native.kt
View file @
8e84e9e0
...
@@ -25,6 +25,6 @@ actual abstract class RefCnt : Managed {
...
@@ -25,6 +25,6 @@ actual abstract class RefCnt : Managed {
}
}
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getFinalizer"
)
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getFinalizer"
)
actual
external
fun
RefCnt_nGetFinalizer
():
NativePointer
internal
actual
external
fun
RefCnt_nGetFinalizer
():
NativePointer
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getRefCount"
)
@ExternalSymbolName
(
"org_jetbrains_skia_impl_RefCnt__getRefCount"
)
private
external
fun
_nGetRefCount
(
ptr
:
NativePointer
):
Int
private
external
fun
_nGetRefCount
(
ptr
:
NativePointer
):
Int
skiko/src/nativeTest/kotlin/org/jetbrains/skiko/tests/TestUtils.native.kt
View file @
8e84e9e0
...
@@ -10,7 +10,7 @@ actual fun runTest(block: suspend () -> Unit) {
...
@@ -10,7 +10,7 @@ actual fun runTest(block: suspend () -> Unit) {
runBlocking
{
block
()
}
runBlocking
{
block
()
}
}
}
actual
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
{
internal
actual
fun
InteropScope
.
allocateBytesForPixels
(
size
:
Int
):
NativePointer
{
return
toInterop
(
ByteArray
(
size
))
return
toInterop
(
ByteArray
(
size
))
}
}
...
...
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