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
000e45b8
Unverified
Commit
000e45b8
authored
Sep 02, 2021
by
Nikolay Igotti
Committed by
GitHub
Sep 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commoniazation, part 2. (#154)
parent
a6cda39e
Changes
35
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
267 additions
and
153 deletions
+267
-153
AnimationFrameInfo.kt
...ommonMain/kotlin/org/jetbrains/skia/AnimationFrameInfo.kt
+11
-11
BackendRenderTarget.kt
...mmonMain/kotlin/org/jetbrains/skia/BackendRenderTarget.kt
+1
-0
BreakIterator.kt
...src/commonMain/kotlin/org/jetbrains/skia/BreakIterator.kt
+17
-21
ColorFilter.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/ColorFilter.kt
+16
-16
ColorInfo.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/ColorInfo.kt
+7
-7
ColorMatrix.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/ColorMatrix.kt
+4
-6
ColorSpace.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/ColorSpace.kt
+7
-6
ColorType.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/ColorType.kt
+17
-1
DirectContext.kt
...src/commonMain/kotlin/org/jetbrains/skia/DirectContext.kt
+3
-2
GLBackendState.kt
...rc/commonMain/kotlin/org/jetbrains/skia/GLBackendState.kt
+0
-4
IRect.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/IRect.kt
+4
-2
PathVerb.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/PathVerb.kt
+0
-0
RRect.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/RRect.kt
+15
-16
Rect.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Rect.kt
+18
-16
U16String.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/U16String.kt
+3
-2
Library.kt
.../src/commonMain/kotlin/org/jetbrains/skia/impl/Library.kt
+7
-0
Managed.kt
.../src/commonMain/kotlin/org/jetbrains/skia/impl/Managed.kt
+5
-0
Native.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/impl/Native.kt
+11
-0
RefCnt.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/impl/RefCnt.kt
+6
-0
Stats.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Stats.kt
+9
-0
Extensions.jvm.kt
...o/src/jvmMain/kotlin/org/jetbrains/skia/Extensions.jvm.kt
+0
-22
ImageInfo.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/ImageInfo.kt
+3
-3
Library.jvm.kt
...src/jvmMain/kotlin/org/jetbrains/skia/impl/Library.jvm.kt
+3
-3
Log.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Log.kt
+1
-1
Managed.jvm.kt
...src/jvmMain/kotlin/org/jetbrains/skia/impl/Managed.jvm.kt
+2
-2
Native.jvm.kt
.../src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.jvm.kt
+9
-5
RefCnt.jvm.kt
.../src/jvmMain/kotlin/org/jetbrains/skia/impl/RefCnt.jvm.kt
+3
-3
Stats.jvm.kt
...o/src/jvmMain/kotlin/org/jetbrains/skia/impl/Stats.jvm.kt
+24
-0
DecorationStyle.kt
...in/kotlin/org/jetbrains/skia/paragraph/DecorationStyle.kt
+2
-2
BidiRun.kt
...o/src/jvmMain/kotlin/org/jetbrains/skia/shaper/BidiRun.kt
+2
-2
Library.native.kt
...sX64Main/kotlin/org/jetbrains/skia/impl/Library.native.kt
+9
-0
Managed.native.kt
...sX64Main/kotlin/org/jetbrains/skia/impl/Managed.native.kt
+7
-0
Native.native.kt
...osX64Main/kotlin/org/jetbrains/skia/impl/Native.native.kt
+20
-0
RefCnt.native.kt
...osX64Main/kotlin/org/jetbrains/skia/impl/RefCnt.native.kt
+6
-0
Stats.native.kt
...cosX64Main/kotlin/org/jetbrains/skia/impl/Stats.native.kt
+15
-0
No files found.
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/AnimationFrameInfo.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/AnimationFrameInfo.kt
View file @
000e45b8
...
...
@@ -79,10 +79,10 @@ class AnimationFrameInfo(
requiredFrame
,
duration
,
fullyReceived
,
ColorAlphaType
.
values
()
.
get
(
alphaTypeOrdinal
)
,
ColorAlphaType
.
values
()
[
alphaTypeOrdinal
]
,
hasAlphaWithinBounds
,
AnimationDisposalMode
.
values
()[
disposalMethodOrdinal
],
BlendMode
.
values
()
.
get
(
blendModeOrdinal
)
,
BlendMode
.
values
()
[
blendModeOrdinal
]
,
frameRect
)
/**
...
...
@@ -251,16 +251,16 @@ class AnimationFrameInfo(
if
(
isHasAlphaWithinBounds
!=
other
.
isHasAlphaWithinBounds
)
return
false
val
`
this
$
_alphaType
`
:
Any
=
alphaType
val
`
other
$
_alphaType
`
:
Any
=
other
.
alphaType
if
(
if
(
`
this
$
_alphaType
`
==
null
)
`
other
$
_alphaType
`
!=
null
else
`
this
$
_alphaType
`
!=
`
other
$
_alphaType
`
)
return
false
if
(
`
this
$
_alphaType
`
!=
`
other
$
_alphaType
`
)
return
false
val
`
this
$
_disposalMethod
`
:
Any
=
disposalMethod
val
`
other
$
_disposalMethod
`
:
Any
=
other
.
disposalMethod
if
(
if
(
`
this
$
_disposalMethod
`
==
null
)
`
other
$
_disposalMethod
`
!=
null
else
`
this
$
_disposalMethod
`
!=
`
other
$
_disposalMethod
`
)
return
false
if
(
`
this
$
_disposalMethod
`
!=
`
other
$
_disposalMethod
`
)
return
false
val
`
this
$
_blendMode
`
:
Any
=
blendMode
val
`
other
$
_blendMode
`
:
Any
=
other
.
blendMode
if
(
if
(
`
this
$
_blendMode
`
==
null
)
`
other
$
_blendMode
`
!=
null
else
`
this
$
_blendMode
`
!=
`
other
$
_blendMode
`
)
return
false
if
(
`
this
$
_blendMode
`
!=
`
other
$
_blendMode
`
)
return
false
val
`
this
$
_frameRect
`
:
Any
=
frameRect
val
`
other
$
_frameRect
`
:
Any
=
other
.
frameRect
return
if
(
if
(
`
this
$
_frameRect
`
==
null
)
`
other
$
_frameRect
`
!=
null
else
`
this
$
_frameRect
`
!=
`
other
$
_frameRect
`
)
false
else
true
return
`
this
$
_frameRect
`
==
`
other
$
_frameRect
`
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -275,18 +275,18 @@ class AnimationFrameInfo(
result
=
result
*
PRIME
+
if
(
isFullyReceived
)
79
else
97
result
=
result
*
PRIME
+
if
(
isHasAlphaWithinBounds
)
79
else
97
val
`$
_alphaType
`
:
Any
=
alphaType
result
=
result
*
PRIME
+
(
`$
_alphaType
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_alphaType
`
.
hashCode
()
)
val
`$
_disposalMethod
`
:
Any
=
disposalMethod
result
=
result
*
PRIME
+
(
`$
_disposalMethod
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_disposalMethod
`
.
hashCode
(
)
val
`$
_blendMode
`
:
Any
=
blendMode
result
=
result
*
PRIME
+
(
`$
_blendMode
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_blendMode
`
.
hashCode
(
)
val
`$
_frameRect
`
:
Any
=
frameRect
result
=
result
*
PRIME
+
(
`$
_frameRect
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_frameRect
`
.
hashCode
(
)
return
result
}
override
fun
toString
():
String
{
return
"AnimationFrameInfo(_requiredFrame=
"
+
requiredFrame
+
", _duration="
+
duration
+
", _fullyReceived="
+
isFullyReceived
+
", _alphaType="
+
alphaType
+
", _hasAlphaWithinBounds="
+
isHasAlphaWithinBounds
+
", _disposalMethod="
+
disposalMethod
+
", _blendMode="
+
blendMode
+
", _frameRect="
+
frameRect
+
"
)"
return
"AnimationFrameInfo(_requiredFrame=
$requiredFrame, _duration=$duration, _fullyReceived=$isFullyReceived, _alphaType=$alphaType, _hasAlphaWithinBounds=$isHasAlphaWithinBounds, _disposalMethod=$disposalMethod, _blendMode=$blendMode, _frameRect=$frameRect
)"
}
/**
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/BackendRenderTarget.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/BackendRenderTarget.kt
View file @
000e45b8
...
...
@@ -3,6 +3,7 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Stats
import
kotlin.jvm.JvmStatic
class
BackendRenderTarget
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
companion
object
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/BreakIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/BreakIterator.kt
View file @
000e45b8
...
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
/**
*
...
...
@@ -190,7 +190,7 @@ import java.lang.ref.Reference
* with punctuation or other non-word characters.
</blockquote> *
*/
class
BreakIterator
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
,
Cloneable
{
class
BreakIterator
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
companion
object
{
/**
* DONE is returned by previous() and next() after all valid
...
...
@@ -255,7 +255,6 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
/**
* Returns a new BreakIterator instance for character breaks for the default locale.
*/
@JvmOverloads
fun
makeCharacterInstance
(
locale
:
String
?
=
null
):
BreakIterator
{
Stats
.
onNativeCall
()
return
BreakIterator
(
_nMake
(
0
,
locale
))
// UBRK_CHARACTER
...
...
@@ -266,7 +265,6 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
/**
* Returns a new BreakIterator instance for word breaks for the default locale.
*/
@JvmOverloads
fun
makeWordInstance
(
locale
:
String
?
=
null
):
BreakIterator
{
Stats
.
onNativeCall
()
return
BreakIterator
(
_nMake
(
1
,
locale
))
// UBRK_WORD
...
...
@@ -277,7 +275,6 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
/**
* Returns a new BreakIterator instance for line breaks for the default locale.
*/
@JvmOverloads
fun
makeLineInstance
(
locale
:
String
?
=
null
):
BreakIterator
{
Stats
.
onNativeCall
()
return
BreakIterator
(
_nMake
(
2
,
locale
))
// UBRK_LINE
...
...
@@ -288,7 +285,6 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
/**
* Returns a new BreakIterator instance for sentence breaks for the default locale.
*/
@JvmOverloads
fun
makeSentenceInstance
(
locale
:
String
?
=
null
):
BreakIterator
{
Stats
.
onNativeCall
()
return
BreakIterator
(
_nMake
(
3
,
locale
))
// UBRK_SENTENCE
...
...
@@ -323,7 +319,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
/**
* Create a copy of this iterator
*/
public
override
fun
clone
():
BreakIterator
{
fun
clone
():
BreakIterator
{
Stats
.
onNativeCall
()
return
BreakIterator
(
_nClone
(
_ptr
))
}
...
...
@@ -342,7 +338,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nCurrent
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -358,7 +354,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nNext
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -402,7 +398,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nPrevious
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -414,7 +410,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nFirst
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -426,7 +422,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nLast
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -443,7 +439,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nPreceding
(
_ptr
,
offset
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -460,7 +456,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nFollowing
(
_ptr
,
offset
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -472,7 +468,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nIsBoundary
(
_ptr
,
offset
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
@@ -493,7 +489,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nGetRuleStatus
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
/**
...
...
@@ -511,7 +507,7 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
_nGetRuleStatuses
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
/**
...
...
@@ -521,10 +517,10 @@ class BreakIterator internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
try
{
Stats
.
onNativeCall
()
_text
=
U16String
(
text
)
_nSetText
(
_ptr
,
Native
.
Companion
.
getPtr
(
_text
))
_nSetText
(
_ptr
,
getPtr
(
_text
))
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
_text
)
reachabilityBarrier
(
this
)
reachabilityBarrier
(
_text
)
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ColorFilter.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ColorFilter.kt
View file @
000e45b8
...
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
ColorFilter
:
RefCnt
{
companion
object
{
...
...
@@ -13,13 +13,13 @@ class ColorFilter : RefCnt {
Stats
.
onNativeCall
()
ColorFilter
(
_nMakeComposed
(
Native
.
Companion
.
getPtr
(
outer
),
Native
.
Companion
.
getPtr
(
inner
)
getPtr
(
outer
),
getPtr
(
inner
)
)
)
}
finally
{
Reference
.
reachabilityFence
(
outer
)
Reference
.
reachabilityFence
(
inner
)
reachabilityBarrier
(
outer
)
reachabilityBarrier
(
inner
)
}
}
...
...
@@ -43,13 +43,13 @@ class ColorFilter : RefCnt {
ColorFilter
(
_nMakeLerp
(
t
,
Native
.
Companion
.
getPtr
(
dst
),
Native
.
Companion
.
getPtr
(
src
)
getPtr
(
dst
),
getPtr
(
src
)
)
)
}
finally
{
Reference
.
reachabilityFence
(
dst
)
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
dst
)
reachabilityBarrier
(
src
)
}
}
...
...
@@ -62,20 +62,20 @@ class ColorFilter : RefCnt {
}
fun
makeTable
(
table
:
ByteArray
):
ColorFilter
{
assert
(
table
.
size
==
256
)
{
"Expected 256 elements, got "
+
table
.
size
}
require
(
table
.
size
==
256
)
{
"Expected 256 elements, got "
+
table
.
size
}
return
ColorFilter
(
_nMakeTable
(
table
))
}
fun
makeTableARGB
(
a
:
ByteArray
?,
r
:
ByteArray
?,
g
:
ByteArray
?,
b
:
ByteArray
?):
ColorFilter
{
assert
(
a
==
null
||
a
.
size
==
256
)
{
"Expected 256 elements in a[], got "
+
a
!!
.
size
}
assert
(
r
==
null
||
r
.
size
==
256
)
{
"Expected 256 elements in r[], got "
+
r
!!
.
size
}
assert
(
g
==
null
||
g
.
size
==
256
)
{
"Expected 256 elements in g[], got "
+
g
!!
.
size
}
assert
(
b
==
null
||
b
.
size
==
256
)
{
"Expected 256 elements in b[], got "
+
b
!!
.
size
}
require
(
a
==
null
||
a
.
size
==
256
)
{
"Expected 256 elements in a[], got "
+
a
!!
.
size
}
require
(
r
==
null
||
r
.
size
==
256
)
{
"Expected 256 elements in r[], got "
+
r
!!
.
size
}
require
(
g
==
null
||
g
.
size
==
256
)
{
"Expected 256 elements in g[], got "
+
g
!!
.
size
}
require
(
b
==
null
||
b
.
size
==
256
)
{
"Expected 256 elements in b[], got "
+
b
!!
.
size
}
return
ColorFilter
(
_nMakeTableARGB
(
a
,
r
,
g
,
b
))
}
fun
makeOverdraw
(
colors
:
IntArray
):
ColorFilter
{
assert
(
colors
.
size
==
6
)
{
"Expected 6 elements, got "
+
colors
.
size
}
require
(
colors
.
size
==
6
)
{
"Expected 6 elements, got "
+
colors
.
size
}
return
ColorFilter
(
_nMakeOverdraw
(
colors
[
0
],
colors
[
1
],
colors
[
2
],
colors
[
3
],
colors
[
4
],
colors
[
5
]))
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ColorInfo.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ColorInfo.kt
View file @
000e45b8
...
...
@@ -47,13 +47,13 @@ class ColorInfo(colorType: ColorType, alphaType: ColorAlphaType, colorSpace: Col
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
val
`
this
$
_colorType
`
:
Any
=
colorType
val
`
other
$
_colorType
`
:
Any
=
other
.
colorType
if
(
if
(
`
this
$
_colorType
`
==
null
)
`
other
$
_colorType
`
!=
null
else
`
this
$
_colorType
`
!=
`
other
$
_colorType
`
)
return
false
if
(
`
this
$
_colorType
`
!=
`
other
$
_colorType
`
)
return
false
val
`
this
$
_alphaType
`
:
Any
=
alphaType
val
`
other
$
_alphaType
`
:
Any
=
other
.
alphaType
if
(
if
(
`
this
$
_alphaType
`
==
null
)
`
other
$
_alphaType
`
!=
null
else
`
this
$
_alphaType
`
!=
`
other
$
_alphaType
`
)
return
false
if
(
`
this
$
_alphaType
`
!=
`
other
$
_alphaType
`
)
return
false
val
`
this
$
_colorSpace
`
:
Any
?
=
colorSpace
val
`
other
$
_colorSpace
`
:
Any
?
=
other
.
colorSpace
return
if
(
if
(
`
this
$
_colorSpace
`
==
null
)
`
other
$
_colorSpace
`
!=
null
else
`
this
$
_colorSpace
`
!=
`
other
$
_colorSpace
`
)
false
else
true
return
!
if
(
`
this
$
_colorSpace
`
==
null
)
`
other
$
_colorSpace
`
!=
null
else
`
this
$
_colorSpace
`
!=
`
other
$
_colorSpace
`
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -64,16 +64,16 @@ class ColorInfo(colorType: ColorType, alphaType: ColorAlphaType, colorSpace: Col
val
PRIME
=
59
var
result
=
1
val
`$
_colorType
`
:
Any
=
colorType
result
=
result
*
PRIME
+
(
`$
_colorType
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_colorType
`
.
hashCode
(
)
val
`$
_alphaType
`
:
Any
=
alphaType
result
=
result
*
PRIME
+
(
`$
_alphaType
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_alphaType
`
.
hashCode
(
)
val
`$
_colorSpace
`
:
Any
?
=
colorSpace
result
=
result
*
PRIME
+
(
`$
_colorSpace
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_colorSpace
`
.
hashCode
(
)
return
result
}
override
fun
toString
():
String
{
return
"ColorInfo(_colorType=
"
+
colorType
+
", _alphaType="
+
alphaType
+
", _colorSpace="
+
colorSpace
+
"
)"
return
"ColorInfo(_colorType=
$colorType, _alphaType=$alphaType, _colorSpace=$colorSpace
)"
}
fun
withColorType
(
_colorType
:
ColorType
):
ColorInfo
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ColorMatrix.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ColorMatrix.kt
View file @
000e45b8
package
org.jetbrains.skia
import
java.util.*
class
ColorMatrix
(
vararg
mat
:
Float
)
{
val
mat
:
FloatArray
override
fun
equals
(
o
:
Any
?):
Boolean
{
...
...
@@ -9,7 +7,7 @@ class ColorMatrix(vararg mat: Float) {
if
(
o
!
is
ColorMatrix
)
return
false
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
return
if
(!
Arrays
.
equals
(
mat
,
other
.
mat
))
false
else
true
return
mat
.
contentEquals
(
other
.
mat
)
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -19,16 +17,16 @@ class ColorMatrix(vararg mat: Float) {
override
fun
hashCode
():
Int
{
val
PRIME
=
59
var
result
=
1
result
=
result
*
PRIME
+
Arrays
.
hashCode
(
mat
)
result
=
result
*
PRIME
+
mat
.
contentHashCode
(
)
return
result
}
override
fun
toString
():
String
{
return
"ColorMatrix(_mat=
"
+
Arrays
.
toString
(
mat
)
+
"
)"
return
"ColorMatrix(_mat=
$mat
)"
}
init
{
assert
(
mat
.
size
==
20
)
{
(
if
(
"Expected 20 elements, got $mat"
==
null
)
null
else
mat
.
size
)
!!
}
require
(
mat
.
size
==
20
)
{
"Expected 20 elements, got $mat"
}
this
.
mat
=
mat
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ColorSpace.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ColorSpace.kt
View file @
000e45b8
...
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
ColorSpace
:
Managed
{
companion
object
{
...
...
@@ -40,8 +41,8 @@ class ColorSpace : Managed {
)
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
to
)
reachabilityBarrier
(
this
)
reachabilityBarrier
(
to
)
}
}
...
...
@@ -57,7 +58,7 @@ class ColorSpace : Managed {
Stats
.
onNativeCall
()
_nIsGammaCloseToSRGB
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
/**
...
...
@@ -68,7 +69,7 @@ class ColorSpace : Managed {
Stats
.
onNativeCall
()
_nIsGammaLinear
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
/**
...
...
@@ -90,7 +91,7 @@ class ColorSpace : Managed {
Stats
.
onNativeCall
()
_nIsSRGB
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
private
object
_FinalizerHolder
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/ColorType.kt
View file @
000e45b8
package
org.jetbrains.skia
import
kotlin.jvm.JvmStatic
/**
* Describes how pixel bits encode color. A pixel may be an alpha mask, a
* grayscale, RGB, or ARGB.
...
...
@@ -314,5 +316,19 @@ enum class ColorType {
* Native ARGB 32-bit encoding
*/
var
N32
=
BGRA_8888
@JvmStatic
external
fun
_nIsAlwaysOpaque
(
value
:
Int
):
Boolean
}
/**
* Returns true if ColorType always decodes alpha to 1.0, making the pixel
* fully opaque. If true, ColorType does not reserve bits to encode alpha.
*
* @return true if alpha is always set to 1.0
*/
val
isAlwaysOpaque
:
Boolean
get
()
{
return
_nIsAlwaysOpaque
(
ordinal
)
}
}
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/DirectContext.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/DirectContext.kt
View file @
000e45b8
...
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
DirectContext
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
...
...
@@ -114,7 +115,7 @@ class DirectContext internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
_nAbandon
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/GLBackendState.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/GLBackendState.kt
View file @
000e45b8
...
...
@@ -15,8 +15,4 @@ enum class GLBackendState(internal val _bit: Int) {
1
shl
8
),
FIXED_FUNCTION
(
1
shl
9
),
MISC
(
1
shl
10
),
PATH_RENDERING
(
1
shl
11
);
companion
object
{
internal
val
_values
=
values
()
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/IRect.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/IRect.kt
View file @
000e45b8
package
org.jetbrains.skia
import
kotlin.jvm.JvmStatic
class
IRect
internal
constructor
(
val
left
:
Int
,
val
top
:
Int
,
val
right
:
Int
,
val
bottom
:
Int
)
{
val
width
:
Int
get
()
=
right
-
left
...
...
@@ -8,9 +10,9 @@ class IRect internal constructor(val left: Int, val top: Int, val right: Int, va
fun
intersect
(
other
:
IRect
):
IRect
?
{
return
if
(
right
<=
other
.
left
||
other
.
right
<=
left
||
bottom
<=
other
.
top
||
other
.
bottom
<=
top
)
null
else
IRect
(
Math
.
max
(
left
,
other
.
left
),
Math
.
max
(
top
,
other
.
top
),
Math
.
min
(
maxOf
(
left
,
other
.
left
),
maxOf
(
top
,
other
.
top
),
minOf
(
right
,
other
.
right
),
Math
.
min
(
bottom
,
other
.
bottom
)
),
minOf
(
bottom
,
other
.
bottom
)
)
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/PathVerb.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/PathVerb.kt
View file @
000e45b8
File moved
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/RRect.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/RRect.kt
View file @
000e45b8
package
org.jetbrains.skia
import
java.util.*
import
kotlin.jvm.JvmStatic
import
kotlin.math.abs
class
RRect
internal
constructor
(
l
:
Float
,
t
:
Float
,
r
:
Float
,
b
:
Float
,
val
radii
:
FloatArray
)
:
Rect
(
l
,
t
,
r
,
b
)
{
...
...
@@ -12,28 +13,26 @@ class RRect internal constructor(l: Float, t: Float, r: Float, b: Float, val rad
break
}
}
return
if
(
becomesRect
)
Rect
.
Companion
.
makeLTRB
(
return
if
(
becomesRect
)
makeLTRB
(
left
-
spread
,
top
-
spread
,
Math
.
max
(
left
-
spread
,
right
+
spread
),
Math
.
max
(
top
-
spread
,
bottom
+
spread
)
maxOf
(
left
-
spread
,
right
+
spread
),
maxOf
(
top
-
spread
,
bottom
+
spread
)
)
else
{
val
radii
=
Arrays
.
copyOf
(
radii
,
radii
.
size
)
for
(
i
in
radii
.
indices
)
radii
[
i
]
=
Math
.
max
(
0.0f
,
radii
[
i
]
+
spread
)
val
radii
=
radii
.
copyOf
(
)
for
(
i
in
radii
.
indices
)
radii
[
i
]
=
maxOf
(
0.0f
,
radii
[
i
]
+
spread
)
RRect
(
left
-
spread
,
top
-
spread
,
Math
.
max
(
left
-
spread
,
right
+
spread
),
Math
.
max
(
top
-
spread
,
bottom
+
spread
),
maxOf
(
left
-
spread
,
right
+
spread
),
maxOf
(
top
-
spread
,
bottom
+
spread
),
radii
)
}
}
override
fun
toString
():
String
{
return
"RRect(_left="
+
left
+
", _top="
+
top
+
", _right="
+
right
+
", _bottom="
+
bottom
+
", _radii="
+
Arrays
.
toString
(
radii
)
+
")"
return
"RRect(_left=$left, _top=$top, _right=$right, _bottom=$bottom, _radii=$radii)"
}
override
fun
equals
(
o
:
Any
?):
Boolean
{
...
...
@@ -42,7 +41,7 @@ class RRect internal constructor(l: Float, t: Float, r: Float, b: Float, val rad
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
super
.
equals
(
o
))
return
false
return
if
(!
Arrays
.
equals
(
radii
,
other
.
radii
))
false
else
true
return
radii
.
contentEquals
(
other
.
radii
)
}
override
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -52,7 +51,7 @@ class RRect internal constructor(l: Float, t: Float, r: Float, b: Float, val rad
override
fun
hashCode
():
Int
{
val
PRIME
=
59
var
result
=
super
.
hashCode
()
result
=
result
*
PRIME
+
Arrays
.
hashCode
(
radii
)
result
=
result
*
PRIME
+
radii
.
contentHashCode
(
)
return
result
}
...
...
@@ -101,11 +100,11 @@ class RRect internal constructor(l: Float, t: Float, r: Float, b: Float, val rad
}
fun
makeOvalLTRB
(
l
:
Float
,
t
:
Float
,
r
:
Float
,
b
:
Float
):
RRect
{
return
RRect
(
l
,
t
,
r
,
b
,
floatArrayOf
(
Math
.
abs
(
r
-
l
)
/
2.0f
,
Math
.
abs
(
b
-
t
)
/
2.0f
))
return
RRect
(
l
,
t
,
r
,
b
,
floatArrayOf
(
abs
(
r
-
l
)
/
2.0f
,
abs
(
b
-
t
)
/
2.0f
))
}
fun
makePillLTRB
(
l
:
Float
,
t
:
Float
,
r
:
Float
,
b
:
Float
):
RRect
{
return
RRect
(
l
,
t
,
r
,
b
,
floatArrayOf
(
Math
.
min
(
Math
.
abs
(
r
-
l
),
Math
.
abs
(
t
-
b
))
/
2.0f
))
return
RRect
(
l
,
t
,
r
,
b
,
floatArrayOf
(
minOf
(
abs
(
r
-
l
),
abs
(
t
-
b
))
/
2.0f
))
}
fun
makeXYWH
(
l
:
Float
,
t
:
Float
,
w
:
Float
,
h
:
Float
,
radius
:
Float
):
RRect
{
...
...
@@ -151,7 +150,7 @@ class RRect internal constructor(l: Float, t: Float, r: Float, b: Float, val rad
}
fun
makePillXYWH
(
l
:
Float
,
t
:
Float
,
w
:
Float
,
h
:
Float
):
RRect
{
return
RRect
(
l
,
t
,
l
+
w
,
t
+
h
,
floatArrayOf
(
Math
.
min
(
w
,
h
)
/
2.0f
))
return
RRect
(
l
,
t
,
l
+
w
,
t
+
h
,
floatArrayOf
(
minOf
(
w
,
h
)
/
2.0f
))
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Rect.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Rect.kt
View file @
000e45b8
package
org.jetbrains.skia
import
kotlin.jvm.JvmStatic
open
class
Rect
internal
constructor
(
val
left
:
Float
,
val
top
:
Float
,
val
right
:
Float
,
val
bottom
:
Float
)
{
val
width
:
Float
get
()
=
right
-
left
...
...
@@ -8,11 +10,11 @@ open class Rect internal constructor(val left: Float, val top: Float, val right:
fun
intersect
(
other
:
Rect
):
Rect
?
{
return
if
(
right
<=
other
.
left
||
other
.
right
<=
left
||
bottom
<=
other
.
top
||
other
.
bottom
<=
top
)
null
else
Rect
(
Math
.
max
(
maxOf
(
left
,
other
.
left
),
Math
.
max
(
top
,
other
.
top
),
Math
.
min
(
),
maxOf
(
top
,
other
.
top
),
minOf
(
right
,
other
.
right
),
Math
.
min
(
bottom
,
other
.
bottom
)
),
minOf
(
bottom
,
other
.
bottom
)
)
}
...
...
@@ -38,11 +40,11 @@ open class Rect internal constructor(val left: Float, val top: Float, val right:
open
fun
inflate
(
spread
:
Float
):
Rect
{
return
if
(
spread
<=
0
)
makeLTRB
(
left
-
spread
,
top
-
spread
,
Math
.
max
(
left
-
spread
,
top
-
spread
,
maxOf
(
left
-
spread
,
right
+
spread
),
Math
.
max
(
top
-
spread
,
bottom
+
spread
)
)
else
RRect
.
Companion
.
makeLTRB
(
left
-
spread
,
top
-
spread
,
Math
.
max
(
left
-
spread
,
right
+
spread
),
Math
.
max
(
),
maxOf
(
top
-
spread
,
bottom
+
spread
)
)
else
RRect
.
makeLTRB
(
left
-
spread
,
top
-
spread
,
maxOf
(
left
-
spread
,
right
+
spread
),
maxOf
(
top
-
spread
,
bottom
+
spread
),
spread
)
...
...
@@ -56,10 +58,10 @@ open class Rect internal constructor(val left: Float, val top: Float, val right:
if
(
o
!
is
Rect
)
return
false
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(
java
.
lang
.
Float
.
compare
(
left
,
other
.
left
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
top
,
other
.
top
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
right
,
other
.
right
)
!=
0
)
return
false
return
if
(
java
.
lang
.
Float
.
compare
(
bottom
,
other
.
bottom
)
!=
0
)
false
else
true
if
(
left
.
compareTo
(
other
.
left
)
!=
0
)
return
false
if
(
top
.
compareTo
(
other
.
top
)
!=
0
)
return
false
if
(
right
.
compareTo
(
other
.
right
)
!=
0
)
return
false
return
bottom
.
compareTo
(
other
.
bottom
)
==
0
}
protected
open
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -69,15 +71,15 @@ open class Rect internal constructor(val left: Float, val top: Float, val right:
override
fun
hashCode
():
Int
{
val
PRIME
=
59
var
result
=
1
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
left
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
top
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
right
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
bottom
)
result
=
result
*
PRIME
+
left
.
toBits
(
)
result
=
result
*
PRIME
+
top
.
toBits
(
)
result
=
result
*
PRIME
+
right
.
toBits
(
)
result
=
result
*
PRIME
+
bottom
.
toBits
(
)
return
result
}
override
fun
toString
():
String
{
return
"Rect(_left=
"
+
left
+
", _top="
+
top
+
", _right="
+
right
+
", _bottom="
+
bottom
+
"
)"
return
"Rect(_left=
$left, _top=$top, _right=$right, _bottom=$bottom
)"
}
companion
object
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/U16String.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/U16String.kt
View file @
000e45b8
...
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
/**
* Kotlin mirror of std::vector<jchar> (UTF-16)
...
...
@@ -28,7 +29,7 @@ class U16String internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
Stats
.
onNativeCall
()
_nToString
(
_ptr
)
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Library.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
expect
class
Library
{
companion
object
{
fun
staticLoad
()
}
}
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Managed.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
expect
abstract
class
Managed
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
=
true
)
:
Native
{
open
fun
close
()
}
\ No newline at end of file
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Native.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
expect
abstract
class
Native
(
ptr
:
Long
)
{
var
_ptr
:
Long
companion
object
{
fun
getPtr
(
n
:
Native
?):
Long
}
}
expect
fun
reachabilityBarrier
(
obj
:
Any
?)
\ No newline at end of file
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/RefCnt.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
expect
abstract
class
RefCnt
:
Managed
{
protected
constructor
(
ptr
:
Long
)
protected
constructor
(
ptr
:
Long
,
allowClose
:
Boolean
)
}
\ No newline at end of file
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Stats.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
expect
object
Stats
{
fun
onNativeCall
()
fun
onAllocated
(
className
:
String
)
fun
onDeallocated
(
className
:
String
)
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Extensions.jvm.kt
deleted
100644 → 0
View file @
a6cda39e
package
org.jetbrains.skia
class
Extensions
{
companion
object
{
@JvmStatic
external
fun
_nIsAlwaysOpaque
(
value
:
Int
):
Boolean
}
}
/**
* Returns true if ColorType always decodes alpha to 1.0, making the pixel
* fully opaque. If true, ColorType does not reserve bits to encode alpha.
*
* @return true if alpha is always set to 1.0
*/
val
ColorType
.
isAlwaysOpaque
:
Boolean
get
()
{
return
Extensions
.
_nIsAlwaysOpaque
(
ordinal
)
}
skiko/src/jvmMain/kotlin/org/jetbrains/skia/ImageInfo.kt
View file @
000e45b8
...
...
@@ -236,7 +236,7 @@ class ImageInfo(val colorInfo: ColorInfo, val width: Int, val height: Int) {
* @return ImageInfo with [ColorType.N32]
*/
fun
makeN32
(
width
:
Int
,
height
:
Int
,
alphaType
:
ColorAlphaType
):
ImageInfo
{
return
ImageInfo
(
ColorInfo
(
ColorType
.
Companion
.
N32
,
alphaType
,
null
),
width
,
height
)
return
ImageInfo
(
ColorInfo
(
ColorType
.
N32
,
alphaType
,
null
),
width
,
height
)
}
/**
...
...
@@ -263,14 +263,14 @@ class ImageInfo(val colorInfo: ColorInfo, val width: Int, val height: Int) {
* @return ImageInfo with [ColorType.N32] and [ColorAlphaType.PREMUL]
*/
fun
makeN32Premul
(
width
:
Int
,
height
:
Int
):
ImageInfo
{
return
ImageInfo
(
ColorInfo
(
ColorType
.
Companion
.
N32
,
ColorAlphaType
.
PREMUL
,
null
),
width
,
height
)
return
ImageInfo
(
ColorInfo
(
ColorType
.
N32
,
ColorAlphaType
.
PREMUL
,
null
),
width
,
height
)
}
/**
* @return ImageInfo with [ColorType.N32] and [ColorAlphaType.PREMUL]
*/
fun
makeN32Premul
(
width
:
Int
,
height
:
Int
,
colorSpace
:
ColorSpace
?):
ImageInfo
{
return
ImageInfo
(
ColorInfo
(
ColorType
.
Companion
.
N32
,
ColorAlphaType
.
PREMUL
,
colorSpace
),
width
,
height
)
return
ImageInfo
(
ColorInfo
(
ColorType
.
N32
,
ColorAlphaType
.
PREMUL
,
colorSpace
),
width
,
height
)
}
/**
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Library.kt
→
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Library.
jvm.
kt
View file @
000e45b8
...
...
@@ -3,11 +3,11 @@ package org.jetbrains.skia.impl
import
org.jetbrains.skiko.Library
import
java.util.concurrent.atomic.AtomicBoolean
class
Library
{
companion
object
{
actual
class
Library
{
actual
companion
object
{
var
loaded
=
AtomicBoolean
(
false
)
@JvmStatic
fun
staticLoad
()
{
actual
fun
staticLoad
()
{
if
(!
loaded
.
compareAndExchange
(
false
,
true
))
{
Library
.
load
()
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Log.kt
View file @
000e45b8
...
...
@@ -70,6 +70,6 @@ object Log {
4
else
if
(
"ERROR"
==
property
)
5
else
if
(
"NONE"
==
property
)
6
else
throw
IllegalArgumentException
(
"Unknown log level:
"
+
property
)
throw
IllegalArgumentException
(
"Unknown log level:
$property"
)
}
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Managed.kt
→
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Managed.
jvm.
kt
View file @
000e45b8
...
...
@@ -2,10 +2,10 @@ package org.jetbrains.skia.impl
import
java.lang.ref.Cleaner
a
bstract
class
Managed
@JvmOverloads
constructor
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
=
true
)
:
Native
(
ptr
),
a
ctual
abstract
class
Managed
actual
constructor
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
)
:
Native
(
ptr
),
AutoCloseable
{
private
var
_cleanable
:
Cleaner
.
Cleanable
?
=
null
override
fun
close
()
{
actual
override
fun
close
()
{
if
(
0L
==
_ptr
)
throw
RuntimeException
(
"Object already closed: $javaClass, _ptr=$_ptr"
)
else
if
(
null
==
_cleanable
)
throw
RuntimeException
(
"Object is not managed in JVM, can't close(): $javaClass, _ptr=$_ptr"
)
else
{
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.kt
→
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.
jvm.
kt
View file @
000e45b8
...
...
@@ -2,10 +2,10 @@ package org.jetbrains.skia.impl
import
java.lang.ref.Reference
a
bstract
class
Native
(
ptr
:
Long
)
{
var
_ptr
:
Long
a
ctual
abstract
class
Native
actual
constructor
(
ptr
:
Long
)
{
actual
var
_ptr
:
Long
override
fun
toString
():
String
{
return
javaClass
.
simpleName
+
"(_ptr=0x"
+
java
.
lang
.
Long
.
toString
(
_ptr
,
16
)
+
")"
return
javaClass
.
simpleName
+
"(_ptr=0x"
+
_ptr
.
toString
(
16
)
+
")"
}
override
fun
equals
(
other
:
Any
?):
Boolean
{
...
...
@@ -30,8 +30,8 @@ abstract class Native(ptr: Long) {
return
java
.
lang
.
Long
.
hashCode
(
_ptr
)
}
companion
object
{
fun
getPtr
(
n
:
Native
?):
Long
{
actual
companion
object
{
actual
fun
getPtr
(
n
:
Native
?):
Long
{
return
n
?.
_ptr
?:
0
}
}
...
...
@@ -41,3 +41,7 @@ abstract class Native(ptr: Long) {
_ptr
=
ptr
}
}
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
Reference
.
reachabilityFence
(
obj
)
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/RefCnt.kt
→
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/RefCnt.
jvm.
kt
View file @
000e45b8
...
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia.impl
import
java.lang.ref.Reference
abstract
class
RefCnt
:
Managed
{
protected
constructor
(
ptr
:
Long
)
:
super
(
ptr
,
_FinalizerHolder
.
PTR
)
{}
protected
constructor
(
ptr
:
Long
,
allowClose
:
Boolean
)
:
super
(
ptr
,
_FinalizerHolder
.
PTR
,
allowClose
)
{}
a
ctual
a
bstract
class
RefCnt
:
Managed
{
protected
actual
constructor
(
ptr
:
Long
)
:
super
(
ptr
,
_FinalizerHolder
.
PTR
)
{}
protected
actual
constructor
(
ptr
:
Long
,
allowClose
:
Boolean
)
:
super
(
ptr
,
_FinalizerHolder
.
PTR
,
allowClose
)
val
refCount
:
Int
get
()
=
try
{
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Stats.kt
→
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Stats.
jvm.
kt
View file @
000e45b8
...
...
@@ -2,27 +2,23 @@ package org.jetbrains.skia.impl
import
java.util.concurrent.ConcurrentHashMap
object
Stats
{
actual
object
Stats
{
var
enabled
=
false
var
nativeCalls
:
Long
=
0
var
allocated
:
MutableMap
<
String
,
Int
>
=
ConcurrentHashMap
()
fun
onNativeCall
()
{
actual
fun
onNativeCall
()
{
if
(
enabled
)
nativeCalls
++
}
fun
onAllocated
(
className
:
String
)
{
if
(
enabled
)
allocated
.
merge
(
className
,
1
)
{
a
:
Int
?,
b
:
Int
?
->
Integer
.
sum
(
a
!!
,
b
!!
)
actual
fun
onAllocated
(
className
:
String
)
{
if
(
enabled
)
allocated
.
merge
(
className
,
1
)
{
a
:
Int
,
b
:
Int
->
a
+
b
}
}
fun
onDeallocated
(
className
:
String
)
{
if
(
enabled
)
allocated
.
merge
(
className
,
-
1
)
{
a
:
Int
?,
b
:
Int
?
->
Integer
.
sum
(
a
!!
,
b
!!
)
actual
fun
onDeallocated
(
className
:
String
)
{
if
(
enabled
)
allocated
.
merge
(
className
,
-
1
)
{
a
:
Int
,
b
:
Int
->
a
+
b
}
}
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skia/paragraph/DecorationStyle.kt
View file @
000e45b8
...
...
@@ -63,7 +63,7 @@ class DecorationStyle(
if
(
java
.
lang
.
Float
.
compare
(
thicknessMultiplier
,
other
.
thicknessMultiplier
)
!=
0
)
return
false
val
`
this
$
_lineStyle
`
:
Any
=
lineStyle
val
`
other
$
_lineStyle
`
:
Any
=
other
.
lineStyle
return
if
(
if
(
`
this
$
_lineStyle
`
==
null
)
`
other
$
_lineStyle
`
!=
null
else
`
this
$
_lineStyle
`
!=
`
other
$
_lineStyle
`
)
false
else
true
return
`
this
$
_lineStyle
`
==
`
other
$
_lineStyle
`
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -85,7 +85,7 @@ class DecorationStyle(
}
override
fun
toString
():
String
{
return
"DecorationStyle(_underline=
"
+
_underline
+
", _overline="
+
_overline
+
", _lineThrough="
+
_lineThrough
+
", _gaps="
+
_gaps
+
", _color="
+
color
+
", _lineStyle="
+
lineStyle
+
", _thicknessMultiplier="
+
thicknessMultiplier
+
"
)"
return
"DecorationStyle(_underline=
$_underline, _overline=$_overline, _lineThrough=$_lineThrough, _gaps=$_gaps, _color=$color, _lineStyle=$lineStyle, _thicknessMultiplier=$thicknessMultiplier
)"
}
fun
withUnderline
(
_underline
:
Boolean
):
DecorationStyle
{
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/shaper/BidiRun.kt
View file @
000e45b8
...
...
@@ -16,7 +16,7 @@ class BidiRun(
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(
end
!=
other
.
end
)
return
false
return
if
(
level
!=
other
.
level
)
false
else
true
return
level
==
other
.
level
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
...
@@ -32,6 +32,6 @@ class BidiRun(
}
override
fun
toString
():
String
{
return
"BidiRun(_end=
"
+
end
+
", _level="
+
level
+
"
)"
return
"BidiRun(_end=
$end, _level=$level
)"
}
}
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/Library.native.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
actual
class
Library
{
actual
companion
object
{
actual
fun
staticLoad
()
{
TODO
()
}
}
}
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/Managed.native.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
actual
abstract
class
Managed
actual
constructor
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
)
:
Native
(
ptr
)
{
actual
open
fun
close
()
{
TODO
()
}
}
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/Native.native.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
actual
abstract
class
Native
actual
constructor
(
ptr
:
Long
)
{
actual
var
_ptr
:
Long
actual
companion
object
{
actual
fun
getPtr
(
n
:
Native
?):
Long
{
return
n
?.
_ptr
?:
0
}
}
init
{
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Can't wrap nullptr"
)
_ptr
=
ptr
}
}
actual
fun
reachabilityBarrier
(
obj
:
Any
?)
{
TODO
()
}
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/RefCnt.native.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
actual
abstract
class
RefCnt
:
Managed
{
actual
protected
constructor
(
ptr
:
Long
):
super
(
ptr
,
0L
,
false
)
{
TODO
()
}
actual
protected
constructor
(
ptr
:
Long
,
allowClose
:
Boolean
):
super
(
ptr
,
0
,
allowClose
)
{
TODO
()
}
}
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/Stats.native.kt
0 → 100644
View file @
000e45b8
package
org.jetbrains.skia.impl
actual
object
Stats
{
actual
fun
onNativeCall
()
{
TODO
()
}
actual
fun
onAllocated
(
className
:
String
)
{
TODO
()
}
actual
fun
onDeallocated
(
className
:
String
)
{
TODO
()
}
}
\ No newline at end of file
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