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
f794e4bb
Unverified
Commit
f794e4bb
authored
Sep 02, 2021
by
Nikolay Igotti
Committed by
GitHub
Sep 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commonalization, part 3. (#155)
parent
711c728b
Changes
66
Hide whitespace changes
Inline
Side-by-side
Showing
66 changed files
with
1295 additions
and
1103 deletions
+1295
-1103
Bitmap.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Bitmap.kt
+58
-64
Canvas.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Canvas.kt
+310
-282
Data.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Data.kt
+9
-11
Drawable.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Drawable.kt
+7
-7
Expects.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Expects.kt
+30
-0
Font.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Font.kt
+49
-49
FontFamilyName.kt
...rc/commonMain/kotlin/org/jetbrains/skia/FontFamilyName.kt
+5
-5
FontFeature.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/FontFeature.kt
+15
-17
FontMetrics.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/FontMetrics.kt
+22
-22
FontMgr.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/FontMgr.kt
+11
-12
FontStyle.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/FontStyle.kt
+4
-4
FontStyleSet.kt
.../src/commonMain/kotlin/org/jetbrains/skia/FontStyleSet.kt
+8
-7
FontVariation.kt
...src/commonMain/kotlin/org/jetbrains/skia/FontVariation.kt
+9
-10
FontVariationAxis.kt
...commonMain/kotlin/org/jetbrains/skia/FontVariationAxis.kt
+11
-11
GradientStyle.kt
...src/commonMain/kotlin/org/jetbrains/skia/GradientStyle.kt
+0
-0
IHasImageInfo.kt
...src/commonMain/kotlin/org/jetbrains/skia/IHasImageInfo.kt
+0
-0
Image.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Image.kt
+40
-44
ImageFilter.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/ImageFilter.kt
+68
-74
ImageInfo.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/ImageInfo.kt
+2
-2
ManagedString.kt
...src/commonMain/kotlin/org/jetbrains/skia/ManagedString.kt
+3
-2
MaskFilter.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/MaskFilter.kt
+4
-5
Paint.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Paint.kt
+48
-47
Path.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Path.kt
+60
-68
PathEffect.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/PathEffect.kt
+12
-12
PathSegment.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/PathSegment.kt
+133
-0
PathSegmentIterator.kt
...mmonMain/kotlin/org/jetbrains/skia/PathSegmentIterator.kt
+4
-6
Picture.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Picture.kt
+13
-16
PixelRef.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/PixelRef.kt
+7
-6
Pixmap.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Pixmap.kt
+37
-38
RSXform.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/RSXform.kt
+14
-11
Region.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Region.kt
+54
-54
Shader.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Shader.kt
+31
-34
SurfaceProps.kt
.../src/commonMain/kotlin/org/jetbrains/skia/SurfaceProps.kt
+1
-2
TextBlob.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/TextBlob.kt
+27
-28
TextLine.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/TextLine.kt
+19
-21
Typeface.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Typeface.kt
+32
-40
WStream.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/WStream.kt
+0
-0
BufferUtil.kt
...c/commonMain/kotlin/org/jetbrains/skia/impl/BufferUtil.kt
+2
-1
Managed.kt
.../src/commonMain/kotlin/org/jetbrains/skia/impl/Managed.kt
+9
-1
Native.kt
...o/src/commonMain/kotlin/org/jetbrains/skia/impl/Native.kt
+3
-1
BidiRun.kt
...rc/commonMain/kotlin/org/jetbrains/skia/shaper/BidiRun.kt
+0
-0
FontMgrRunIterator.kt
...in/kotlin/org/jetbrains/skia/shaper/FontMgrRunIterator.kt
+7
-6
FontRun.kt
...rc/commonMain/kotlin/org/jetbrains/skia/shaper/FontRun.kt
+5
-5
HbIcuScriptRunIterator.kt
...otlin/org/jetbrains/skia/shaper/HbIcuScriptRunIterator.kt
+5
-5
IcuBidiRunIterator.kt
...in/kotlin/org/jetbrains/skia/shaper/IcuBidiRunIterator.kt
+5
-5
LanguageRun.kt
...ommonMain/kotlin/org/jetbrains/skia/shaper/LanguageRun.kt
+3
-3
ManagedRunIterator.kt
...in/kotlin/org/jetbrains/skia/shaper/ManagedRunIterator.kt
+6
-6
RunHandler.kt
...commonMain/kotlin/org/jetbrains/skia/shaper/RunHandler.kt
+0
-0
RunInfo.kt
...rc/commonMain/kotlin/org/jetbrains/skia/shaper/RunInfo.kt
+6
-6
ScriptRun.kt
.../commonMain/kotlin/org/jetbrains/skia/shaper/ScriptRun.kt
+3
-3
Shaper.kt
...src/commonMain/kotlin/org/jetbrains/skia/shaper/Shaper.kt
+21
-30
ShapingOptions.kt
...onMain/kotlin/org/jetbrains/skia/shaper/ShapingOptions.kt
+3
-4
TrivialLanguageRunIterator.kt
...n/org/jetbrains/skia/shaper/TrivialLanguageRunIterator.kt
+0
-0
Actuals.jvm.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Actuals.jvm.kt
+20
-0
Codec.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Codec.kt
+1
-1
PaintFilterCanvas.kt
...rc/jvmMain/kotlin/org/jetbrains/skia/PaintFilterCanvas.kt
+1
-1
PictureRecorder.kt
.../src/jvmMain/kotlin/org/jetbrains/skia/PictureRecorder.kt
+2
-2
RuntimeEffect.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/RuntimeEffect.kt
+1
-1
Surface.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Surface.kt
+2
-2
Native.jvm.kt
.../src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.jvm.kt
+1
-1
StrutStyle.kt
...jvmMain/kotlin/org/jetbrains/skia/paragraph/StrutStyle.kt
+1
-1
TextStyle.kt
.../jvmMain/kotlin/org/jetbrains/skia/paragraph/TextStyle.kt
+3
-3
Library.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
+2
-1
Actuals.native.kt
.../macosX64Main/kotlin/org/jetbrains/skia/Actuals.native.kt
+23
-0
Managed.native.kt
...sX64Main/kotlin/org/jetbrains/skia/impl/Managed.native.kt
+1
-3
Native.native.kt
...osX64Main/kotlin/org/jetbrains/skia/impl/Native.native.kt
+2
-0
No files found.
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Bitmap.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Bitmap.kt
View file @
f794e4bb
...
@@ -2,16 +2,13 @@ package org.jetbrains.skia
...
@@ -2,16 +2,13 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.RuntimeException
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
import
java.nio.ByteBuffer
class
Bitmap
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
),
IHasImageInfo
{
class
Bitmap
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
),
IHasImageInfo
{
companion
object
{
companion
object
{
fun
makeFromImage
(
image
:
Image
):
Bitmap
{
fun
makeFromImage
(
image
:
Image
):
Bitmap
{
assert
(
image
!=
null
)
{
"Can’t makeFromImage with image == null"
}
val
bitmap
=
Bitmap
()
val
bitmap
=
Bitmap
()
bitmap
.
allocPixels
(
image
.
imageInfo
)
bitmap
.
allocPixels
(
image
.
imageInfo
)
return
if
(
image
.
readPixels
(
bitmap
))
bitmap
else
{
return
if
(
image
.
readPixels
(
bitmap
))
bitmap
else
{
...
@@ -139,7 +136,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -139,7 +136,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Bitmap
(
_nMakeClone
(
_ptr
))
Bitmap
(
_nMakeClone
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -152,10 +149,10 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -152,10 +149,10 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
*/
*/
fun
swap
(
other
:
Bitmap
)
{
fun
swap
(
other
:
Bitmap
)
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSwap
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nSwap
(
_ptr
,
getPtr
(
other
))
_imageInfo
=
null
_imageInfo
=
null
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
override
val
imageInfo
:
ImageInfo
override
val
imageInfo
:
ImageInfo
...
@@ -166,7 +163,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -166,7 +163,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
}
}
_imageInfo
!!
_imageInfo
!!
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -180,7 +177,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -180,7 +177,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetRowBytesAsPixels
(
_ptr
)
_nGetRowBytesAsPixels
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -196,7 +193,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -196,7 +193,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsNull
(
_ptr
)
_nIsNull
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -223,7 +220,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -223,7 +220,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetRowBytes
(
_ptr
)
_nGetRowBytes
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -269,7 +266,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -269,7 +266,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
_imageInfo
=
null
_imageInfo
=
null
_nSetAlphaType
(
_ptr
,
alphaType
.
ordinal
)
_nSetAlphaType
(
_ptr
,
alphaType
.
ordinal
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -286,7 +283,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -286,7 +283,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nComputeByteSize
(
_ptr
)
_nComputeByteSize
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -306,7 +303,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -306,7 +303,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsImmutable
(
_ptr
)
_nIsImmutable
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -373,7 +370,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -373,7 +370,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nComputeIsOpaque
(
_ptr
)
_nComputeIsOpaque
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -383,7 +380,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -383,7 +380,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
* @see [https://fiddle.skia.org/c/@Bitmap_getBounds_2](https://fiddle.skia.org/c/@Bitmap_getBounds_2)
* @see [https://fiddle.skia.org/c/@Bitmap_getBounds_2](https://fiddle.skia.org/c/@Bitmap_getBounds_2)
*/
*/
val
bounds
:
IRect
val
bounds
:
IRect
get
()
=
IRect
.
Companion
.
makeXYWH
(
0
,
0
,
width
,
height
)
get
()
=
IRect
.
makeXYWH
(
0
,
0
,
width
,
height
)
/**
/**
* Returns the bounds of this bitmap, offset by its PixelRef origin.
* Returns the bounds of this bitmap, offset by its PixelRef origin.
...
@@ -391,7 +388,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -391,7 +388,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
val
subset
:
IRect
val
subset
:
IRect
get
()
{
get
()
{
val
origin
=
pixelRefOrigin
val
origin
=
pixelRefOrigin
return
IRect
.
Companion
.
makeXYWH
(
origin
.
x
,
origin
.
y
,
width
,
height
)
return
IRect
.
makeXYWH
(
origin
.
x
,
origin
.
y
,
width
,
height
)
}
}
/**
/**
...
@@ -473,12 +470,12 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -473,12 +470,12 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
imageInfo
.
height
,
imageInfo
.
height
,
imageInfo
.
colorInfo
.
colorType
.
ordinal
,
imageInfo
.
colorInfo
.
colorType
.
ordinal
,
imageInfo
.
colorInfo
.
alphaType
.
ordinal
,
imageInfo
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
imageInfo
.
colorInfo
.
colorSpace
),
getPtr
(
imageInfo
.
colorInfo
.
colorSpace
),
rowBytes
rowBytes
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
imageInfo
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
imageInfo
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -515,8 +512,8 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -515,8 +512,8 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
if
(
zeroPixels
)
1
else
0
if
(
zeroPixels
)
1
else
0
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
imageInfo
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
imageInfo
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -550,12 +547,12 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -550,12 +547,12 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
info
.
height
,
info
.
height
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
Companion
.
getPtr
(
info
.
colorInfo
.
colorSpace
),
getPtr
(
info
.
colorInfo
.
colorSpace
),
rowBytes
rowBytes
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
info
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
info
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -615,10 +612,9 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -615,10 +612,9 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
* @param height pixel row count; must be zero or greater
* @param height pixel row count; must be zero or greater
* @return true if pixel storage is allocated
* @return true if pixel storage is allocated
*/
*/
@JvmOverloads
fun
allocN32Pixels
(
width
:
Int
,
height
:
Int
,
opaque
:
Boolean
=
false
):
Boolean
{
fun
allocN32Pixels
(
width
:
Int
,
height
:
Int
,
opaque
:
Boolean
=
false
):
Boolean
{
return
allocPixels
(
return
allocPixels
(
ImageInfo
.
Companion
.
makeN32
(
ImageInfo
.
makeN32
(
width
,
width
,
height
,
height
,
if
(
opaque
)
ColorAlphaType
.
OPAQUE
else
ColorAlphaType
.
PREMUL
if
(
opaque
)
ColorAlphaType
.
OPAQUE
else
ColorAlphaType
.
PREMUL
...
@@ -658,13 +654,13 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -658,13 +654,13 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
info
.
height
,
info
.
height
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
info
.
colorInfo
.
colorSpace
),
getPtr
(
info
.
colorInfo
.
colorSpace
),
pixels
,
pixels
,
rowBytes
rowBytes
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
info
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
info
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -684,7 +680,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -684,7 +680,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAllocPixels
(
_ptr
)
_nAllocPixels
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -702,7 +698,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -702,7 +698,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
val
res
=
_nGetPixelRef
(
_ptr
)
val
res
=
_nGetPixelRef
(
_ptr
)
if
(
res
==
0L
)
null
else
PixelRef
(
res
)
if
(
res
==
0L
)
null
else
PixelRef
(
res
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -728,7 +724,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -728,7 +724,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
val
res
=
_nGetPixelRefOrigin
(
_ptr
)
val
res
=
_nGetPixelRefOrigin
(
_ptr
)
IPoint
((
res
and
-
0
x1
).
toInt
(),
(
res
ushr
32
).
toInt
())
IPoint
((
res
and
-
0
x1
).
toInt
(),
(
res
ushr
32
).
toInt
())
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -756,13 +752,13 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -756,13 +752,13 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetPixelRef
(
_nSetPixelRef
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
pixelRef
),
getPtr
(
pixelRef
),
dx
,
dx
,
dy
dy
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
pixelRef
)
reachabilityBarrier
(
pixelRef
)
}
}
}
}
...
@@ -776,7 +772,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -776,7 +772,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsReadyToDraw
(
_ptr
)
_nIsReadyToDraw
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -797,7 +793,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -797,7 +793,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetGenerationId
(
_ptr
)
_nGetGenerationId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -813,7 +809,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -813,7 +809,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
_nNotifyPixelsChanged
(
_ptr
)
_nNotifyPixelsChanged
(
_ptr
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -833,7 +829,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -833,7 +829,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
_nEraseColor
(
_ptr
,
color
)
_nEraseColor
(
_ptr
,
color
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -856,7 +852,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -856,7 +852,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
_nErase
(
_ptr
,
color
,
area
.
left
,
area
.
top
,
area
.
right
,
area
.
bottom
)
_nErase
(
_ptr
,
color
,
area
.
left
,
area
.
top
,
area
.
right
,
area
.
bottom
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -884,7 +880,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -884,7 +880,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetColor
(
_ptr
,
x
,
y
)
_nGetColor
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -903,7 +899,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -903,7 +899,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetAlphaf
(
_ptr
,
x
,
y
)
_nGetAlphaf
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -939,15 +935,15 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -939,15 +935,15 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nExtractSubset
(
_nExtractSubset
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
subset
.
left
,
subset
.
left
,
subset
.
top
,
subset
.
top
,
subset
.
right
,
subset
.
right
,
subset
.
bottom
subset
.
bottom
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
}
}
}
}
...
@@ -985,7 +981,6 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -985,7 +981,6 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
* @param srcY row index whose absolute value is less than height()
* @param srcY row index whose absolute value is less than height()
* @return pixel data or null
* @return pixel data or null
*/
*/
@JvmOverloads
fun
readPixels
(
fun
readPixels
(
dstInfo
:
ImageInfo
=
imageInfo
,
dstInfo
:
ImageInfo
=
imageInfo
,
dstRowBytes
:
Long
=
rowBytes
,
dstRowBytes
:
Long
=
rowBytes
,
...
@@ -1000,14 +995,14 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -1000,14 +995,14 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
dstInfo
.
height
,
dstInfo
.
height
,
dstInfo
.
colorInfo
.
colorType
.
ordinal
,
dstInfo
.
colorInfo
.
colorType
.
ordinal
,
dstInfo
.
colorInfo
.
alphaType
.
ordinal
,
dstInfo
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
dstInfo
.
colorInfo
.
colorSpace
),
getPtr
(
dstInfo
.
colorInfo
.
colorSpace
),
dstRowBytes
,
dstRowBytes
,
srcX
,
srcX
,
srcY
srcY
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
dstInfo
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
dstInfo
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -1042,13 +1037,13 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -1042,13 +1037,13 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nExtractAlpha
(
_nExtractAlpha
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
}
}
}
}
...
@@ -1065,12 +1060,12 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -1065,12 +1060,12 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nPeekPixels
(
_ptr
)
_nPeekPixels
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
fun
makeShader
(
localMatrix
:
Matrix33
?):
Shader
{
fun
makeShader
(
localMatrix
:
Matrix33
?):
Shader
{
return
makeShader
(
FilterTileMode
.
CLAMP
,
FilterTileMode
.
CLAMP
,
SamplingMode
.
Companion
.
DEFAULT
,
localMatrix
)
return
makeShader
(
FilterTileMode
.
CLAMP
,
FilterTileMode
.
CLAMP
,
SamplingMode
.
DEFAULT
,
localMatrix
)
}
}
fun
makeShader
(
fun
makeShader
(
...
@@ -1078,10 +1073,9 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -1078,10 +1073,9 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
tmy
:
FilterTileMode
,
tmy
:
FilterTileMode
,
localMatrix
:
Matrix33
?
localMatrix
:
Matrix33
?
):
Shader
{
):
Shader
{
return
makeShader
(
tmx
,
tmy
,
SamplingMode
.
Companion
.
DEFAULT
,
localMatrix
)
return
makeShader
(
tmx
,
tmy
,
SamplingMode
.
DEFAULT
,
localMatrix
)
}
}
@JvmOverloads
fun
makeShader
(
fun
makeShader
(
tmx
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
tmx
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
tmy
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
tmy
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
...
@@ -1089,9 +1083,9 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -1089,9 +1083,9 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
localMatrix
:
Matrix33
?
=
null
localMatrix
:
Matrix33
?
=
null
):
Shader
{
):
Shader
{
return
try
{
return
try
{
assert
(
tmx
!=
null
)
{
"Can’t Bitmap.makeShader with tmx == null"
}
require
(
tmx
!=
null
)
{
"Can’t Bitmap.makeShader with tmx == null"
}
assert
(
tmy
!=
null
)
{
"Can’t Bitmap.makeShader with tmy == null"
}
require
(
tmy
!=
null
)
{
"Can’t Bitmap.makeShader with tmy == null"
}
assert
(
sampling
!=
null
)
{
"Can’t Bitmap.makeShader with sampling == null"
}
require
(
sampling
!=
null
)
{
"Can’t Bitmap.makeShader with sampling == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shader
(
Shader
(
_nMakeShader
(
_nMakeShader
(
...
@@ -1103,7 +1097,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -1103,7 +1097,7 @@ class Bitmap internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Canvas.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Canvas.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.ImageFilter.Companion.makeDropShadowOnly
import
org.jetbrains.skia.ImageFilter.Companion.makeDropShadowOnly
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
org.jetbrains.skia.impl.use
import
kotlin.jvm.JvmStatic
open
class
Canvas
internal
constructor
(
ptr
:
Long
,
managed
:
Boolean
,
internal
val
_owner
:
Any
)
:
open
class
Canvas
internal
constructor
(
ptr
:
Long
,
managed
:
Boolean
,
internal
val
_owner
:
Any
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
,
managed
)
{
Managed
(
ptr
,
_FinalizerHolder
.
PTR
,
managed
)
{
companion
object
{
companion
object
{
@JvmStatic
external
fun
_nGetFinalizer
():
Long
@JvmStatic
@JvmStatic
external
fun
_nMakeFromBitmap
(
bitmapPtr
:
Long
,
flags
:
Int
,
pixelGeometry
:
Int
):
Long
external
fun
_nGetFinalizer
():
Long
@JvmStatic
external
fun
_nDrawPoint
(
ptr
:
Long
,
x
:
Float
,
y
:
Float
,
paintPtr
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nDrawPoints
(
ptr
:
Long
,
mode
:
Int
,
coords
:
FloatArray
?,
paintPtr
:
Long
)
external
fun
_nMakeFromBitmap
(
bitmapPtr
:
Long
,
flags
:
Int
,
pixelGeometry
:
Int
):
Long
@JvmStatic
external
fun
_nDrawLine
(
ptr
:
Long
,
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
paintPtr
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nDrawArc
(
external
fun
_nDrawPoint
(
ptr
:
Long
,
x
:
Float
,
y
:
Float
,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawPoints
(
ptr
:
Long
,
mode
:
Int
,
coords
:
FloatArray
?,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawLine
(
ptr
:
Long
,
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawArc
(
ptr
:
Long
,
ptr
:
Long
,
left
:
Float
,
left
:
Float
,
top
:
Float
,
top
:
Float
,
...
@@ -27,9 +34,12 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -27,9 +34,12 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
)
)
@JvmStatic
external
fun
_nDrawRect
(
ptr
:
Long
,
left
:
Float
,
top
:
Float
,
right
:
Float
,
bottom
:
Float
,
paintPtr
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nDrawOval
(
ptr
:
Long
,
left
:
Float
,
top
:
Float
,
right
:
Float
,
bottom
:
Float
,
paint
:
Long
)
external
fun
_nDrawRect
(
ptr
:
Long
,
left
:
Float
,
top
:
Float
,
right
:
Float
,
bottom
:
Float
,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawRRect
(
@JvmStatic
external
fun
_nDrawOval
(
ptr
:
Long
,
left
:
Float
,
top
:
Float
,
right
:
Float
,
bottom
:
Float
,
paint
:
Long
)
@JvmStatic
external
fun
_nDrawRRect
(
ptr
:
Long
,
ptr
:
Long
,
left
:
Float
,
left
:
Float
,
top
:
Float
,
top
:
Float
,
...
@@ -39,7 +49,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -39,7 +49,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
)
)
@JvmStatic
external
fun
_nDrawDRRect
(
@JvmStatic
external
fun
_nDrawDRRect
(
ptr
:
Long
,
ptr
:
Long
,
ol
:
Float
,
ol
:
Float
,
ot
:
Float
,
ot
:
Float
,
...
@@ -54,8 +65,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -54,8 +65,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
)
)
@JvmStatic
external
fun
_nDrawPath
(
ptr
:
Long
,
nativePath
:
Long
,
paintPtr
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nDrawImageRect
(
external
fun
_nDrawPath
(
ptr
:
Long
,
nativePath
:
Long
,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawImageRect
(
ptr
:
Long
,
ptr
:
Long
,
nativeImage
:
Long
,
nativeImage
:
Long
,
sl
:
Float
,
sl
:
Float
,
...
@@ -71,7 +84,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -71,7 +84,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
strict
:
Boolean
strict
:
Boolean
)
)
@JvmStatic
external
fun
_nDrawImageNine
(
@JvmStatic
external
fun
_nDrawImageNine
(
ptr
:
Long
,
ptr
:
Long
,
nativeImage
:
Long
,
nativeImage
:
Long
,
cl
:
Int
,
cl
:
Int
,
...
@@ -86,11 +100,16 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -86,11 +100,16 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
)
)
@JvmStatic
external
fun
_nDrawRegion
(
ptr
:
Long
,
nativeRegion
:
Long
,
paintPtr
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nDrawString
(
ptr
:
Long
,
string
:
String
?,
x
:
Float
,
y
:
Float
,
font
:
Long
,
paint
:
Long
)
external
fun
_nDrawRegion
(
ptr
:
Long
,
nativeRegion
:
Long
,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawTextBlob
(
ptr
:
Long
,
blob
:
Long
,
x
:
Float
,
y
:
Float
,
paint
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nDrawPicture
(
ptr
:
Long
,
picturePtr
:
Long
,
matrix
:
FloatArray
?,
paintPtr
:
Long
)
external
fun
_nDrawString
(
ptr
:
Long
,
string
:
String
?,
x
:
Float
,
y
:
Float
,
font
:
Long
,
paint
:
Long
)
@JvmStatic
external
fun
_nDrawVertices
(
@JvmStatic
external
fun
_nDrawTextBlob
(
ptr
:
Long
,
blob
:
Long
,
x
:
Float
,
y
:
Float
,
paint
:
Long
)
@JvmStatic
external
fun
_nDrawPicture
(
ptr
:
Long
,
picturePtr
:
Long
,
matrix
:
FloatArray
?,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nDrawVertices
(
ptr
:
Long
,
ptr
:
Long
,
verticesMode
:
Int
,
verticesMode
:
Int
,
cubics
:
FloatArray
?,
cubics
:
FloatArray
?,
...
@@ -101,7 +120,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -101,7 +120,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
)
)
@JvmStatic
external
fun
_nDrawPatch
(
@JvmStatic
external
fun
_nDrawPatch
(
ptr
:
Long
,
ptr
:
Long
,
cubics
:
FloatArray
?,
cubics
:
FloatArray
?,
colors
:
IntArray
?,
colors
:
IntArray
?,
...
@@ -110,13 +130,20 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -110,13 +130,20 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
)
)
@JvmStatic
external
fun
_nDrawDrawable
(
ptr
:
Long
,
drawablePrt
:
Long
,
matrix
:
FloatArray
?)
@JvmStatic
@JvmStatic
external
fun
_nClear
(
ptr
:
Long
,
color
:
Int
)
external
fun
_nDrawDrawable
(
ptr
:
Long
,
drawablePrt
:
Long
,
matrix
:
FloatArray
?)
@JvmStatic
external
fun
_nDrawPaint
(
ptr
:
Long
,
paintPtr
:
Long
)
@JvmStatic
@JvmStatic
external
fun
_nSetMatrix
(
ptr
:
Long
,
matrix
:
FloatArray
?)
external
fun
_nClear
(
ptr
:
Long
,
color
:
Int
)
@JvmStatic
external
fun
_nGetLocalToDevice
(
ptr
:
Long
):
FloatArray
@JvmStatic
@JvmStatic
external
fun
_nResetMatrix
(
ptr
:
Long
)
external
fun
_nDrawPaint
(
ptr
:
Long
,
paintPtr
:
Long
)
@JvmStatic
external
fun
_nClipRect
(
@JvmStatic
external
fun
_nSetMatrix
(
ptr
:
Long
,
matrix
:
FloatArray
?)
@JvmStatic
external
fun
_nGetLocalToDevice
(
ptr
:
Long
):
FloatArray
@JvmStatic
external
fun
_nResetMatrix
(
ptr
:
Long
)
@JvmStatic
external
fun
_nClipRect
(
ptr
:
Long
,
ptr
:
Long
,
left
:
Float
,
left
:
Float
,
top
:
Float
,
top
:
Float
,
...
@@ -126,7 +153,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -126,7 +153,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
antiAlias
:
Boolean
antiAlias
:
Boolean
)
)
@JvmStatic
external
fun
_nClipRRect
(
@JvmStatic
external
fun
_nClipRRect
(
ptr
:
Long
,
ptr
:
Long
,
left
:
Float
,
left
:
Float
,
top
:
Float
,
top
:
Float
,
...
@@ -137,15 +165,24 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -137,15 +165,24 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
antiAlias
:
Boolean
antiAlias
:
Boolean
)
)
@JvmStatic
external
fun
_nClipPath
(
ptr
:
Long
,
nativePath
:
Long
,
mode
:
Int
,
antiAlias
:
Boolean
)
@JvmStatic
@JvmStatic
external
fun
_nClipRegion
(
ptr
:
Long
,
nativeRegion
:
Long
,
mode
:
Int
)
external
fun
_nClipPath
(
ptr
:
Long
,
nativePath
:
Long
,
mode
:
Int
,
antiAlias
:
Boolean
)
@JvmStatic
external
fun
_nConcat
(
ptr
:
Long
,
matrix
:
FloatArray
?)
@JvmStatic
@JvmStatic
external
fun
_nConcat44
(
ptr
:
Long
,
matrix
:
FloatArray
?)
external
fun
_nClipRegion
(
ptr
:
Long
,
nativeRegion
:
Long
,
mode
:
Int
)
@JvmStatic
external
fun
_nReadPixels
(
ptr
:
Long
,
bitmapPtr
:
Long
,
srcX
:
Int
,
srcY
:
Int
):
Boolean
@JvmStatic
@JvmStatic
external
fun
_nWritePixels
(
ptr
:
Long
,
bitmapPtr
:
Long
,
x
:
Int
,
y
:
Int
):
Boolean
external
fun
_nConcat
(
ptr
:
Long
,
matrix
:
FloatArray
?)
@JvmStatic
external
fun
_nSave
(
ptr
:
Long
):
Int
@JvmStatic
@JvmStatic
external
fun
_nSaveLayer
(
ptr
:
Long
,
paintPtr
:
Long
):
Int
external
fun
_nConcat44
(
ptr
:
Long
,
matrix
:
FloatArray
?)
@JvmStatic
external
fun
_nSaveLayerRect
(
@JvmStatic
external
fun
_nReadPixels
(
ptr
:
Long
,
bitmapPtr
:
Long
,
srcX
:
Int
,
srcY
:
Int
):
Boolean
@JvmStatic
external
fun
_nWritePixels
(
ptr
:
Long
,
bitmapPtr
:
Long
,
x
:
Int
,
y
:
Int
):
Boolean
@JvmStatic
external
fun
_nSave
(
ptr
:
Long
):
Int
@JvmStatic
external
fun
_nSaveLayer
(
ptr
:
Long
,
paintPtr
:
Long
):
Int
@JvmStatic
external
fun
_nSaveLayerRect
(
ptr
:
Long
,
ptr
:
Long
,
left
:
Float
,
left
:
Float
,
top
:
Float
,
top
:
Float
,
...
@@ -154,9 +191,12 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -154,9 +191,12 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
paintPtr
:
Long
paintPtr
:
Long
):
Int
):
Int
@JvmStatic
external
fun
_nGetSaveCount
(
ptr
:
Long
):
Int
@JvmStatic
@JvmStatic
external
fun
_nRestore
(
ptr
:
Long
)
external
fun
_nGetSaveCount
(
ptr
:
Long
):
Int
@JvmStatic
external
fun
_nRestoreToCount
(
ptr
:
Long
,
saveCount
:
Int
)
@JvmStatic
external
fun
_nRestore
(
ptr
:
Long
)
@JvmStatic
external
fun
_nRestoreToCount
(
ptr
:
Long
,
saveCount
:
Int
)
init
{
init
{
staticLoad
()
staticLoad
()
...
@@ -195,7 +235,6 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -195,7 +235,6 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap](https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap)
* @see [https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap](https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap)
*/
*/
@JvmOverloads
constructor
(
bitmap
:
Bitmap
,
surfaceProps
:
SurfaceProps
=
SurfaceProps
())
:
this
(
constructor
(
bitmap
:
Bitmap
,
surfaceProps
:
SurfaceProps
=
SurfaceProps
())
:
this
(
_nMakeFromBitmap
(
_nMakeFromBitmap
(
bitmap
.
_ptr
,
bitmap
.
_ptr
,
...
@@ -204,14 +243,13 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -204,14 +243,13 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
),
true
,
bitmap
),
true
,
bitmap
)
{
)
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
bitmap
)
reachabilityBarrier
(
bitmap
)
}
}
fun
drawPoint
(
x
:
Float
,
y
:
Float
,
paint
:
Paint
):
Canvas
{
fun
drawPoint
(
x
:
Float
,
y
:
Float
,
paint
:
Paint
):
Canvas
{
assert
(
paint
!=
null
)
{
"Can’t drawPoint with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPoint
(
_ptr
,
x
,
y
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPoint
(
_ptr
,
x
,
y
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -241,7 +279,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -241,7 +279,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
*/
*/
fun
drawPoints
(
coords
:
Array
<
Point
>,
paint
:
Paint
):
Canvas
{
fun
drawPoints
(
coords
:
Array
<
Point
>,
paint
:
Paint
):
Canvas
{
return
drawPoints
(
Point
.
Companion
.
flattenArray
(
coords
)
!!
,
paint
)
return
drawPoints
(
Point
.
flattenArray
(
coords
)
!!
,
paint
)
}
}
/**
/**
...
@@ -269,12 +307,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -269,12 +307,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
*/
*/
fun
drawPoints
(
coords
:
FloatArray
,
paint
:
Paint
):
Canvas
{
fun
drawPoints
(
coords
:
FloatArray
,
paint
:
Paint
):
Canvas
{
assert
(
coords
!=
null
)
{
"Can’t drawPoints with coords == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawPoints with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPoints
(
_ptr
,
0
/* SkCanvas::PointMode::kPoints_PointMode */
,
coords
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPoints
(
_ptr
,
0
/* SkCanvas::PointMode::kPoints_PointMode */
,
coords
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -301,8 +337,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -301,8 +337,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
*/
*/
fun
drawLines
(
coords
:
Array
<
Point
>,
paint
:
Paint
):
Canvas
{
fun
drawLines
(
coords
:
Array
<
Point
>,
paint
:
Paint
):
Canvas
{
return
drawLines
(
Point
.
Companion
.
flattenArray
(
coords
)
!!
,
paint
)
return
drawLines
(
Point
.
flattenArray
(
coords
)
!!
,
paint
)
}
}
/**
/**
...
@@ -328,12 +364,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -328,12 +364,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
*/
*/
fun
drawLines
(
coords
:
FloatArray
,
paint
:
Paint
):
Canvas
{
fun
drawLines
(
coords
:
FloatArray
,
paint
:
Paint
):
Canvas
{
assert
(
coords
!=
null
)
{
"Can’t drawLines with coords == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawLines with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPoints
(
_ptr
,
1
/* SkCanvas::PointMode::kLines_PointMode */
,
coords
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPoints
(
_ptr
,
1
/* SkCanvas::PointMode::kLines_PointMode */
,
coords
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -359,8 +393,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -359,8 +393,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
*/
*/
fun
drawPolygon
(
coords
:
Array
<
Point
>,
paint
:
Paint
):
Canvas
{
fun
drawPolygon
(
coords
:
Array
<
Point
>,
paint
:
Paint
):
Canvas
{
return
drawPolygon
(
Point
.
Companion
.
flattenArray
(
coords
)
!!
,
paint
)
return
drawPolygon
(
Point
.
flattenArray
(
coords
)
!!
,
paint
)
}
}
/**
/**
...
@@ -385,24 +419,24 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -385,24 +419,24 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
* @see [https://fiddle.skia.org/c/@Canvas_drawPoints](https://fiddle.skia.org/c/@Canvas_drawPoints)
*/
*/
fun
drawPolygon
(
coords
:
FloatArray
,
paint
:
Paint
):
Canvas
{
fun
drawPolygon
(
coords
:
FloatArray
,
paint
:
Paint
):
Canvas
{
assert
(
coords
!=
null
)
{
"Can’t drawPolygon with coords == null"
}
require
(
coords
!=
null
)
{
"Can’t drawPolygon with coords == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawPolygon with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawPolygon with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPoints
(
_ptr
,
2
/* SkCanvas::PointMode::kPolygon_PointMode */
,
coords
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPoints
(
_ptr
,
2
/* SkCanvas::PointMode::kPolygon_PointMode */
,
coords
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawLine
(
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
paint
:
Paint
):
Canvas
{
fun
drawLine
(
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
paint
:
Paint
):
Canvas
{
assert
(
paint
!=
null
)
{
"Can’t drawLine with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawLine with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawLine
(
_ptr
,
x0
,
y0
,
x1
,
y1
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawLine
(
_ptr
,
x0
,
y0
,
x1
,
y1
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawArc
(
fun
drawArc
(
left
:
Float
,
left
:
Float
,
top
:
Float
,
top
:
Float
,
right
:
Float
,
right
:
Float
,
...
@@ -412,52 +446,52 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -412,52 +446,52 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
includeCenter
:
Boolean
,
includeCenter
:
Boolean
,
paint
:
Paint
paint
:
Paint
):
Canvas
{
):
Canvas
{
assert
(
paint
!=
null
)
{
"Can’t drawArc with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawArc with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawArc
(
_ptr
,
left
,
top
,
right
,
bottom
,
startAngle
,
sweepAngle
,
includeCenter
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawArc
(
_ptr
,
left
,
top
,
right
,
bottom
,
startAngle
,
sweepAngle
,
includeCenter
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawRect
(
r
:
Rect
,
paint
:
Paint
):
Canvas
{
fun
drawRect
(
r
:
Rect
,
paint
:
Paint
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t drawRect with r == null"
}
require
(
r
!=
null
)
{
"Can’t drawRect with r == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawRect with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawRect with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawOval
(
r
:
Rect
,
paint
:
Paint
):
Canvas
{
fun
drawOval
(
r
:
Rect
,
paint
:
Paint
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t drawOval with r == null"
}
require
(
r
!=
null
)
{
"Can’t drawOval with r == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawOval with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawOval with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawOval
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawOval
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawCircle
(
x
:
Float
,
y
:
Float
,
radius
:
Float
,
paint
:
Paint
):
Canvas
{
fun
drawCircle
(
x
:
Float
,
y
:
Float
,
radius
:
Float
,
paint
:
Paint
):
Canvas
{
assert
(
paint
!=
null
)
{
"Can’t drawCircle with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawCircle with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawOval
(
_ptr
,
x
-
radius
,
y
-
radius
,
x
+
radius
,
y
+
radius
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawOval
(
_ptr
,
x
-
radius
,
y
-
radius
,
x
+
radius
,
y
+
radius
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawRRect
(
r
:
RRect
,
paint
:
Paint
):
Canvas
{
fun
drawRRect
(
r
:
RRect
,
paint
:
Paint
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t drawRRect with r == null"
}
require
(
r
!=
null
)
{
"Can’t drawRRect with r == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawRRect with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawRRect with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawRRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
r
.
radii
,
Native
.
getPtr
(
paint
))
_nDrawRRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
r
.
radii
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawDRRect
(
outer
:
RRect
,
inner
:
RRect
,
paint
:
Paint
):
Canvas
{
fun
drawDRRect
(
outer
:
RRect
,
inner
:
RRect
,
paint
:
Paint
):
Canvas
{
assert
(
outer
!=
null
)
{
"Can’t drawDRRect with outer == null"
}
require
(
outer
!=
null
)
{
"Can’t drawDRRect with outer == null"
}
assert
(
inner
!=
null
)
{
"Can’t drawDRRect with inner == null"
}
require
(
inner
!=
null
)
{
"Can’t drawDRRect with inner == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawDRRect with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawDRRect with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawDRRect
(
_nDrawDRRect
(
_ptr
,
_ptr
,
...
@@ -471,18 +505,18 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -471,18 +505,18 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
inner
.
right
,
inner
.
right
,
inner
.
bottom
,
inner
.
bottom
,
inner
.
radii
,
inner
.
radii
,
Native
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawRectShadow
(
r
:
Rect
,
dx
:
Float
,
dy
:
Float
,
blur
:
Float
,
color
:
Int
):
Canvas
{
fun
drawRectShadow
(
r
:
Rect
,
dx
:
Float
,
dy
:
Float
,
blur
:
Float
,
color
:
Int
):
Canvas
{
return
drawRectShadow
(
r
,
dx
,
dy
,
blur
,
0f
,
color
)
return
drawRectShadow
(
r
,
dx
,
dy
,
blur
,
0f
,
color
)
}
}
fun
drawRectShadow
(
r
:
Rect
,
dx
:
Float
,
dy
:
Float
,
blur
:
Float
,
spread
:
Float
,
color
:
Int
):
Canvas
{
fun
drawRectShadow
(
r
:
Rect
,
dx
:
Float
,
dy
:
Float
,
blur
:
Float
,
spread
:
Float
,
color
:
Int
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t drawRectShadow with r == null"
}
require
(
r
!=
null
)
{
"Can’t drawRectShadow with r == null"
}
val
insides
=
r
.
inflate
(-
1f
)
val
insides
=
r
.
inflate
(-
1f
)
if
(!
insides
.
isEmpty
)
{
if
(!
insides
.
isEmpty
)
{
save
()
save
()
...
@@ -493,11 +527,11 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -493,11 +527,11 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
return
this
return
this
}
}
fun
drawRectShadowNoclip
(
r
:
Rect
,
dx
:
Float
,
dy
:
Float
,
blur
:
Float
,
spread
:
Float
,
color
:
Int
):
Canvas
{
fun
drawRectShadowNoclip
(
r
:
Rect
,
dx
:
Float
,
dy
:
Float
,
blur
:
Float
,
spread
:
Float
,
color
:
Int
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t drawRectShadow with r == null"
}
require
(
r
!=
null
)
{
"Can’t drawRectShadow with r == null"
}
val
outline
=
r
.
inflate
(
spread
)
val
outline
=
r
.
inflate
(
spread
)
makeDropShadowOnly
(
dx
,
dy
,
blur
/
2f
,
blur
/
2f
,
color
).
use
{
f
->
makeDropShadowOnly
(
dx
,
dy
,
blur
/
2f
,
blur
/
2f
,
color
).
use
{
f
->
org
.
jetbrains
.
skia
.
Paint
().
use
{
p
->
Paint
().
use
{
p
->
p
.
setImageFilter
(
f
)
p
.
setImageFilter
(
f
)
if
(
outline
is
RRect
)
drawRRect
(
outline
,
p
)
else
drawRect
(
outline
,
p
)
if
(
outline
is
RRect
)
drawRRect
(
outline
,
p
)
else
drawRect
(
outline
,
p
)
}
}
...
@@ -505,50 +539,48 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -505,50 +539,48 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
return
this
return
this
}
}
fun
drawPath
(
path
:
Path
,
paint
:
Paint
):
Canvas
{
fun
drawPath
(
path
:
Path
,
paint
:
Paint
):
Canvas
{
assert
(
path
!=
null
)
{
"Can’t drawPath with path == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawPath with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPath
(
_ptr
,
Native
.
Companion
.
getPtr
(
path
),
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPath
(
_ptr
,
getPtr
(
path
),
getPtr
(
paint
))
Reference
.
reachabilityFence
(
path
)
reachabilityBarrier
(
path
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawImage
(
image
:
Image
,
left
:
Float
,
top
:
Float
):
Canvas
{
fun
drawImage
(
image
:
Image
,
left
:
Float
,
top
:
Float
):
Canvas
{
return
drawImageRect
(
return
drawImageRect
(
image
,
image
,
Rect
.
Companion
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
Companion
.
makeXYWH
(
left
,
top
,
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeXYWH
(
left
,
top
,
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
SamplingMode
.
Companion
.
DEFAULT
,
SamplingMode
.
DEFAULT
,
null
,
null
,
true
true
)
)
}
}
fun
drawImage
(
image
:
Image
,
left
:
Float
,
top
:
Float
,
paint
:
Paint
?):
Canvas
{
fun
drawImage
(
image
:
Image
,
left
:
Float
,
top
:
Float
,
paint
:
Paint
?):
Canvas
{
return
drawImageRect
(
return
drawImageRect
(
image
,
image
,
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeXYWH
(
left
,
top
,
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeXYWH
(
left
,
top
,
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
SamplingMode
.
Companion
.
DEFAULT
,
SamplingMode
.
DEFAULT
,
paint
,
paint
,
true
true
)
)
}
}
fun
drawImageRect
(
image
:
Image
,
dst
:
Rect
):
Canvas
{
fun
drawImageRect
(
image
:
Image
,
dst
:
Rect
):
Canvas
{
return
drawImageRect
(
return
drawImageRect
(
image
,
image
,
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
dst
,
dst
,
SamplingMode
.
Companion
.
DEFAULT
,
SamplingMode
.
DEFAULT
,
null
,
null
,
true
true
)
)
}
}
fun
drawImageRect
(
image
:
Image
,
dst
:
Rect
,
paint
:
Paint
?):
Canvas
{
fun
drawImageRect
(
image
:
Image
,
dst
:
Rect
,
paint
:
Paint
?):
Canvas
{
return
drawImageRect
(
return
drawImageRect
(
image
,
image
,
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
()),
...
@@ -559,34 +591,34 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -559,34 +591,34 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
)
)
}
}
fun
drawImageRect
(
image
:
Image
,
src
:
Rect
,
dst
:
Rect
):
Canvas
{
fun
drawImageRect
(
image
:
Image
,
src
:
Rect
,
dst
:
Rect
):
Canvas
{
return
drawImageRect
(
image
,
src
,
dst
,
SamplingMode
.
DEFAULT
,
null
,
true
)
return
drawImageRect
(
image
,
src
,
dst
,
SamplingMode
.
DEFAULT
,
null
,
true
)
}
}
fun
drawImageRect
(
image
:
Image
,
src
:
Rect
,
dst
:
Rect
,
paint
:
Paint
?):
Canvas
{
fun
drawImageRect
(
image
:
Image
,
src
:
Rect
,
dst
:
Rect
,
paint
:
Paint
?):
Canvas
{
return
drawImageRect
(
image
,
src
,
dst
,
SamplingMode
.
DEFAULT
,
paint
,
true
)
return
drawImageRect
(
image
,
src
,
dst
,
SamplingMode
.
DEFAULT
,
paint
,
true
)
}
}
fun
drawImageRect
(
image
:
Image
,
src
:
Rect
,
dst
:
Rect
,
paint
:
Paint
?,
strict
:
Boolean
):
Canvas
{
fun
drawImageRect
(
image
:
Image
,
src
:
Rect
,
dst
:
Rect
,
paint
:
Paint
?,
strict
:
Boolean
):
Canvas
{
return
drawImageRect
(
image
,
src
,
dst
,
SamplingMode
.
DEFAULT
,
paint
,
strict
)
return
drawImageRect
(
image
,
src
,
dst
,
SamplingMode
.
DEFAULT
,
paint
,
strict
)
}
}
fun
drawImageRect
(
fun
drawImageRect
(
image
:
Image
,
image
:
Image
,
src
:
Rect
,
src
:
Rect
,
dst
:
Rect
,
dst
:
Rect
,
samplingMode
:
SamplingMode
,
samplingMode
:
SamplingMode
,
paint
:
Paint
?,
paint
:
Paint
?,
strict
:
Boolean
strict
:
Boolean
):
Canvas
{
):
Canvas
{
assert
(
image
!=
null
)
{
"Can’t drawImageRect with image == null"
}
require
(
image
!=
null
)
{
"Can’t drawImageRect with image == null"
}
assert
(
src
!=
null
)
{
"Can’t drawImageRect with src == null"
}
require
(
src
!=
null
)
{
"Can’t drawImageRect with src == null"
}
assert
(
dst
!=
null
)
{
"Can’t drawImageRect with dst == null"
}
require
(
dst
!=
null
)
{
"Can’t drawImageRect with dst == null"
}
assert
(
samplingMode
!=
null
)
{
"Can’t drawImageRect with samplingMode == null"
}
require
(
samplingMode
!=
null
)
{
"Can’t drawImageRect with samplingMode == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawImageRect
(
_nDrawImageRect
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
image
),
getPtr
(
image
),
src
.
left
,
src
.
left
,
src
.
top
,
src
.
top
,
src
.
right
,
src
.
right
,
...
@@ -596,23 +628,23 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -596,23 +628,23 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
dst
.
right
,
dst
.
right
,
dst
.
bottom
,
dst
.
bottom
,
samplingMode
.
_pack
(),
samplingMode
.
_pack
(),
Native
.
Companion
.
getPtr
(
paint
),
getPtr
(
paint
),
strict
strict
)
)
Reference
.
reachabilityFence
(
image
)
reachabilityBarrier
(
image
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawImageNine
(
image
:
Image
,
center
:
IRect
,
dst
:
Rect
,
filterMode
:
FilterMode
,
paint
:
Paint
?):
Canvas
{
fun
drawImageNine
(
image
:
Image
,
center
:
IRect
,
dst
:
Rect
,
filterMode
:
FilterMode
,
paint
:
Paint
?):
Canvas
{
assert
(
image
!=
null
)
{
"Can’t drawImageNine with image == null"
}
require
(
image
!=
null
)
{
"Can’t drawImageNine with image == null"
}
assert
(
center
!=
null
)
{
"Can’t drawImageNine with center == null"
}
require
(
center
!=
null
)
{
"Can’t drawImageNine with center == null"
}
assert
(
dst
!=
null
)
{
"Can’t drawImageNine with dst == null"
}
require
(
dst
!=
null
)
{
"Can’t drawImageNine with dst == null"
}
assert
(
filterMode
!=
null
)
{
"Can’t drawImageNine with filterMode == null"
}
require
(
filterMode
!=
null
)
{
"Can’t drawImageNine with filterMode == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawImageNine
(
_nDrawImageNine
(
_ptr
,
_ptr
,
Native
.
getPtr
(
image
),
getPtr
(
image
),
center
.
left
,
center
.
left
,
center
.
top
,
center
.
top
,
center
.
right
,
center
.
right
,
...
@@ -622,47 +654,47 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -622,47 +654,47 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
dst
.
right
,
dst
.
right
,
dst
.
bottom
,
dst
.
bottom
,
filterMode
.
ordinal
,
filterMode
.
ordinal
,
Native
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
Reference
.
reachabilityFence
(
image
)
reachabilityBarrier
(
image
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawRegion
(
r
:
Region
,
paint
:
Paint
):
Canvas
{
fun
drawRegion
(
r
:
Region
,
paint
:
Paint
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t drawRegion with r == null"
}
require
(
r
!=
null
)
{
"Can’t drawRegion with r == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawRegion with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawRegion with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawRegion
(
_ptr
,
Native
.
Companion
.
getPtr
(
r
),
Native
.
Companion
.
getPtr
(
paint
))
_nDrawRegion
(
_ptr
,
getPtr
(
r
),
getPtr
(
paint
))
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawString
(
s
:
String
,
x
:
Float
,
y
:
Float
,
font
:
Font
?,
paint
:
Paint
):
Canvas
{
fun
drawString
(
s
:
String
,
x
:
Float
,
y
:
Float
,
font
:
Font
?,
paint
:
Paint
):
Canvas
{
assert
(
s
!=
null
)
{
"Can’t drawString with s == null"
}
require
(
s
!=
null
)
{
"Can’t drawString with s == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawString with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawString with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawString
(
_ptr
,
s
,
x
,
y
,
Native
.
Companion
.
getPtr
(
font
),
Native
.
Companion
.
getPtr
(
paint
))
_nDrawString
(
_ptr
,
s
,
x
,
y
,
getPtr
(
font
),
getPtr
(
paint
))
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawTextBlob
(
blob
:
TextBlob
,
x
:
Float
,
y
:
Float
,
paint
:
Paint
):
Canvas
{
fun
drawTextBlob
(
blob
:
TextBlob
,
x
:
Float
,
y
:
Float
,
paint
:
Paint
):
Canvas
{
assert
(
blob
!=
null
)
{
"Can’t drawTextBlob with blob == null"
}
require
(
blob
!=
null
)
{
"Can’t drawTextBlob with blob == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawTextBlob with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawTextBlob with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawTextBlob
(
_ptr
,
Native
.
Companion
.
getPtr
(
blob
),
x
,
y
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawTextBlob
(
_ptr
,
getPtr
(
blob
),
x
,
y
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
blob
)
reachabilityBarrier
(
blob
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
fun
drawTextLine
(
line
:
TextLine
,
x
:
Float
,
y
:
Float
,
paint
:
Paint
):
Canvas
{
fun
drawTextLine
(
line
:
TextLine
,
x
:
Float
,
y
:
Float
,
paint
:
Paint
):
Canvas
{
assert
(
line
!=
null
)
{
"Can’t drawTextLine with line == null"
}
require
(
line
!=
null
)
{
"Can’t drawTextLine with line == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawTextLine with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawTextLine with paint == null"
}
line
.
textBlob
.
use
{
blob
->
blob
?.
let
{
drawTextBlob
(
it
,
x
,
y
,
paint
)
}
}
line
.
textBlob
?.
use
{
blob
->
drawTextBlob
(
blob
,
x
,
y
,
paint
)
}
return
this
return
this
}
}
...
@@ -671,11 +703,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -671,11 +703,10 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
}
}
fun
drawPicture
(
picture
:
Picture
,
matrix
:
Matrix33
?,
paint
:
Paint
?):
Canvas
{
fun
drawPicture
(
picture
:
Picture
,
matrix
:
Matrix33
?,
paint
:
Paint
?):
Canvas
{
assert
(
picture
!=
null
)
{
"Can’t drawPicture with picture == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPicture
(
_ptr
,
Native
.
Companion
.
getPtr
(
picture
),
matrix
?.
mat
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPicture
(
_ptr
,
getPtr
(
picture
),
matrix
?.
mat
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
picture
)
reachabilityBarrier
(
picture
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -765,23 +796,23 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -765,23 +796,23 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
mode
:
BlendMode
,
mode
:
BlendMode
,
paint
:
Paint
paint
:
Paint
):
Canvas
{
):
Canvas
{
assert
(
positions
!=
null
)
{
"Can’t drawTriangles with positions == null"
}
require
(
positions
!=
null
)
{
"Can’t drawTriangles with positions == null"
}
assert
(
positions
.
size
%
3
==
0
)
{
"Expected positions.length % 3 == 0, got: "
+
positions
.
size
}
require
(
positions
.
size
%
3
==
0
)
{
"Expected positions.length % 3 == 0, got: "
+
positions
.
size
}
assert
(
colors
==
null
||
colors
.
size
==
positions
.
size
)
{
"Expected colors.length == positions.length, got: "
+
colors
!!
.
size
+
" != "
+
positions
.
size
}
require
(
colors
==
null
||
colors
.
size
==
positions
.
size
)
{
"Expected colors.length == positions.length, got: "
+
colors
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
texCoords
==
null
||
texCoords
.
size
==
positions
.
size
)
{
"Expected texCoords.length == positions.length, got: "
+
texCoords
!!
.
size
+
" != "
+
positions
.
size
}
require
(
texCoords
==
null
||
texCoords
.
size
==
positions
.
size
)
{
"Expected texCoords.length == positions.length, got: "
+
texCoords
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
paint
!=
null
)
{
"Can’t drawTriangles with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawTriangles with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawVertices
(
_nDrawVertices
(
_ptr
,
_ptr
,
0
/* kTriangles_VertexMode */
,
0
/* kTriangles_VertexMode */
,
Point
.
Companion
.
flattenArray
(
positions
),
Point
.
flattenArray
(
positions
),
colors
,
colors
,
Point
.
Companion
.
flattenArray
(
texCoords
),
Point
.
flattenArray
(
texCoords
),
indices
,
indices
,
mode
.
ordinal
,
mode
.
ordinal
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -871,23 +902,23 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -871,23 +902,23 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
mode
:
BlendMode
,
mode
:
BlendMode
,
paint
:
Paint
paint
:
Paint
):
Canvas
{
):
Canvas
{
assert
(
positions
!=
null
)
{
"Can’t drawTriangleStrip with positions == null"
}
require
(
positions
!=
null
)
{
"Can’t drawTriangleStrip with positions == null"
}
assert
(
colors
==
null
||
colors
.
size
==
positions
.
size
)
{
"Expected colors.length == positions.length, got: "
+
colors
!!
.
size
+
" != "
+
positions
.
size
}
require
(
colors
==
null
||
colors
.
size
==
positions
.
size
)
{
"Expected colors.length == positions.length, got: "
+
colors
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
texCoords
==
null
||
texCoords
.
size
==
positions
.
size
)
{
"Expected texCoords.length == positions.length, got: "
+
texCoords
!!
.
size
+
" != "
+
positions
.
size
}
require
(
texCoords
==
null
||
texCoords
.
size
==
positions
.
size
)
{
"Expected texCoords.length == positions.length, got: "
+
texCoords
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
mode
!=
null
)
{
"Can’t drawTriangles with mode == null"
}
require
(
mode
!=
null
)
{
"Can’t drawTriangles with mode == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawTriangles with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawTriangles with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawVertices
(
_nDrawVertices
(
_ptr
,
_ptr
,
1
/* kTriangleStrip_VertexMode */
,
1
/* kTriangleStrip_VertexMode */
,
Point
.
Companion
.
flattenArray
(
positions
),
Point
.
flattenArray
(
positions
),
colors
,
colors
,
Point
.
Companion
.
flattenArray
(
texCoords
),
Point
.
flattenArray
(
texCoords
),
indices
,
indices
,
mode
.
ordinal
,
mode
.
ordinal
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -977,23 +1008,20 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -977,23 +1008,20 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
mode
:
BlendMode
,
mode
:
BlendMode
,
paint
:
Paint
paint
:
Paint
):
Canvas
{
):
Canvas
{
assert
(
positions
!=
null
)
{
"Can’t drawTriangleFan with positions == null"
}
require
(
colors
==
null
||
colors
.
size
==
positions
.
size
)
{
"Expected colors.length == positions.length, got: "
+
colors
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
colors
==
null
||
colors
.
size
==
positions
.
size
)
{
"Expected colors.length == positions.length, got: "
+
colors
!!
.
size
+
" != "
+
positions
.
size
}
require
(
texCoords
==
null
||
texCoords
.
size
==
positions
.
size
)
{
"Expected texCoords.length == positions.length, got: "
+
texCoords
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
texCoords
==
null
||
texCoords
.
size
==
positions
.
size
)
{
"Expected texCoords.length == positions.length, got: "
+
texCoords
!!
.
size
+
" != "
+
positions
.
size
}
assert
(
mode
!=
null
)
{
"Can’t drawTriangleFan with mode == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawTriangleFan with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawVertices
(
_nDrawVertices
(
_ptr
,
_ptr
,
2
/* kTriangleFan_VertexMode */
,
2
/* kTriangleFan_VertexMode */
,
Point
.
Companion
.
flattenArray
(
positions
),
Point
.
flattenArray
(
positions
),
colors
,
colors
,
Point
.
Companion
.
flattenArray
(
texCoords
),
Point
.
flattenArray
(
texCoords
),
indices
,
indices
,
mode
.
ordinal
,
mode
.
ordinal
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -1024,7 +1052,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1024,7 +1052,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
*/
*/
fun
drawPatch
(
cubics
:
Array
<
Point
>,
colors
:
IntArray
,
paint
:
Paint
):
Canvas
{
fun
drawPatch
(
cubics
:
Array
<
Point
>,
colors
:
IntArray
,
paint
:
Paint
):
Canvas
{
return
drawPatch
(
cubics
,
colors
,
null
,
paint
)
return
drawPatch
(
cubics
,
colors
,
null
,
paint
)
}
}
...
@@ -1061,7 +1089,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1061,7 +1089,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
*/
*/
fun
drawPatch
(
cubics
:
Array
<
Point
>,
colors
:
IntArray
,
texCoords
:
Array
<
Point
>?,
paint
:
Paint
):
Canvas
{
fun
drawPatch
(
cubics
:
Array
<
Point
>,
colors
:
IntArray
,
texCoords
:
Array
<
Point
>?,
paint
:
Paint
):
Canvas
{
return
drawPatch
(
cubics
,
colors
,
texCoords
,
BlendMode
.
MODULATE
,
paint
)
return
drawPatch
(
cubics
,
colors
,
texCoords
,
BlendMode
.
MODULATE
,
paint
)
}
}
...
@@ -1100,30 +1128,30 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1100,30 +1128,30 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
*/
*/
fun
drawPatch
(
fun
drawPatch
(
cubics
:
Array
<
Point
>,
cubics
:
Array
<
Point
>,
colors
:
IntArray
,
colors
:
IntArray
,
texCoords
:
Array
<
Point
>?,
texCoords
:
Array
<
Point
>?,
mode
:
BlendMode
,
mode
:
BlendMode
,
paint
:
Paint
paint
:
Paint
):
Canvas
{
):
Canvas
{
assert
(
cubics
!=
null
)
{
"Can’t drawPatch with cubics == null"
}
require
(
cubics
!=
null
)
{
"Can’t drawPatch with cubics == null"
}
assert
(
cubics
.
size
==
12
)
{
"Expected cubics.length == 12, got: "
+
cubics
.
size
}
require
(
cubics
.
size
==
12
)
{
"Expected cubics.length == 12, got: "
+
cubics
.
size
}
assert
(
colors
!=
null
)
{
"Can’t drawPatch with colors == null"
}
require
(
colors
!=
null
)
{
"Can’t drawPatch with colors == null"
}
assert
(
colors
.
size
==
4
)
{
"Expected colors.length == 4, got: "
+
colors
.
size
}
require
(
colors
.
size
==
4
)
{
"Expected colors.length == 4, got: "
+
colors
.
size
}
assert
(
texCoords
==
null
||
texCoords
.
size
==
4
)
{
"Expected texCoords.length == 4, got: "
+
texCoords
!!
.
size
}
require
(
texCoords
==
null
||
texCoords
.
size
==
4
)
{
"Expected texCoords.length == 4, got: "
+
texCoords
!!
.
size
}
assert
(
mode
!=
null
)
{
"Can’t drawPatch with mode == null"
}
require
(
mode
!=
null
)
{
"Can’t drawPatch with mode == null"
}
assert
(
paint
!=
null
)
{
"Can’t drawPatch with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawPatch with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPatch
(
_nDrawPatch
(
_ptr
,
_ptr
,
Point
.
Companion
.
flattenArray
(
cubics
),
Point
.
flattenArray
(
cubics
),
colors
,
colors
,
Point
.
Companion
.
flattenArray
(
texCoords
),
Point
.
flattenArray
(
texCoords
),
mode
.
ordinal
,
mode
.
ordinal
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -1140,7 +1168,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1140,7 +1168,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
* @param drawable custom struct encapsulating drawing commands
* @param drawable custom struct encapsulating drawing commands
* @return this
* @return this
*/
*/
fun
drawDrawable
(
drawable
:
Drawable
):
Canvas
{
fun
drawDrawable
(
drawable
:
Drawable
):
Canvas
{
return
drawDrawable
(
drawable
,
null
)
return
drawDrawable
(
drawable
,
null
)
}
}
...
@@ -1161,8 +1189,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1161,8 +1189,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawDrawable_2](https://fiddle.skia.org/c/@Canvas_drawDrawable_2)
* @see [https://fiddle.skia.org/c/@Canvas_drawDrawable_2](https://fiddle.skia.org/c/@Canvas_drawDrawable_2)
*/
*/
fun
drawDrawable
(
drawable
:
Drawable
,
x
:
Float
,
y
:
Float
):
Canvas
{
fun
drawDrawable
(
drawable
:
Drawable
,
x
:
Float
,
y
:
Float
):
Canvas
{
return
drawDrawable
(
drawable
,
Matrix33
.
Companion
.
makeTranslate
(
x
,
y
))
return
drawDrawable
(
drawable
,
Matrix33
.
makeTranslate
(
x
,
y
))
}
}
/**
/**
...
@@ -1182,25 +1210,25 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1182,25 +1210,25 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_drawDrawable](https://fiddle.skia.org/c/@Canvas_drawDrawable)
* @see [https://fiddle.skia.org/c/@Canvas_drawDrawable](https://fiddle.skia.org/c/@Canvas_drawDrawable)
*/
*/
fun
drawDrawable
(
drawable
:
Drawable
,
matrix
:
Matrix33
?):
Canvas
{
fun
drawDrawable
(
drawable
:
Drawable
,
matrix
:
Matrix33
?):
Canvas
{
assert
(
drawable
!=
null
)
{
"Can’t drawDrawable with drawable == null"
}
require
(
drawable
!=
null
)
{
"Can’t drawDrawable with drawable == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawDrawable
(
_ptr
,
Native
.
Companion
.
getPtr
(
drawable
),
matrix
?.
mat
)
_nDrawDrawable
(
_ptr
,
getPtr
(
drawable
),
matrix
?.
mat
)
Reference
.
reachabilityFence
(
drawable
)
reachabilityBarrier
(
drawable
)
return
this
return
this
}
}
fun
clear
(
color
:
Int
):
Canvas
{
fun
clear
(
color
:
Int
):
Canvas
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nClear
(
_ptr
,
color
)
_nClear
(
_ptr
,
color
)
return
this
return
this
}
}
fun
drawPaint
(
paint
:
Paint
):
Canvas
{
fun
drawPaint
(
paint
:
Paint
):
Canvas
{
assert
(
paint
!=
null
)
{
"Can’t drawPaint with paint == null"
}
require
(
paint
!=
null
)
{
"Can’t drawPaint with paint == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDrawPaint
(
_ptr
,
Native
.
Companion
.
getPtr
(
paint
))
_nDrawPaint
(
_ptr
,
getPtr
(
paint
))
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
return
this
return
this
}
}
...
@@ -1212,8 +1240,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1212,8 +1240,8 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_setMatrix](https://fiddle.skia.org/c/@Canvas_setMatrix)
* @see [https://fiddle.skia.org/c/@Canvas_setMatrix](https://fiddle.skia.org/c/@Canvas_setMatrix)
*/
*/
fun
setMatrix
(
matrix
:
Matrix33
):
Canvas
{
fun
setMatrix
(
matrix
:
Matrix33
):
Canvas
{
assert
(
matrix
!=
null
)
{
"Can’t setMatrix with matrix == null"
}
require
(
matrix
!=
null
)
{
"Can’t setMatrix with matrix == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetMatrix
(
_ptr
,
matrix
.
mat
)
_nSetMatrix
(
_ptr
,
matrix
.
mat
)
return
this
return
this
...
@@ -1225,7 +1253,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1225,7 +1253,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*
*
* @see [https://fiddle.skia.org/c/@Canvas_resetMatrix](https://fiddle.skia.org/c/@Canvas_resetMatrix)
* @see [https://fiddle.skia.org/c/@Canvas_resetMatrix](https://fiddle.skia.org/c/@Canvas_resetMatrix)
*/
*/
fun
resetMatrix
():
Canvas
{
fun
resetMatrix
():
Canvas
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nResetMatrix
(
_ptr
)
_nResetMatrix
(
_ptr
)
return
this
return
this
...
@@ -1240,115 +1268,115 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1240,115 +1268,115 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
val
mat
=
_nGetLocalToDevice
(
_ptr
)
val
mat
=
_nGetLocalToDevice
(
_ptr
)
Matrix44
(*
mat
)
Matrix44
(*
mat
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
localToDeviceAsMatrix33
:
Matrix33
val
localToDeviceAsMatrix33
:
Matrix33
get
()
=
localToDevice
.
asMatrix33
()
get
()
=
localToDevice
.
asMatrix33
()
fun
clipRect
(
r
:
Rect
,
mode
:
ClipMode
,
antiAlias
:
Boolean
):
Canvas
{
fun
clipRect
(
r
:
Rect
,
mode
:
ClipMode
,
antiAlias
:
Boolean
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t clipRect with r == null"
}
require
(
r
!=
null
)
{
"Can’t clipRect with r == null"
}
assert
(
mode
!=
null
)
{
"Can’t clipRect with mode == null"
}
require
(
mode
!=
null
)
{
"Can’t clipRect with mode == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nClipRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
mode
.
ordinal
,
antiAlias
)
_nClipRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
mode
.
ordinal
,
antiAlias
)
return
this
return
this
}
}
fun
clipRect
(
r
:
Rect
,
mode
:
ClipMode
):
Canvas
{
fun
clipRect
(
r
:
Rect
,
mode
:
ClipMode
):
Canvas
{
return
clipRect
(
r
,
mode
,
false
)
return
clipRect
(
r
,
mode
,
false
)
}
}
fun
clipRect
(
r
:
Rect
,
antiAlias
:
Boolean
):
Canvas
{
fun
clipRect
(
r
:
Rect
,
antiAlias
:
Boolean
):
Canvas
{
return
clipRect
(
r
,
ClipMode
.
INTERSECT
,
antiAlias
)
return
clipRect
(
r
,
ClipMode
.
INTERSECT
,
antiAlias
)
}
}
fun
clipRect
(
r
:
Rect
):
Canvas
{
fun
clipRect
(
r
:
Rect
):
Canvas
{
return
clipRect
(
r
,
ClipMode
.
INTERSECT
,
false
)
return
clipRect
(
r
,
ClipMode
.
INTERSECT
,
false
)
}
}
fun
clipRRect
(
r
:
RRect
,
mode
:
ClipMode
,
antiAlias
:
Boolean
):
Canvas
{
fun
clipRRect
(
r
:
RRect
,
mode
:
ClipMode
,
antiAlias
:
Boolean
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t clipRRect with r == null"
}
require
(
r
!=
null
)
{
"Can’t clipRRect with r == null"
}
assert
(
mode
!=
null
)
{
"Can’t clipRRect with mode == null"
}
require
(
mode
!=
null
)
{
"Can’t clipRRect with mode == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nClipRRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
r
.
radii
,
mode
.
ordinal
,
antiAlias
)
_nClipRRect
(
_ptr
,
r
.
left
,
r
.
top
,
r
.
right
,
r
.
bottom
,
r
.
radii
,
mode
.
ordinal
,
antiAlias
)
return
this
return
this
}
}
fun
clipRRect
(
r
:
RRect
,
mode
:
ClipMode
):
Canvas
{
fun
clipRRect
(
r
:
RRect
,
mode
:
ClipMode
):
Canvas
{
return
clipRRect
(
r
,
mode
,
false
)
return
clipRRect
(
r
,
mode
,
false
)
}
}
fun
clipRRect
(
r
:
RRect
,
antiAlias
:
Boolean
):
Canvas
{
fun
clipRRect
(
r
:
RRect
,
antiAlias
:
Boolean
):
Canvas
{
return
clipRRect
(
r
,
ClipMode
.
INTERSECT
,
antiAlias
)
return
clipRRect
(
r
,
ClipMode
.
INTERSECT
,
antiAlias
)
}
}
fun
clipRRect
(
r
:
RRect
):
Canvas
{
fun
clipRRect
(
r
:
RRect
):
Canvas
{
return
clipRRect
(
r
,
ClipMode
.
INTERSECT
,
false
)
return
clipRRect
(
r
,
ClipMode
.
INTERSECT
,
false
)
}
}
fun
clipPath
(
p
:
Path
,
mode
:
ClipMode
,
antiAlias
:
Boolean
):
Canvas
{
fun
clipPath
(
p
:
Path
,
mode
:
ClipMode
,
antiAlias
:
Boolean
):
Canvas
{
assert
(
p
!=
null
)
{
"Can’t clipPath with p == null"
}
require
(
p
!=
null
)
{
"Can’t clipPath with p == null"
}
assert
(
mode
!=
null
)
{
"Can’t clipPath with mode == null"
}
require
(
mode
!=
null
)
{
"Can’t clipPath with mode == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nClipPath
(
_ptr
,
Native
.
Companion
.
getPtr
(
p
),
mode
.
ordinal
,
antiAlias
)
_nClipPath
(
_ptr
,
getPtr
(
p
),
mode
.
ordinal
,
antiAlias
)
Reference
.
reachabilityFence
(
p
)
reachabilityBarrier
(
p
)
return
this
return
this
}
}
fun
clipPath
(
p
:
Path
,
mode
:
ClipMode
):
Canvas
{
fun
clipPath
(
p
:
Path
,
mode
:
ClipMode
):
Canvas
{
return
clipPath
(
p
,
mode
,
false
)
return
clipPath
(
p
,
mode
,
false
)
}
}
fun
clipPath
(
p
:
Path
,
antiAlias
:
Boolean
):
Canvas
{
fun
clipPath
(
p
:
Path
,
antiAlias
:
Boolean
):
Canvas
{
return
clipPath
(
p
,
ClipMode
.
INTERSECT
,
antiAlias
)
return
clipPath
(
p
,
ClipMode
.
INTERSECT
,
antiAlias
)
}
}
fun
clipPath
(
p
:
Path
):
Canvas
{
fun
clipPath
(
p
:
Path
):
Canvas
{
return
clipPath
(
p
,
ClipMode
.
INTERSECT
,
false
)
return
clipPath
(
p
,
ClipMode
.
INTERSECT
,
false
)
}
}
fun
clipRegion
(
r
:
Region
,
mode
:
ClipMode
):
Canvas
{
fun
clipRegion
(
r
:
Region
,
mode
:
ClipMode
):
Canvas
{
assert
(
r
!=
null
)
{
"Can’t clipRegion with r == null"
}
require
(
r
!=
null
)
{
"Can’t clipRegion with r == null"
}
assert
(
mode
!=
null
)
{
"Can’t clipRegion with mode == null"
}
require
(
mode
!=
null
)
{
"Can’t clipRegion with mode == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nClipRegion
(
_ptr
,
Native
.
Companion
.
getPtr
(
r
),
mode
.
ordinal
)
_nClipRegion
(
_ptr
,
getPtr
(
r
),
mode
.
ordinal
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
return
this
return
this
}
}
fun
clipRegion
(
r
:
Region
):
Canvas
{
fun
clipRegion
(
r
:
Region
):
Canvas
{
return
clipRegion
(
r
,
ClipMode
.
INTERSECT
)
return
clipRegion
(
r
,
ClipMode
.
INTERSECT
)
}
}
fun
translate
(
dx
:
Float
,
dy
:
Float
):
Canvas
{
fun
translate
(
dx
:
Float
,
dy
:
Float
):
Canvas
{
return
concat
(
Matrix33
.
Companion
.
makeTranslate
(
dx
,
dy
))
return
concat
(
Matrix33
.
makeTranslate
(
dx
,
dy
))
}
}
fun
scale
(
sx
:
Float
,
sy
:
Float
):
Canvas
{
fun
scale
(
sx
:
Float
,
sy
:
Float
):
Canvas
{
return
concat
(
Matrix33
.
Companion
.
makeScale
(
sx
,
sy
))
return
concat
(
Matrix33
.
makeScale
(
sx
,
sy
))
}
}
/**
/**
* @param deg angle in degrees
* @param deg angle in degrees
* @return this
* @return this
*/
*/
fun
rotate
(
deg
:
Float
):
Canvas
{
fun
rotate
(
deg
:
Float
):
Canvas
{
return
concat
(
Matrix33
.
Companion
.
makeRotate
(
deg
))
return
concat
(
Matrix33
.
makeRotate
(
deg
))
}
}
fun
skew
(
sx
:
Float
,
sy
:
Float
):
Canvas
{
fun
skew
(
sx
:
Float
,
sy
:
Float
):
Canvas
{
return
concat
(
Matrix33
.
Companion
.
makeSkew
(
sx
,
sy
))
return
concat
(
Matrix33
.
makeSkew
(
sx
,
sy
))
}
}
fun
concat
(
matrix
:
Matrix33
):
Canvas
{
fun
concat
(
matrix
:
Matrix33
):
Canvas
{
assert
(
matrix
!=
null
)
{
"Can’t concat with matrix == null"
}
require
(
matrix
!=
null
)
{
"Can’t concat with matrix == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nConcat
(
_ptr
,
matrix
.
mat
)
_nConcat
(
_ptr
,
matrix
.
mat
)
return
this
return
this
}
}
fun
concat
(
matrix
:
Matrix44
):
Canvas
{
fun
concat
(
matrix
:
Matrix44
):
Canvas
{
assert
(
matrix
!=
null
)
{
"Can’t concat with matrix == null"
}
require
(
matrix
!=
null
)
{
"Can’t concat with matrix == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nConcat44
(
_ptr
,
matrix
.
mat
)
_nConcat44
(
_ptr
,
matrix
.
mat
)
return
this
return
this
...
@@ -1401,17 +1429,17 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1401,17 +1429,17 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*/
*/
fun
readPixels
(
bitmap
:
Bitmap
,
srcX
:
Int
,
srcY
:
Int
):
Boolean
{
fun
readPixels
(
bitmap
:
Bitmap
,
srcX
:
Int
,
srcY
:
Int
):
Boolean
{
return
try
{
return
try
{
assert
(
bitmap
!=
null
)
{
"Can’t readPixels with bitmap == null"
}
require
(
bitmap
!=
null
)
{
"Can’t readPixels with bitmap == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nReadPixels
(
_nReadPixels
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
bitmap
),
getPtr
(
bitmap
),
srcX
,
srcX
,
srcY
srcY
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
bitmap
)
reachabilityBarrier
(
bitmap
)
}
}
}
}
...
@@ -1467,17 +1495,17 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1467,17 +1495,17 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
*/
*/
fun
writePixels
(
bitmap
:
Bitmap
,
x
:
Int
,
y
:
Int
):
Boolean
{
fun
writePixels
(
bitmap
:
Bitmap
,
x
:
Int
,
y
:
Int
):
Boolean
{
return
try
{
return
try
{
assert
(
bitmap
!=
null
)
{
"Can’t writePixels with bitmap == null"
}
require
(
bitmap
!=
null
)
{
"Can’t writePixels with bitmap == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nWritePixels
(
_nWritePixels
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
bitmap
),
getPtr
(
bitmap
),
x
,
x
,
y
y
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
bitmap
)
reachabilityBarrier
(
bitmap
)
}
}
}
}
...
@@ -1486,7 +1514,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1486,7 +1514,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSave
(
_ptr
)
_nSave
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -1499,11 +1527,11 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1499,11 +1527,11 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
top
,
top
,
right
,
right
,
bottom
,
bottom
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
}
}
}
}
...
@@ -1541,18 +1569,18 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1541,18 +1569,18 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
if
(
bounds
==
null
)
_nSaveLayer
(
if
(
bounds
==
null
)
_nSaveLayer
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
else
_nSaveLayerRect
(
)
else
_nSaveLayerRect
(
_ptr
,
_ptr
,
bounds
.
left
,
bounds
.
left
,
bounds
.
top
,
bounds
.
top
,
bounds
.
right
,
bounds
.
right
,
bounds
.
bottom
,
bounds
.
bottom
,
Native
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
}
}
}
}
...
@@ -1561,7 +1589,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
...
@@ -1561,7 +1589,7 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetSaveCount
(
_ptr
)
_nGetSaveCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
fun
restore
():
Canvas
{
fun
restore
():
Canvas
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Data.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Data.kt
View file @
f794e4bb
...
@@ -4,15 +4,13 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,15 +4,13 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.nio.ByteBuffer
/**
/**
* Data holds an immutable data buffer.
* Data holds an immutable data buffer.
*/
*/
class
Data
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
class
Data
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
companion
object
{
companion
object
{
@JvmOverloads
fun
makeFromBytes
(
bytes
:
ByteArray
,
offset
:
Long
=
0
,
length
:
Long
=
bytes
.
size
.
toLong
()):
Data
{
fun
makeFromBytes
(
bytes
:
ByteArray
,
offset
:
Long
=
0
,
length
:
Long
=
bytes
.
size
.
toLong
()):
Data
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
return
Data
(
_nMakeFromBytes
(
bytes
,
offset
,
length
))
return
Data
(
_nMakeFromBytes
(
bytes
,
offset
,
length
))
...
@@ -56,7 +54,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -56,7 +54,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSize
(
_ptr
)
_nSize
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
bytes
:
ByteArray
val
bytes
:
ByteArray
get
()
=
getBytes
(
0
,
size
)
get
()
=
getBytes
(
0
,
size
)
...
@@ -66,7 +64,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -66,7 +64,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nBytes
(
_ptr
,
offset
,
length
)
_nBytes
(
_ptr
,
offset
,
length
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -77,10 +75,10 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -77,10 +75,10 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nEquals
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
}
}
...
@@ -93,7 +91,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -93,7 +91,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Data
(
_nMakeSubset
(
_ptr
,
offset
,
length
))
Data
(
_nMakeSubset
(
_ptr
,
offset
,
length
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -102,7 +100,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -102,7 +100,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Data
(
_nMakeSubset
(
_ptr
,
0
,
size
))
Data
(
_nMakeSubset
(
_ptr
,
0
,
size
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -111,7 +109,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -111,7 +109,7 @@ class Data internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nToByteBuffer
(
_ptr
)
_nToByteBuffer
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Drawable.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Drawable.kt
View file @
f794e4bb
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
/**
/**
*
*
...
@@ -45,7 +45,7 @@ abstract class Drawable : RefCnt(_nMake()) {
...
@@ -45,7 +45,7 @@ abstract class Drawable : RefCnt(_nMake()) {
* and the current matrix and clip settings will not be changed.
* and the current matrix and clip settings will not be changed.
*/
*/
fun
draw
(
canvas
:
Canvas
?,
x
:
Float
,
y
:
Float
):
Drawable
{
fun
draw
(
canvas
:
Canvas
?,
x
:
Float
,
y
:
Float
):
Drawable
{
return
draw
(
canvas
,
Matrix33
.
Companion
.
makeTranslate
(
x
,
y
))
return
draw
(
canvas
,
Matrix33
.
makeTranslate
(
x
,
y
))
}
}
/**
/**
...
@@ -58,12 +58,12 @@ abstract class Drawable : RefCnt(_nMake()) {
...
@@ -58,12 +58,12 @@ abstract class Drawable : RefCnt(_nMake()) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nDraw
(
_nDraw
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
canvas
),
getPtr
(
canvas
),
matrix
?.
mat
matrix
?.
mat
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
canvas
)
reachabilityBarrier
(
canvas
)
}
}
}
}
...
@@ -72,7 +72,7 @@ abstract class Drawable : RefCnt(_nMake()) {
...
@@ -72,7 +72,7 @@ abstract class Drawable : RefCnt(_nMake()) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Picture
(
_nMakePictureSnapshot
(
_ptr
))
Picture
(
_nMakePictureSnapshot
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -90,7 +90,7 @@ abstract class Drawable : RefCnt(_nMake()) {
...
@@ -90,7 +90,7 @@ abstract class Drawable : RefCnt(_nMake()) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetGenerationId
(
_ptr
)
_nGetGenerationId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Expects.kt
0 → 100644
View file @
f794e4bb
package
org.jetbrains.skia
expect
abstract
class
ByteBuffer
expect
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
expect
fun
String
.
intCodePoints
():
IntArray
expect
fun
defaultLanguageTag
():
String
expect
class
Pattern
{
fun
split
(
input
:
CharSequence
):
Array
<
String
?
>?
fun
matcher
(
input
:
CharSequence
):
Matcher
}
expect
class
Matcher
{
fun
group
(
name
:
String
):
String
?
fun
matches
():
Boolean
}
expect
fun
compilePattern
(
regex
:
String
):
Pattern
interface
BooleanSupplier
{
/**
* Gets a result.
*
* @return a result
*/
val
asBoolean
:
Boolean
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Font.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Font.kt
View file @
f794e4bb
...
@@ -4,7 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,7 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
Font
:
Managed
{
class
Font
:
Managed
{
companion
object
{
companion
object
{
...
@@ -81,18 +82,18 @@ class Font : Managed {
...
@@ -81,18 +82,18 @@ class Font : Managed {
*
*
* @param typeface typeface and style used to draw and measure text. Pass null for default
* @param typeface typeface and style used to draw and measure text. Pass null for default
*/
*/
constructor
(
typeface
:
Typeface
?)
:
this
(
_nMakeTypeface
(
Native
.
getPtr
(
typeface
)))
{
constructor
(
typeface
:
Typeface
?)
:
this
(
_nMakeTypeface
(
getPtr
(
typeface
)))
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
typeface
)
reachabilityBarrier
(
typeface
)
}
}
/**
/**
* @param typeface typeface and style used to draw and measure text. Pass null for default
* @param typeface typeface and style used to draw and measure text. Pass null for default
* @param size typographic size of the text
* @param size typographic size of the text
*/
*/
constructor
(
typeface
:
Typeface
?,
size
:
Float
)
:
this
(
_nMakeTypefaceSize
(
Native
.
Companion
.
getPtr
(
typeface
),
size
))
{
constructor
(
typeface
:
Typeface
?,
size
:
Float
)
:
this
(
_nMakeTypefaceSize
(
getPtr
(
typeface
),
size
))
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
typeface
)
reachabilityBarrier
(
typeface
)
}
}
/**
/**
...
@@ -107,11 +108,11 @@ class Font : Managed {
...
@@ -107,11 +108,11 @@ class Font : Managed {
*/
*/
constructor
(
typeface
:
Typeface
?,
size
:
Float
,
scaleX
:
Float
,
skewX
:
Float
)
:
this
(
constructor
(
typeface
:
Typeface
?,
size
:
Float
,
scaleX
:
Float
,
skewX
:
Float
)
:
this
(
_nMakeTypefaceSizeScaleSkew
(
_nMakeTypefaceSizeScaleSkew
(
Native
.
Companion
.
getPtr
(
typeface
),
size
,
scaleX
,
skewX
getPtr
(
typeface
),
size
,
scaleX
,
skewX
)
)
)
{
)
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
typeface
)
reachabilityBarrier
(
typeface
)
}
}
/**
/**
...
@@ -120,10 +121,10 @@ class Font : Managed {
...
@@ -120,10 +121,10 @@ class Font : Managed {
*/
*/
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
_nEquals
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
}
}
...
@@ -138,7 +139,7 @@ class Font : Managed {
...
@@ -138,7 +139,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsAutoHintingForced
(
_ptr
)
_nIsAutoHintingForced
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -149,7 +150,7 @@ class Font : Managed {
...
@@ -149,7 +150,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAreBitmapsEmbedded
(
_ptr
)
_nAreBitmapsEmbedded
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -161,7 +162,7 @@ class Font : Managed {
...
@@ -161,7 +162,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsSubpixel
(
_ptr
)
_nIsSubpixel
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -172,7 +173,7 @@ class Font : Managed {
...
@@ -172,7 +173,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAreMetricsLinear
(
_ptr
)
_nAreMetricsLinear
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -187,7 +188,7 @@ class Font : Managed {
...
@@ -187,7 +188,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsEmboldened
(
_ptr
)
_nIsEmboldened
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -201,7 +202,7 @@ class Font : Managed {
...
@@ -201,7 +202,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsBaselineSnapped
(
_ptr
)
_nIsBaselineSnapped
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -288,7 +289,7 @@ class Font : Managed {
...
@@ -288,7 +289,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
FontEdging
.
values
().
get
(
_nGetEdging
(
_ptr
))
FontEdging
.
values
().
get
(
_nGetEdging
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -309,7 +310,7 @@ class Font : Managed {
...
@@ -309,7 +310,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
FontHinting
.
values
().
get
(
_nGetHinting
(
_ptr
))
FontHinting
.
values
().
get
(
_nGetHinting
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -337,7 +338,7 @@ class Font : Managed {
...
@@ -337,7 +338,7 @@ class Font : Managed {
val
ptr
=
_nGetTypeface
(
_ptr
)
val
ptr
=
_nGetTypeface
(
_ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -348,7 +349,7 @@ class Font : Managed {
...
@@ -348,7 +349,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Typeface
(
_nGetTypefaceOrDefault
(
_ptr
))
Typeface
(
_nGetTypefaceOrDefault
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -359,7 +360,7 @@ class Font : Managed {
...
@@ -359,7 +360,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetSize
(
_ptr
)
_nGetSize
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -370,7 +371,7 @@ class Font : Managed {
...
@@ -370,7 +371,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetScaleX
(
_ptr
)
_nGetScaleX
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -381,7 +382,7 @@ class Font : Managed {
...
@@ -381,7 +382,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetSkewX
(
_ptr
)
_nGetSkewX
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -392,11 +393,11 @@ class Font : Managed {
...
@@ -392,11 +393,11 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetTypeface
(
_nSetTypeface
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
typeface
)
getPtr
(
typeface
)
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
typeface
)
reachabilityBarrier
(
typeface
)
}
}
}
}
...
@@ -433,7 +434,7 @@ class Font : Managed {
...
@@ -433,7 +434,7 @@ class Font : Managed {
* @return the corresponding glyph ids for each character.
* @return the corresponding glyph ids for each character.
*/
*/
fun
getStringGlyphs
(
s
:
String
):
ShortArray
{
fun
getStringGlyphs
(
s
:
String
):
ShortArray
{
return
getUTF32Glyphs
(
s
.
codePoints
().
toArray
())
return
getUTF32Glyphs
(
s
.
intCodePoints
())
}
}
/**
/**
...
@@ -446,7 +447,7 @@ class Font : Managed {
...
@@ -446,7 +447,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUTF32Glyphs
(
_ptr
,
uni
)
_nGetUTF32Glyphs
(
_ptr
,
uni
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -458,7 +459,7 @@ class Font : Managed {
...
@@ -458,7 +459,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUTF32Glyph
(
_ptr
,
unichar
)
_nGetUTF32Glyph
(
_ptr
,
unichar
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -470,7 +471,7 @@ class Font : Managed {
...
@@ -470,7 +471,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetStringGlyphsCount
(
_ptr
,
s
)
_nGetStringGlyphsCount
(
_ptr
,
s
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
/**
/**
...
@@ -480,14 +481,13 @@ class Font : Managed {
...
@@ -480,14 +481,13 @@ class Font : Managed {
/**
/**
* @return the bounding box of text
* @return the bounding box of text
*/
*/
@JvmOverloads
fun
measureText
(
s
:
String
?,
p
:
Paint
?
=
null
):
Rect
{
fun
measureText
(
s
:
String
?,
p
:
Paint
?
=
null
):
Rect
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nMeasureText
(
_ptr
,
s
,
Native
.
Companion
.
getPtr
(
p
))
_nMeasureText
(
_ptr
,
s
,
getPtr
(
p
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
p
)
reachabilityBarrier
(
p
)
}
}
}
}
...
@@ -502,11 +502,11 @@ class Font : Managed {
...
@@ -502,11 +502,11 @@ class Font : Managed {
_nMeasureTextWidth
(
_nMeasureTextWidth
(
_ptr
,
_ptr
,
s
,
s
,
Native
.
Companion
.
getPtr
(
p
)
getPtr
(
p
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
p
)
reachabilityBarrier
(
p
)
}
}
}
}
...
@@ -518,7 +518,7 @@ class Font : Managed {
...
@@ -518,7 +518,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetWidths
(
_ptr
,
glyphs
)
_nGetWidths
(
_ptr
,
glyphs
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -538,11 +538,11 @@ class Font : Managed {
...
@@ -538,11 +538,11 @@ class Font : Managed {
_nGetBounds
(
_nGetBounds
(
_ptr
,
_ptr
,
glyphs
,
glyphs
,
Native
.
Companion
.
getPtr
(
p
)
getPtr
(
p
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
p
)
reachabilityBarrier
(
p
)
}
}
}
}
...
@@ -554,7 +554,7 @@ class Font : Managed {
...
@@ -554,7 +554,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPositions
(
_ptr
,
glyphs
,
0f
,
0f
)
_nGetPositions
(
_ptr
,
glyphs
,
0f
,
0f
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -566,7 +566,7 @@ class Font : Managed {
...
@@ -566,7 +566,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPositions
(
_ptr
,
glyphs
,
offset
.
x
,
offset
.
y
)
_nGetPositions
(
_ptr
,
glyphs
,
offset
.
x
,
offset
.
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -578,7 +578,7 @@ class Font : Managed {
...
@@ -578,7 +578,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetXPositions
(
_ptr
,
glyphs
,
0f
)
_nGetXPositions
(
_ptr
,
glyphs
,
0f
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -590,7 +590,7 @@ class Font : Managed {
...
@@ -590,7 +590,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetXPositions
(
_ptr
,
glyphs
,
offset
)
_nGetXPositions
(
_ptr
,
glyphs
,
offset
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -602,9 +602,9 @@ class Font : Managed {
...
@@ -602,9 +602,9 @@ class Font : Managed {
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nGetPath
(
_ptr
,
glyph
)
val
ptr
=
_nGetPath
(
_ptr
,
glyph
)
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Path
(
ptr
)
if
(
ptr
==
0L
)
null
else
Path
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -616,7 +616,7 @@ class Font : Managed {
...
@@ -616,7 +616,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPaths
(
_ptr
,
glyphs
)
_nGetPaths
(
_ptr
,
glyphs
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -629,7 +629,7 @@ class Font : Managed {
...
@@ -629,7 +629,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetMetrics
(
_ptr
)
_nGetMetrics
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -641,7 +641,7 @@ class Font : Managed {
...
@@ -641,7 +641,7 @@ class Font : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetSpacing
(
_ptr
)
_nGetSpacing
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
private
object
_FinalizerHolder
{
private
object
_FinalizerHolder
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontFamilyName.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontFamilyName.kt
View file @
f794e4bb
...
@@ -8,10 +8,10 @@ class FontFamilyName(val name: String, val language: String) {
...
@@ -8,10 +8,10 @@ class FontFamilyName(val name: String, val language: String) {
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
val
`
this
$
_name
`
:
Any
=
name
val
`
this
$
_name
`
:
Any
=
name
val
`
other
$
_name
`
:
Any
=
other
.
name
val
`
other
$
_name
`
:
Any
=
other
.
name
if
(
if
(
`
this
$
_name
`
==
null
)
`
other
$
_name
`
!=
null
else
`
this
$
_name
`
!=
`
other
$
_name
`
)
return
false
if
(
`
this
$
_name
`
!=
`
other
$
_name
`
)
return
false
val
`
this
$
_language
`
:
Any
=
language
val
`
this
$
_language
`
:
Any
=
language
val
`
other
$
_language
`
:
Any
=
other
.
language
val
`
other
$
_language
`
:
Any
=
other
.
language
return
if
(
if
(
`
this
$
_language
`
==
null
)
`
other
$
_language
`
!=
null
else
`
this
$
_language
`
!=
`
other
$
_language
`
)
false
else
true
return
`
this
$
_language
`
==
`
other
$
_language
`
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -22,13 +22,13 @@ class FontFamilyName(val name: String, val language: String) {
...
@@ -22,13 +22,13 @@ class FontFamilyName(val name: String, val language: String) {
val
PRIME
=
59
val
PRIME
=
59
var
result
=
1
var
result
=
1
val
`$
_name
`
:
Any
=
name
val
`$
_name
`
:
Any
=
name
result
=
result
*
PRIME
+
(
`$
_name
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_name
`
.
hashCode
()
)
val
`$
_language
`
:
Any
=
language
val
`$
_language
`
:
Any
=
language
result
=
result
*
PRIME
+
(
`$
_language
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_language
`
.
hashCode
()
)
return
result
return
result
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"FontFamilyName(_name=
"
+
name
+
", _language="
+
language
+
"
)"
return
"FontFamilyName(_name=
$name, _language=$language
)"
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontFeature.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontFeature.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
java.util.regex.Pattern
class
FontFeature
(
val
_tag
:
Int
,
val
value
:
Int
,
val
start
:
Long
,
val
end
:
Long
)
{
class
FontFeature
(
val
_tag
:
Int
,
val
value
:
Int
,
val
start
:
Long
,
val
end
:
Long
)
{
constructor
(
feature
:
String
,
value
:
Int
,
start
:
Long
,
end
:
Long
)
:
this
(
constructor
(
feature
:
String
,
value
:
Int
,
start
:
Long
,
end
:
Long
)
:
this
(
FourByteTag
.
Companion
.
fromString
(
feature
),
FourByteTag
.
fromString
(
feature
),
value
,
value
,
start
,
start
,
end
end
)
)
constructor
(
feature
:
String
,
value
:
Int
)
:
this
(
constructor
(
feature
:
String
,
value
:
Int
)
:
this
(
FourByteTag
.
Companion
.
fromString
(
feature
),
FourByteTag
.
fromString
(
feature
),
value
,
value
,
GLOBAL_START
,
GLOBAL_START
,
GLOBAL_END
GLOBAL_END
)
)
constructor
(
feature
:
String
,
value
:
Boolean
)
:
this
(
constructor
(
feature
:
String
,
value
:
Boolean
)
:
this
(
FourByteTag
.
Companion
.
fromString
(
feature
),
FourByteTag
.
fromString
(
feature
),
if
(
value
)
1
else
0
,
if
(
value
)
1
else
0
,
GLOBAL_START
,
GLOBAL_START
,
GLOBAL_END
GLOBAL_END
)
)
constructor
(
feature
:
String
)
:
this
(
FourByteTag
.
Companion
.
fromString
(
feature
),
1
,
GLOBAL_START
,
GLOBAL_END
)
constructor
(
feature
:
String
)
:
this
(
FourByteTag
.
fromString
(
feature
),
1
,
GLOBAL_START
,
GLOBAL_END
)
val
tag
:
String
val
tag
:
String
get
()
=
FourByteTag
.
Companion
.
toString
(
_tag
)
get
()
=
FourByteTag
.
toString
(
_tag
)
override
fun
toString
():
String
{
override
fun
toString
():
String
{
var
range
=
""
var
range
=
""
...
@@ -48,7 +46,7 @@ class FontFeature(val _tag: Int, val value: Int, val start: Long, val end: Long)
...
@@ -48,7 +46,7 @@ class FontFeature(val _tag: Int, val value: Int, val start: Long, val end: Long)
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
val
`
this
$
_tag
`
:
Any
=
_tag
val
`
this
$
_tag
`
:
Any
=
_tag
val
`
other
$
_tag
`
:
Any
=
other
.
_tag
val
`
other
$
_tag
`
:
Any
=
other
.
_tag
if
(
if
(
`
this
$
_tag
`
==
null
)
`
other
$
_tag
`
!=
null
else
`
this
$
_tag
`
!=
`
other
$
_tag
`
)
return
false
if
(
`
this
$
_tag
`
!=
`
other
$
_tag
`
)
return
false
if
(
value
!=
other
.
value
)
return
false
if
(
value
!=
other
.
value
)
return
false
if
(
start
!=
other
.
start
)
return
false
if
(
start
!=
other
.
start
)
return
false
return
if
(
end
!=
other
.
end
)
false
else
true
return
if
(
end
!=
other
.
end
)
false
else
true
...
@@ -62,7 +60,7 @@ class FontFeature(val _tag: Int, val value: Int, val start: Long, val end: Long)
...
@@ -62,7 +60,7 @@ class FontFeature(val _tag: Int, val value: Int, val start: Long, val end: Long)
val
PRIME
=
59
val
PRIME
=
59
var
result
=
1
var
result
=
1
val
`$
_tag
`
:
Any
=
_tag
val
`$
_tag
`
:
Any
=
_tag
result
=
result
*
PRIME
+
(
`$
_tag
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_tag
`
.
hashCode
()
)
result
=
result
*
PRIME
+
value
result
=
result
*
PRIME
+
value
val
`$
_start
`
=
start
val
`$
_start
`
=
start
result
=
result
*
PRIME
+
(
`$
_start
`
ushr
32
xor
`$
_start
`
).
toInt
()
result
=
result
*
PRIME
+
(
`$
_start
`
ushr
32
xor
`$
_start
`
).
toInt
()
...
@@ -75,22 +73,22 @@ class FontFeature(val _tag: Int, val value: Int, val start: Long, val end: Long)
...
@@ -75,22 +73,22 @@ class FontFeature(val _tag: Int, val value: Int, val start: Long, val end: Long)
const
val
GLOBAL_START
:
Long
=
0
const
val
GLOBAL_START
:
Long
=
0
const
val
GLOBAL_END
=
Long
.
MAX_VALUE
const
val
GLOBAL_END
=
Long
.
MAX_VALUE
val
EMPTY
=
arrayOfNulls
<
FontFeature
>(
0
)
val
EMPTY
=
arrayOfNulls
<
FontFeature
>(
0
)
val
_splitPattern
=
Pattern
.
compile
(
"\\s+"
)
val
_splitPattern
=
compilePattern
(
"\\s+"
)
val
_featurePattern
=
val
_featurePattern
=
Pattern
.
compile
(
"(?<sign>[-+])?(?<tag>[a-z0-9]{4})(?:\\[(?<start>\\d+)?:(?<end>\\d+)?\\])?(?:=(?<value>\\d+))?"
)
compilePattern
(
"(?<sign>[-+])?(?<tag>[a-z0-9]{4})(?:\\[(?<start>\\d+)?:(?<end>\\d+)?\\])?(?:=(?<value>\\d+))?"
)
fun
parseOne
(
s
:
String
):
FontFeature
{
fun
parseOne
(
s
:
String
):
FontFeature
{
val
m
=
_featurePattern
.
matcher
(
s
)
val
m
=
_featurePattern
.
matcher
(
s
)
require
(
m
.
matches
())
{
"Can’t parse FontFeature: $s"
}
require
(
m
.
matches
())
{
"Can’t parse FontFeature: $s"
}
val
value
=
if
(
m
.
group
(
"value"
)
!=
null
)
m
.
group
(
"value"
)
val
value
=
if
(
m
.
group
(
"value"
)
!=
null
)
m
.
group
(
"value"
)
!!
.
toInt
()
else
if
(
m
.
group
(
"sign"
)
==
null
)
1
else
if
(
"-"
==
m
.
group
(
"sign"
))
0
else
1
.
toInt
()
else
if
(
m
.
group
(
"sign"
)
==
null
)
1
else
if
(
"-"
==
m
.
group
(
"sign"
))
0
else
1
val
start
=
if
(
m
.
group
(
"start"
)
==
null
)
0
else
m
.
group
(
"start"
).
toLong
()
val
start
=
if
(
m
.
group
(
"start"
)
==
null
)
0
else
m
.
group
(
"start"
)
!!
.
toLong
()
val
end
=
if
(
m
.
group
(
"end"
)
==
null
)
Long
.
MAX_VALUE
else
m
.
group
(
"end"
).
toLong
()
val
end
=
if
(
m
.
group
(
"end"
)
==
null
)
Long
.
MAX_VALUE
else
m
.
group
(
"end"
)
!!
.
toLong
()
return
FontFeature
(
m
.
group
(
"tag"
),
value
,
start
,
end
)
return
FontFeature
(
m
.
group
(
"tag"
)
!!
,
value
,
start
,
end
)
}
}
fun
parse
(
s
:
String
?
):
Array
<
FontFeature
?
>
{
fun
parse
(
s
:
String
):
Array
<
FontFeature
?
>
{
return
_splitPattern
.
split
(
s
)
.
map
{
s
->
parseOne
(
s
)
}.
toTyped
Array
()
return
_splitPattern
.
split
(
s
)
?.
map
{
s
->
parseOne
(
s
!!
)
}
?.
toTypedArray
()
?:
empty
Array
()
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontMetrics.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontMetrics.kt
View file @
f794e4bb
...
@@ -115,17 +115,17 @@ class FontMetrics(
...
@@ -115,17 +115,17 @@ class FontMetrics(
if
(
o
!
is
FontMetrics
)
return
false
if
(
o
!
is
FontMetrics
)
return
false
val
other
=
o
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(
java
.
lang
.
Float
.
compare
(
top
,
other
.
top
)
!=
0
)
return
false
if
(
top
.
compareTo
(
other
.
top
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
ascent
,
other
.
ascent
)
!=
0
)
return
false
if
(
ascent
.
compareTo
(
other
.
ascent
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
descent
,
other
.
descent
)
!=
0
)
return
false
if
(
descent
.
compareTo
(
other
.
descent
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
bottom
,
other
.
bottom
)
!=
0
)
return
false
if
(
bottom
.
compareTo
(
other
.
bottom
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
leading
,
other
.
leading
)
!=
0
)
return
false
if
(
leading
.
compareTo
(
other
.
leading
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
avgCharWidth
,
other
.
avgCharWidth
)
!=
0
)
return
false
if
(
avgCharWidth
.
compareTo
(
other
.
avgCharWidth
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
maxCharWidth
,
other
.
maxCharWidth
)
!=
0
)
return
false
if
(
maxCharWidth
.
compareTo
(
other
.
maxCharWidth
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
xMin
,
other
.
xMin
)
!=
0
)
return
false
if
(
xMin
.
compareTo
(
other
.
xMin
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
xMax
,
other
.
xMax
)
!=
0
)
return
false
if
(
xMax
.
compareTo
(
other
.
xMax
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
xHeight
,
other
.
xHeight
)
!=
0
)
return
false
if
(
xHeight
.
compareTo
(
other
.
xHeight
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
capHeight
,
other
.
capHeight
)
!=
0
)
return
false
if
(
capHeight
.
compareTo
(
other
.
capHeight
)
!=
0
)
return
false
val
`
this
$
_underlineThickness
`
:
Any
?
=
underlineThickness
val
`
this
$
_underlineThickness
`
:
Any
?
=
underlineThickness
val
`
other
$
_underlineThickness
`
:
Any
?
=
other
.
underlineThickness
val
`
other
$
_underlineThickness
`
:
Any
?
=
other
.
underlineThickness
if
(
if
(
`
this
$
_underlineThickness
`
==
null
)
`
other
$
_underlineThickness
`
!=
null
else
`
this
$
_underlineThickness
`
!=
`
other
$
_underlineThickness
`
)
return
false
if
(
if
(
`
this
$
_underlineThickness
`
==
null
)
`
other
$
_underlineThickness
`
!=
null
else
`
this
$
_underlineThickness
`
!=
`
other
$
_underlineThickness
`
)
return
false
...
@@ -147,17 +147,17 @@ class FontMetrics(
...
@@ -147,17 +147,17 @@ class FontMetrics(
override
fun
hashCode
():
Int
{
override
fun
hashCode
():
Int
{
val
PRIME
=
59
val
PRIME
=
59
var
result
=
1
var
result
=
1
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
top
)
result
=
result
*
PRIME
+
top
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
ascent
)
result
=
result
*
PRIME
+
ascent
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
descent
)
result
=
result
*
PRIME
+
descent
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
bottom
)
result
=
result
*
PRIME
+
bottom
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
leading
)
result
=
result
*
PRIME
+
leading
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
avgCharWidth
)
result
=
result
*
PRIME
+
avgCharWidth
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
maxCharWidth
)
result
=
result
*
PRIME
+
maxCharWidth
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
xMin
)
result
=
result
*
PRIME
+
xMin
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
xMax
)
result
=
result
*
PRIME
+
xMax
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
xHeight
)
result
=
result
*
PRIME
+
xHeight
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
capHeight
)
result
=
result
*
PRIME
+
capHeight
.
toBits
(
)
val
`$
_underlineThickness
`
:
Any
?
=
underlineThickness
val
`$
_underlineThickness
`
:
Any
?
=
underlineThickness
result
=
result
*
PRIME
+
(
`$
_underlineThickness
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_underlineThickness
`
?.
hashCode
()
?:
43
)
val
`$
_underlinePosition
`
:
Any
?
=
underlinePosition
val
`$
_underlinePosition
`
:
Any
?
=
underlinePosition
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontMgr.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontMgr.kt
View file @
f794e4bb
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
open
class
FontMgr
:
RefCnt
{
open
class
FontMgr
:
RefCnt
{
companion
object
{
companion
object
{
...
@@ -35,7 +35,7 @@ open class FontMgr : RefCnt {
...
@@ -35,7 +35,7 @@ open class FontMgr : RefCnt {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetFamiliesCount
(
_ptr
)
_nGetFamiliesCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
fun
getFamilyName
(
index
:
Int
):
String
{
fun
getFamilyName
(
index
:
Int
):
String
{
...
@@ -43,7 +43,7 @@ open class FontMgr : RefCnt {
...
@@ -43,7 +43,7 @@ open class FontMgr : RefCnt {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetFamilyName
(
_ptr
,
index
)
_nGetFamilyName
(
_ptr
,
index
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -53,7 +53,7 @@ open class FontMgr : RefCnt {
...
@@ -53,7 +53,7 @@ open class FontMgr : RefCnt {
val
ptr
=
_nMakeStyleSet
(
_ptr
,
index
)
val
ptr
=
_nMakeStyleSet
(
_ptr
,
index
)
if
(
ptr
==
0L
)
null
else
FontStyleSet
(
ptr
)
if
(
ptr
==
0L
)
null
else
FontStyleSet
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -73,7 +73,7 @@ open class FontMgr : RefCnt {
...
@@ -73,7 +73,7 @@ open class FontMgr : RefCnt {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
FontStyleSet
(
_nMatchFamily
(
_ptr
,
familyName
))
FontStyleSet
(
_nMatchFamily
(
_ptr
,
familyName
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -95,7 +95,7 @@ open class FontMgr : RefCnt {
...
@@ -95,7 +95,7 @@ open class FontMgr : RefCnt {
val
ptr
=
_nMatchFamilyStyle
(
_ptr
,
familyName
,
style
.
_value
)
val
ptr
=
_nMatchFamilyStyle
(
_ptr
,
familyName
,
style
.
_value
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -133,7 +133,7 @@ open class FontMgr : RefCnt {
...
@@ -133,7 +133,7 @@ open class FontMgr : RefCnt {
val
ptr
=
_nMatchFamilyStyleCharacter
(
_ptr
,
familyName
,
style
.
_value
,
bcp47
,
character
)
val
ptr
=
_nMatchFamilyStyleCharacter
(
_ptr
,
familyName
,
style
.
_value
,
bcp47
,
character
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -155,16 +155,15 @@ open class FontMgr : RefCnt {
...
@@ -155,16 +155,15 @@ open class FontMgr : RefCnt {
* or null if the data is not recognized. The caller must call [.close] on
* or null if the data is not recognized. The caller must call [.close] on
* the returned object if it is not null.
* the returned object if it is not null.
*/
*/
@JvmOverloads
fun
makeFromData
(
data
:
Data
?,
ttcIndex
:
Int
=
0
):
Typeface
?
{
fun
makeFromData
(
data
:
Data
?,
ttcIndex
:
Int
=
0
):
Typeface
?
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
val
ptr
=
_nMakeFromData
(
_ptr
,
Native
.
Companion
.
getPtr
(
data
),
ttcIndex
)
_nMakeFromData
(
_ptr
,
getPtr
(
data
),
ttcIndex
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
data
)
reachabilityBarrier
(
data
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontStyle.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontStyle.kt
View file @
f794e4bb
...
@@ -56,9 +56,9 @@ class FontStyle {
...
@@ -56,9 +56,9 @@ class FontStyle {
}
}
companion
object
{
companion
object
{
val
NORMAL
=
FontStyle
(
FontWeight
.
Companion
.
NORMAL
,
FontWidth
.
Companion
.
NORMAL
,
FontSlant
.
UPRIGHT
)
val
NORMAL
=
FontStyle
(
FontWeight
.
NORMAL
,
FontWidth
.
NORMAL
,
FontSlant
.
UPRIGHT
)
val
BOLD
=
FontStyle
(
FontWeight
.
Companion
.
BOLD
,
FontWidth
.
Companion
.
NORMAL
,
FontSlant
.
UPRIGHT
)
val
BOLD
=
FontStyle
(
FontWeight
.
BOLD
,
FontWidth
.
NORMAL
,
FontSlant
.
UPRIGHT
)
val
ITALIC
=
FontStyle
(
FontWeight
.
Companion
.
NORMAL
,
FontWidth
.
Companion
.
NORMAL
,
FontSlant
.
ITALIC
)
val
ITALIC
=
FontStyle
(
FontWeight
.
NORMAL
,
FontWidth
.
NORMAL
,
FontSlant
.
ITALIC
)
val
BOLD_ITALIC
=
FontStyle
(
FontWeight
.
Companion
.
BOLD
,
FontWidth
.
Companion
.
NORMAL
,
FontSlant
.
ITALIC
)
val
BOLD_ITALIC
=
FontStyle
(
FontWeight
.
BOLD
,
FontWidth
.
NORMAL
,
FontSlant
.
ITALIC
)
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontStyleSet.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontStyleSet.kt
View file @
f794e4bb
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
FontStyleSet
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
FontStyleSet
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -29,16 +30,16 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -29,16 +30,16 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nCount
(
_ptr
)
_nCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
fun
getStyle
(
index
:
Int
):
FontStyle
{
fun
getStyle
(
index
:
Int
):
FontStyle
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
FontStyle
(
_nGetStyle
(
_ptr
,
index
))
FontStyle
(
_nGetStyle
(
_ptr
,
index
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -47,7 +48,7 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -47,7 +48,7 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetStyleName
(
_ptr
,
index
)
_nGetStyleName
(
_ptr
,
index
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -57,7 +58,7 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -57,7 +58,7 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
val
ptr
=
_nGetTypeface
(
_ptr
,
index
)
val
ptr
=
_nGetTypeface
(
_ptr
,
index
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -67,7 +68,7 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -67,7 +68,7 @@ class FontStyleSet internal constructor(ptr: Long) : RefCnt(ptr) {
val
ptr
=
_nMatchStyle
(
_ptr
,
style
.
_value
)
val
ptr
=
_nMatchStyle
(
_ptr
,
style
.
_value
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
if
(
ptr
==
0L
)
null
else
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontVariation.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontVariation.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
java.util.regex.Pattern
class
FontVariation
(
val
_tag
:
Int
,
val
value
:
Float
)
{
class
FontVariation
(
val
_tag
:
Int
,
val
value
:
Float
)
{
constructor
(
feature
:
String
,
value
:
Float
)
:
this
(
FourByteTag
.
fromString
(
feature
),
value
)
{}
constructor
(
feature
:
String
,
value
:
Float
)
:
this
(
FourByteTag
.
fromString
(
feature
),
value
)
{}
...
@@ -20,8 +18,8 @@ class FontVariation(val _tag: Int, val value: Float) {
...
@@ -20,8 +18,8 @@ class FontVariation(val _tag: Int, val value: Float) {
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
val
`
this
$
_tag
`
:
Any
=
_tag
val
`
this
$
_tag
`
:
Any
=
_tag
val
`
other
$
_tag
`
:
Any
=
other
.
_tag
val
`
other
$
_tag
`
:
Any
=
other
.
_tag
if
(
if
(
`
this
$
_tag
`
==
null
)
`
other
$
_tag
`
!=
null
else
`
this
$
_tag
`
!=
`
other
$
_tag
`
)
return
false
if
(
`
this
$
_tag
`
!=
`
other
$
_tag
`
)
return
false
return
if
(
java
.
lang
.
Float
.
compare
(
value
,
other
.
value
)
!=
0
)
false
else
true
return
value
.
compareTo
(
other
.
value
)
==
0
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -33,25 +31,26 @@ class FontVariation(val _tag: Int, val value: Float) {
...
@@ -33,25 +31,26 @@ class FontVariation(val _tag: Int, val value: Float) {
var
result
=
1
var
result
=
1
val
`$
_tag
`
:
Any
=
_tag
val
`$
_tag
`
:
Any
=
_tag
result
=
result
*
PRIME
+
(
`$
_tag
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_tag
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
value
)
result
=
result
*
PRIME
+
value
.
toBits
(
)
return
result
return
result
}
}
companion
object
{
companion
object
{
val
EMPTY
=
arrayOfNulls
<
FontVariation
>(
0
)
val
EMPTY
=
arrayOfNulls
<
FontVariation
>(
0
)
internal
val
_splitPattern
=
Pattern
.
compile
(
"\\s+"
)
internal
val
_splitPattern
=
compilePattern
(
"\\s+"
)
internal
val
_variationPattern
=
compilePattern
(
"(?<tag>[a-z0-9]{4})=(?<value>\\d+)"
)
internal
val
_variationPattern
=
Pattern
.
compile
(
"(?<tag>[a-z0-9]{4})=(?<value>\\d+)"
)
fun
parseOne
(
s
:
String
):
FontVariation
{
fun
parseOne
(
s
:
String
):
FontVariation
{
val
m
=
_variationPattern
.
matcher
(
s
)
val
m
=
_variationPattern
.
matcher
(
s
)
require
(
m
.
matches
())
{
"Can’t parse FontVariation: $s"
}
require
(
m
.
matches
())
{
"Can’t parse FontVariation: $s"
}
val
value
=
m
.
group
(
"value"
).
toFloat
()
val
value
=
m
.
group
(
"value"
)
!!
.
toFloat
()
return
FontVariation
(
m
.
group
(
"tag"
),
value
)
return
FontVariation
(
m
.
group
(
"tag"
)
!!
,
value
)
}
}
fun
parse
(
s
:
String
?):
Array
<
FontVariation
>
{
fun
parse
(
s
:
String
?):
Array
<
FontVariation
>
{
return
_splitPattern
.
split
(
s
).
map
{
s
:
String
->
parseOne
(
s
)
}
return
_splitPattern
.
split
(
s
!!
)
!!
.
map
{
s
->
parseOne
(
s
!!
)
}
.
toTypedArray
()
.
toTypedArray
()
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/FontVariationAxis.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/FontVariationAxis.kt
View file @
f794e4bb
...
@@ -21,7 +21,7 @@ class FontVariationAxis(
...
@@ -21,7 +21,7 @@ class FontVariationAxis(
}
}
constructor
(
tag
:
String
,
min
:
Float
,
def
:
Float
,
max
:
Float
)
:
this
(
constructor
(
tag
:
String
,
min
:
Float
,
def
:
Float
,
max
:
Float
)
:
this
(
FourByteTag
.
Companion
.
fromString
(
tag
),
FourByteTag
.
fromString
(
tag
),
min
,
min
,
def
,
def
,
max
,
max
,
...
@@ -36,11 +36,11 @@ class FontVariationAxis(
...
@@ -36,11 +36,11 @@ class FontVariationAxis(
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
val
`
this
$
_tag
`
:
Any
=
_tag
val
`
this
$
_tag
`
:
Any
=
_tag
val
`
other
$
_tag
`
:
Any
=
other
.
_tag
val
`
other
$
_tag
`
:
Any
=
other
.
_tag
if
(
if
(
`
this
$
_tag
`
==
null
)
`
other
$
_tag
`
!=
null
else
`
this
$
_tag
`
!=
`
other
$
_tag
`
)
return
false
if
(
`
this
$
_tag
`
!=
`
other
$
_tag
`
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
minValue
,
other
.
minValue
)
!=
0
)
return
false
if
(
minValue
.
compareTo
(
other
.
minValue
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
defaultValue
,
other
.
defaultValue
)
!=
0
)
return
false
if
(
defaultValue
.
compareTo
(
other
.
defaultValue
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
maxValue
,
other
.
maxValue
)
!=
0
)
return
false
if
(
maxValue
.
compareTo
(
other
.
maxValue
)
!=
0
)
return
false
return
i
f
(
isHidden
!=
other
.
isHidden
)
false
else
true
return
i
sHidden
==
other
.
isHidden
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -51,15 +51,15 @@ class FontVariationAxis(
...
@@ -51,15 +51,15 @@ class FontVariationAxis(
val
PRIME
=
59
val
PRIME
=
59
var
result
=
1
var
result
=
1
val
`$
_tag
`
:
Any
=
_tag
val
`$
_tag
`
:
Any
=
_tag
result
=
result
*
PRIME
+
(
`$
_tag
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_tag
`
.
hashCode
()
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
minValue
)
result
=
result
*
PRIME
+
minValue
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
defaultValue
)
result
=
result
*
PRIME
+
defaultValue
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
maxValue
)
result
=
result
*
PRIME
+
maxValue
.
toBits
(
)
result
=
result
*
PRIME
+
if
(
isHidden
)
79
else
97
result
=
result
*
PRIME
+
if
(
isHidden
)
79
else
97
return
result
return
result
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"FontVariationAxis(_tag=
"
+
_tag
+
", _minValue="
+
minValue
+
", _defaultValue="
+
defaultValue
+
", _maxValue="
+
maxValue
+
", _hidden="
+
isHidden
+
"
)"
return
"FontVariationAxis(_tag=
$_tag, _minValue=$minValue, _defaultValue=$defaultValue, _maxValue=$maxValue, _hidden=$isHidden
)"
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/GradientStyle.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/GradientStyle.kt
View file @
f794e4bb
File moved
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/IHasImageInfo.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/IHasImageInfo.kt
View file @
f794e4bb
File moved
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Image.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Image.kt
View file @
f794e4bb
...
@@ -2,11 +2,9 @@ package org.jetbrains.skia
...
@@ -2,11 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.RuntimeException
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
import
java.nio.ByteBuffer
class
Image
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
),
IHasImageInfo
{
class
Image
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
),
IHasImageInfo
{
companion
object
{
companion
object
{
...
@@ -39,14 +37,14 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -39,14 +37,14 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
imageInfo
.
height
,
imageInfo
.
height
,
imageInfo
.
colorInfo
.
colorType
.
ordinal
,
imageInfo
.
colorInfo
.
colorType
.
ordinal
,
imageInfo
.
colorInfo
.
alphaType
.
ordinal
,
imageInfo
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
Companion
.
getPtr
(
imageInfo
.
colorInfo
.
colorSpace
),
getPtr
(
imageInfo
.
colorInfo
.
colorSpace
),
bytes
,
bytes
,
rowBytes
rowBytes
)
)
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to makeRaster $imageInfo $bytes $rowBytes"
)
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to makeRaster $imageInfo $bytes $rowBytes"
)
Image
(
ptr
)
Image
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
imageInfo
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
imageInfo
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -77,15 +75,15 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -77,15 +75,15 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
imageInfo
.
height
,
imageInfo
.
height
,
imageInfo
.
colorInfo
.
colorType
.
ordinal
,
imageInfo
.
colorInfo
.
colorType
.
ordinal
,
imageInfo
.
colorInfo
.
alphaType
.
ordinal
,
imageInfo
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
imageInfo
.
colorInfo
.
colorSpace
),
getPtr
(
imageInfo
.
colorInfo
.
colorSpace
),
Native
.
getPtr
(
data
),
getPtr
(
data
),
rowBytes
rowBytes
)
)
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to makeRaster $imageInfo $data $rowBytes"
)
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to makeRaster $imageInfo $data $rowBytes"
)
Image
(
ptr
)
Image
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
imageInfo
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
imageInfo
.
colorInfo
.
colorSpace
)
Reference
.
reachabilityFence
(
data
)
reachabilityBarrier
(
data
)
}
}
}
}
...
@@ -112,27 +110,27 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -112,27 +110,27 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
*/
*/
fun
makeFromBitmap
(
bitmap
:
Bitmap
):
Image
{
fun
makeFromBitmap
(
bitmap
:
Bitmap
):
Image
{
return
try
{
return
try
{
assert
(
bitmap
!=
null
)
{
"Can’t makeFromBitmap with bitmap == null"
}
require
(
bitmap
!=
null
)
{
"Can’t makeFromBitmap with bitmap == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
val
ptr
=
_nMakeFromBitmap
(
Native
.
Companion
.
getPtr
(
bitmap
))
_nMakeFromBitmap
(
getPtr
(
bitmap
))
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to Image::makeFromBitmap $bitmap"
)
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to Image::makeFromBitmap $bitmap"
)
Image
(
ptr
)
Image
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
bitmap
)
reachabilityBarrier
(
bitmap
)
}
}
}
}
fun
makeFromPixmap
(
pixmap
:
Pixmap
):
Image
{
fun
makeFromPixmap
(
pixmap
:
Pixmap
):
Image
{
return
try
{
return
try
{
assert
(
pixmap
!=
null
)
{
"Can’t makeFromPixmap with pixmap == null"
}
require
(
pixmap
!=
null
)
{
"Can’t makeFromPixmap with pixmap == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
val
ptr
=
_nMakeFromPixmap
(
Native
.
Companion
.
getPtr
(
pixmap
))
_nMakeFromPixmap
(
getPtr
(
pixmap
))
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to Image::makeFromRaster $pixmap"
)
if
(
ptr
==
0L
)
throw
RuntimeException
(
"Failed to Image::makeFromRaster $pixmap"
)
Image
(
ptr
)
Image
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
pixmap
)
reachabilityBarrier
(
pixmap
)
}
}
}
}
...
@@ -199,7 +197,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -199,7 +197,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
override
val
imageInfo
:
ImageInfo
override
val
imageInfo
:
ImageInfo
get
()
=
try
{
get
()
=
try
{
if
(
_imageInfo
==
null
)
{
if
(
_imageInfo
==
null
)
{
s
ynchronized
(
this
)
{
commonS
ynchronized
(
this
)
{
if
(
_imageInfo
==
null
)
{
if
(
_imageInfo
==
null
)
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_imageInfo
=
_nGetImageInfo
(
_ptr
)
_imageInfo
=
_nGetImageInfo
(
_ptr
)
...
@@ -208,7 +206,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -208,7 +206,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
}
}
_imageInfo
!!
_imageInfo
!!
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
* Encodes Image pixels, returning result as Data.
* Encodes Image pixels, returning result as Data.
...
@@ -240,14 +238,13 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -240,14 +238,13 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
*
*
* @see [https://fiddle.skia.org/c/@Image_encodeToData_2](https://fiddle.skia.org/c/@Image_encodeToData_2)
* @see [https://fiddle.skia.org/c/@Image_encodeToData_2](https://fiddle.skia.org/c/@Image_encodeToData_2)
*/
*/
@JvmOverloads
fun
encodeToData
(
format
:
EncodedImageFormat
=
EncodedImageFormat
.
PNG
,
quality
:
Int
=
100
):
Data
?
{
fun
encodeToData
(
format
:
EncodedImageFormat
=
EncodedImageFormat
.
PNG
,
quality
:
Int
=
100
):
Data
?
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nEncodeToData
(
_ptr
,
format
.
ordinal
,
quality
)
val
ptr
=
_nEncodeToData
(
_ptr
,
format
.
ordinal
,
quality
)
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Data
(
ptr
)
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Data
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -263,17 +260,16 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -263,17 +260,16 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
return
makeShader
(
tmx
,
tmy
,
SamplingMode
.
DEFAULT
,
localMatrix
)
return
makeShader
(
tmx
,
tmy
,
SamplingMode
.
DEFAULT
,
localMatrix
)
}
}
@JvmOverloads
fun
makeShader
(
fun
makeShader
(
tmx
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
tmx
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
tmy
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
tmy
:
FilterTileMode
=
FilterTileMode
.
CLAMP
,
sampling
:
SamplingMode
=
SamplingMode
.
Companion
.
DEFAULT
,
sampling
:
SamplingMode
=
SamplingMode
.
DEFAULT
,
localMatrix
:
Matrix33
?
=
null
localMatrix
:
Matrix33
?
=
null
):
Shader
{
):
Shader
{
return
try
{
return
try
{
assert
(
tmx
!=
null
)
{
"Can’t Bitmap.makeShader with tmx == null"
}
require
(
tmx
!=
null
)
{
"Can’t Bitmap.makeShader with tmx == null"
}
assert
(
tmy
!=
null
)
{
"Can’t Bitmap.makeShader with tmy == null"
}
require
(
tmy
!=
null
)
{
"Can’t Bitmap.makeShader with tmy == null"
}
assert
(
sampling
!=
null
)
{
"Can’t Bitmap.makeShader with sampling == null"
}
require
(
sampling
!=
null
)
{
"Can’t Bitmap.makeShader with sampling == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shader
(
Shader
(
_nMakeShader
(
_nMakeShader
(
...
@@ -285,7 +281,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -285,7 +281,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -302,7 +298,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -302,7 +298,7 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nPeekPixels
(
_ptr
)
_nPeekPixels
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -311,11 +307,11 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -311,11 +307,11 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nPeekPixelsToPixmap
(
_nPeekPixelsToPixmap
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
pixmap
)
getPtr
(
pixmap
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
pixmap
)
reachabilityBarrier
(
pixmap
)
}
}
}
}
...
@@ -368,50 +364,50 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
...
@@ -368,50 +364,50 @@ class Image internal constructor(ptr: Long) : RefCnt(ptr), IHasImageInfo {
*/
*/
fun
readPixels
(
context
:
DirectContext
?,
dst
:
Bitmap
,
srcX
:
Int
,
srcY
:
Int
,
cache
:
Boolean
):
Boolean
{
fun
readPixels
(
context
:
DirectContext
?,
dst
:
Bitmap
,
srcX
:
Int
,
srcY
:
Int
,
cache
:
Boolean
):
Boolean
{
return
try
{
return
try
{
assert
(
dst
!=
null
)
{
"Can’t readPixels with dst == null"
}
require
(
dst
!=
null
)
{
"Can’t readPixels with dst == null"
}
_nReadPixelsBitmap
(
_nReadPixelsBitmap
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
context
),
getPtr
(
context
),
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
srcX
,
srcX
,
srcY
,
srcY
,
cache
cache
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
context
)
reachabilityBarrier
(
context
)
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
}
}
}
}
fun
readPixels
(
dst
:
Pixmap
,
srcX
:
Int
,
srcY
:
Int
,
cache
:
Boolean
):
Boolean
{
fun
readPixels
(
dst
:
Pixmap
,
srcX
:
Int
,
srcY
:
Int
,
cache
:
Boolean
):
Boolean
{
return
try
{
return
try
{
assert
(
dst
!=
null
)
{
"Can’t readPixels with dst == null"
}
require
(
dst
!=
null
)
{
"Can’t readPixels with dst == null"
}
_nReadPixelsPixmap
(
_nReadPixelsPixmap
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
srcX
,
srcX
,
srcY
,
srcY
,
cache
cache
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
}
}
}
}
fun
scalePixels
(
dst
:
Pixmap
,
samplingMode
:
SamplingMode
,
cache
:
Boolean
):
Boolean
{
fun
scalePixels
(
dst
:
Pixmap
,
samplingMode
:
SamplingMode
,
cache
:
Boolean
):
Boolean
{
return
try
{
return
try
{
assert
(
dst
!=
null
)
{
"Can’t scalePixels with dst == null"
}
require
(
dst
!=
null
)
{
"Can’t scalePixels with dst == null"
}
_nScalePixels
(
_nScalePixels
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
samplingMode
.
_pack
(),
samplingMode
.
_pack
(),
cache
cache
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ImageFilter.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ImageFilter.kt
View file @
f794e4bb
...
@@ -4,8 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,8 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.util.*
import
kotlin.jvm.JvmStatic
class
ImageFilter
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
ImageFilter
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -20,14 +20,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -20,14 +20,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
ImageFilter
(
ImageFilter
(
_nMakeAlphaThreshold
(
_nMakeAlphaThreshold
(
Native
.
Companion
.
getPtr
(
getPtr
(
r
r
),
innerMin
,
outerMax
,
Native
.
Companion
.
getPtr
(
input
),
crop
),
innerMin
,
outerMax
,
getPtr
(
input
),
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -50,14 +50,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -50,14 +50,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
k3
,
k3
,
k4
,
k4
,
enforcePMColor
,
enforcePMColor
,
Native
.
Companion
.
getPtr
(
bg
),
getPtr
(
bg
),
Native
.
Companion
.
getPtr
(
fg
),
getPtr
(
fg
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
bg
)
reachabilityBarrier
(
bg
)
Reference
.
reachabilityFence
(
fg
)
reachabilityBarrier
(
fg
)
}
}
}
}
...
@@ -67,18 +67,17 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -67,18 +67,17 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
ImageFilter
(
ImageFilter
(
_nMakeBlend
(
_nMakeBlend
(
blendMode
.
ordinal
,
blendMode
.
ordinal
,
Native
.
Companion
.
getPtr
(
bg
),
getPtr
(
bg
),
Native
.
Companion
.
getPtr
(
fg
),
getPtr
(
fg
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
bg
)
reachabilityBarrier
(
bg
)
Reference
.
reachabilityFence
(
fg
)
reachabilityBarrier
(
fg
)
}
}
}
}
@JvmOverloads
fun
makeBlur
(
fun
makeBlur
(
sigmaX
:
Float
,
sigmaX
:
Float
,
sigmaY
:
Float
,
sigmaY
:
Float
,
...
@@ -93,12 +92,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -93,12 +92,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
sigmaX
,
sigmaX
,
sigmaY
,
sigmaY
,
mode
.
ordinal
,
mode
.
ordinal
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -107,14 +106,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -107,14 +106,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
ImageFilter
(
ImageFilter
(
_nMakeColorFilter
(
_nMakeColorFilter
(
Native
.
Companion
.
getPtr
(
getPtr
(
f
f
),
Native
.
Companion
.
getPtr
(
input
),
crop
),
getPtr
(
input
),
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
f
)
reachabilityBarrier
(
f
)
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -123,14 +122,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -123,14 +122,14 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
ImageFilter
(
ImageFilter
(
_nMakeCompose
(
_nMakeCompose
(
Native
.
Companion
.
getPtr
(
getPtr
(
outer
outer
),
Native
.
Companion
.
getPtr
(
inner
)
),
getPtr
(
inner
)
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
outer
)
reachabilityBarrier
(
outer
)
Reference
.
reachabilityFence
(
inner
)
reachabilityBarrier
(
inner
)
}
}
}
}
...
@@ -149,18 +148,17 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -149,18 +148,17 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
x
.
ordinal
,
x
.
ordinal
,
y
.
ordinal
,
y
.
ordinal
,
scale
,
scale
,
Native
.
Companion
.
getPtr
(
displacement
),
getPtr
(
displacement
),
Native
.
Companion
.
getPtr
(
color
),
getPtr
(
color
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
displacement
)
reachabilityBarrier
(
displacement
)
Reference
.
reachabilityFence
(
color
)
reachabilityBarrier
(
color
)
}
}
}
}
@JvmOverloads
fun
makeDropShadow
(
fun
makeDropShadow
(
dx
:
Float
,
dx
:
Float
,
dy
:
Float
,
dy
:
Float
,
...
@@ -179,16 +177,15 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -179,16 +177,15 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
sigmaX
,
sigmaX
,
sigmaY
,
sigmaY
,
color
,
color
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
@JvmOverloads
fun
makeDropShadowOnly
(
fun
makeDropShadowOnly
(
dx
:
Float
,
dx
:
Float
,
dy
:
Float
,
dy
:
Float
,
...
@@ -207,18 +204,18 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -207,18 +204,18 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
sigmaX
,
sigmaX
,
sigmaY
,
sigmaY
,
color
,
color
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
fun
makeImage
(
image
:
Image
):
ImageFilter
{
fun
makeImage
(
image
:
Image
):
ImageFilter
{
val
r
:
Rect
=
Rect
.
Companion
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
())
val
r
:
Rect
=
Rect
.
makeWH
(
image
.
width
.
toFloat
(),
image
.
height
.
toFloat
())
return
makeImage
(
image
,
r
,
r
,
SamplingMode
.
Companion
.
DEFAULT
)
return
makeImage
(
image
,
r
,
r
,
SamplingMode
.
DEFAULT
)
}
}
fun
makeImage
(
image
:
Image
?,
src
:
Rect
,
dst
:
Rect
,
mode
:
SamplingMode
):
ImageFilter
{
fun
makeImage
(
image
:
Image
?,
src
:
Rect
,
dst
:
Rect
,
mode
:
SamplingMode
):
ImageFilter
{
...
@@ -226,7 +223,7 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -226,7 +223,7 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
ImageFilter
(
ImageFilter
(
_nMakeImage
(
_nMakeImage
(
Native
.
Companion
.
getPtr
(
getPtr
(
image
image
),
),
src
.
left
,
src
.
left
,
...
@@ -241,7 +238,7 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -241,7 +238,7 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
image
)
reachabilityBarrier
(
image
)
}
}
}
}
...
@@ -255,12 +252,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -255,12 +252,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
r
.
right
,
r
.
right
,
r
.
bottom
,
r
.
bottom
,
inset
,
inset
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -290,12 +287,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -290,12 +287,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
offsetY
,
offsetY
,
tileMode
.
ordinal
,
tileMode
.
ordinal
,
convolveAlpha
,
convolveAlpha
,
Native
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -306,11 +303,11 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -306,11 +303,11 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
_nMakeMatrixTransform
(
_nMakeMatrixTransform
(
matrix
.
mat
,
matrix
.
mat
,
mode
.
_pack
(),
mode
.
_pack
(),
Native
.
Companion
.
getPtr
(
input
)
getPtr
(
input
)
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -318,10 +315,10 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -318,10 +315,10 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
filterPtrs
=
LongArray
(
filters
.
size
)
val
filterPtrs
=
LongArray
(
filters
.
size
)
Arrays
.
setAll
(
filterPtrs
)
{
i
:
Int
->
Native
.
Companion
.
getPtr
(
filters
[
i
])
}
filterPtrs
.
forEachIndexed
{
i
:
Int
,
_
:
Long
->
getPtr
(
filters
[
i
])
}
ImageFilter
(
_nMakeMerge
(
filterPtrs
,
crop
))
ImageFilter
(
_nMakeMerge
(
filterPtrs
,
crop
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
filters
)
reachabilityBarrier
(
filters
)
}
}
}
}
...
@@ -332,12 +329,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -332,12 +329,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
_nMakeOffset
(
_nMakeOffset
(
dx
,
dx
,
dy
,
dy
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -346,20 +343,16 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -346,20 +343,16 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
ImageFilter
(
ImageFilter
(
_nMakePaint
(
_nMakePaint
(
Native
.
Companion
.
getPtr
(
getPtr
(
paint
paint
),
crop
),
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
}
}
}
}
// public static ImageFilter makePicture(Picture picture, Rect target) {
// Native.onNativeCall();
// return new ImageFilter(_nMakePicture(Native.pointer(picture), target.left, target.top, target.right, target.bottom));
// }
fun
makeTile
(
src
:
Rect
,
dst
:
Rect
,
input
:
ImageFilter
?):
ImageFilter
{
fun
makeTile
(
src
:
Rect
,
dst
:
Rect
,
input
:
ImageFilter
?):
ImageFilter
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
...
@@ -373,11 +366,11 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -373,11 +366,11 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
dst
.
top
,
dst
.
top
,
dst
.
right
,
dst
.
right
,
dst
.
bottom
,
dst
.
bottom
,
Native
.
Companion
.
getPtr
(
input
)
getPtr
(
input
)
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -388,12 +381,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -388,12 +381,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
_nMakeDilate
(
_nMakeDilate
(
rx
,
rx
,
ry
,
ry
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -404,12 +397,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -404,12 +397,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
_nMakeErode
(
_nMakeErode
(
rx
,
rx
,
ry
,
ry
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -433,12 +426,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -433,12 +426,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
lightColor
,
lightColor
,
surfaceScale
,
surfaceScale
,
kd
,
kd
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -462,12 +455,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -462,12 +455,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
lightColor
,
lightColor
,
surfaceScale
,
surfaceScale
,
kd
,
kd
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -501,12 +494,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -501,12 +494,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
lightColor
,
lightColor
,
surfaceScale
,
surfaceScale
,
kd
,
kd
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -532,12 +525,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -532,12 +525,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
surfaceScale
,
surfaceScale
,
ks
,
ks
,
shininess
,
shininess
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -563,12 +556,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -563,12 +556,12 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
surfaceScale
,
surfaceScale
,
ks
,
ks
,
shininess
,
shininess
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
...
@@ -604,16 +597,17 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -604,16 +597,17 @@ class ImageFilter internal constructor(ptr: Long) : RefCnt(ptr) {
surfaceScale
,
surfaceScale
,
ks
,
ks
,
shininess
,
shininess
,
Native
.
Companion
.
getPtr
(
input
),
getPtr
(
input
),
crop
crop
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
input
)
reachabilityBarrier
(
input
)
}
}
}
}
@JvmStatic
external
fun
_nMakeAlphaThreshold
(
@JvmStatic
external
fun
_nMakeAlphaThreshold
(
regionPtr
:
Long
,
regionPtr
:
Long
,
innerMin
:
Float
,
innerMin
:
Float
,
outerMax
:
Float
,
outerMax
:
Float
,
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ImageInfo.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ImageInfo.kt
View file @
f794e4bb
...
@@ -87,7 +87,7 @@ class ImageInfo(val colorInfo: ColorInfo, val width: Int, val height: Int) {
...
@@ -87,7 +87,7 @@ class ImageInfo(val colorInfo: ColorInfo, val width: Int, val height: Int) {
* @return integral rectangle from (0, 0) to (getWidth(), getHeight())
* @return integral rectangle from (0, 0) to (getWidth(), getHeight())
*/
*/
val
bounds
:
IRect
val
bounds
:
IRect
get
()
=
IRect
.
Companion
.
makeXYWH
(
0
,
0
,
width
,
height
)
get
()
=
IRect
.
makeXYWH
(
0
,
0
,
width
,
height
)
/**
/**
* @return true if associated ColorSpace is not null, and ColorSpace gamma
* @return true if associated ColorSpace is not null, and ColorSpace gamma
...
@@ -230,7 +230,7 @@ class ImageInfo(val colorInfo: ColorInfo, val width: Int, val height: Int) {
...
@@ -230,7 +230,7 @@ class ImageInfo(val colorInfo: ColorInfo, val width: Int, val height: Int) {
}
}
companion
object
{
companion
object
{
val
DEFAULT
=
ImageInfo
(
ColorInfo
.
Companion
.
DEFAULT
,
0
,
0
)
val
DEFAULT
=
ImageInfo
(
ColorInfo
.
DEFAULT
,
0
,
0
)
/**
/**
* @return ImageInfo with [ColorType.N32]
* @return ImageInfo with [ColorType.N32]
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/ManagedString.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/ManagedString.kt
View file @
f794e4bb
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
ManagedString
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
class
ManagedString
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
companion
object
{
companion
object
{
...
@@ -29,7 +30,7 @@ class ManagedString internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
...
@@ -29,7 +30,7 @@ class ManagedString internal constructor(ptr: Long) : Managed(ptr, _FinalizerHol
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nToString
(
_ptr
)
_nToString
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/MaskFilter.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/MaskFilter.kt
View file @
f794e4bb
...
@@ -2,13 +2,12 @@ package org.jetbrains.skia
...
@@ -2,13 +2,12 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
MaskFilter
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
MaskFilter
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
@JvmOverloads
fun
makeBlur
(
mode
:
FilterBlurMode
,
sigma
:
Float
,
respectCTM
:
Boolean
=
true
):
MaskFilter
{
fun
makeBlur
(
mode
:
FilterBlurMode
,
sigma
:
Float
,
respectCTM
:
Boolean
=
true
):
MaskFilter
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
return
MaskFilter
(
_nMakeBlur
(
mode
.
ordinal
,
sigma
,
respectCTM
))
return
MaskFilter
(
_nMakeBlur
(
mode
.
ordinal
,
sigma
,
respectCTM
))
...
@@ -17,9 +16,9 @@ class MaskFilter internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -17,9 +16,9 @@ class MaskFilter internal constructor(ptr: Long) : RefCnt(ptr) {
fun
makeShader
(
s
:
Shader
?):
MaskFilter
{
fun
makeShader
(
s
:
Shader
?):
MaskFilter
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
MaskFilter
(
_nMakeShader
(
Native
.
Companion
.
getPtr
(
s
)))
MaskFilter
(
_nMakeShader
(
getPtr
(
s
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
s
)
reachabilityBarrier
(
s
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Paint.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Paint.kt
View file @
f794e4bb
...
@@ -4,7 +4,9 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,7 +4,9 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
import
kotlin.math.round
class
Paint
:
Managed
{
class
Paint
:
Managed
{
companion
object
{
companion
object
{
...
@@ -133,16 +135,16 @@ class Paint : Managed {
...
@@ -133,16 +135,16 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Paint
(
_nMakeClone
(
_ptr
),
true
)
Paint
(
_nMakeClone
(
_ptr
),
true
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
_nEquals
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
}
}
...
@@ -168,7 +170,7 @@ class Paint : Managed {
...
@@ -168,7 +170,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsAntiAlias
(
_ptr
)
_nIsAntiAlias
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setAntiAlias
(
value
)
setAntiAlias
(
value
)
...
@@ -193,7 +195,7 @@ class Paint : Managed {
...
@@ -193,7 +195,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsDither
(
_ptr
)
_nIsDither
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -216,7 +218,7 @@ class Paint : Managed {
...
@@ -216,7 +218,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PaintMode
.
values
().
get
(
_nGetMode
(
_ptr
))
PaintMode
.
values
().
get
(
_nGetMode
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setMode
(
value
)
setMode
(
value
)
...
@@ -230,7 +232,7 @@ class Paint : Managed {
...
@@ -230,7 +232,7 @@ class Paint : Managed {
* @see [https://fiddle.skia.org/c/@Stroke_Width](https://fiddle.skia.org/c/@Stroke_Width)
* @see [https://fiddle.skia.org/c/@Stroke_Width](https://fiddle.skia.org/c/@Stroke_Width)
*/
*/
fun
setMode
(
style
:
PaintMode
):
Paint
{
fun
setMode
(
style
:
PaintMode
):
Paint
{
assert
(
style
!=
null
)
{
"Paint::setMode expected style != null"
}
require
(
style
!=
null
)
{
"Paint::setMode expected style != null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetMode
(
_ptr
,
style
.
ordinal
)
_nSetMode
(
_ptr
,
style
.
ordinal
)
return
this
return
this
...
@@ -258,7 +260,7 @@ class Paint : Managed {
...
@@ -258,7 +260,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetColor
(
_ptr
)
_nGetColor
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setColor
(
value
)
setColor
(
value
)
...
@@ -275,7 +277,7 @@ class Paint : Managed {
...
@@ -275,7 +277,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetColor4f
(
_ptr
)
_nGetColor4f
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setColor4f
(
value
)
setColor4f
(
value
)
...
@@ -318,7 +320,7 @@ class Paint : Managed {
...
@@ -318,7 +320,7 @@ class Paint : Managed {
*/
*/
fun
setColor4f
(
color
:
Color4f
,
colorSpace
:
ColorSpace
?):
Paint
{
fun
setColor4f
(
color
:
Color4f
,
colorSpace
:
ColorSpace
?):
Paint
{
return
try
{
return
try
{
assert
(
color
!=
null
)
{
"Paint::setColor4f expected color != null"
}
require
(
color
!=
null
)
{
"Paint::setColor4f expected color != null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetColor4f
(
_nSetColor4f
(
_ptr
,
_ptr
,
...
@@ -326,11 +328,11 @@ class Paint : Managed {
...
@@ -326,11 +328,11 @@ class Paint : Managed {
color
.
g
,
color
.
g
,
color
.
b
,
color
.
b
,
color
.
a
,
color
.
a
,
Native
.
Companion
.
getPtr
(
colorSpace
)
getPtr
(
colorSpace
)
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
colorSpace
)
reachabilityBarrier
(
colorSpace
)
}
}
}
}
...
@@ -348,7 +350,7 @@ class Paint : Managed {
...
@@ -348,7 +350,7 @@ class Paint : Managed {
* @return alpha ranging from 0, fully transparent, to 255, fully opaque
* @return alpha ranging from 0, fully transparent, to 255, fully opaque
*/
*/
val
alpha
:
Int
val
alpha
:
Int
get
()
=
Math
.
round
(
alphaf
*
255f
)
get
()
=
round
(
alphaf
*
255f
).
toInt
(
)
/**
/**
*
*
...
@@ -409,7 +411,7 @@ class Paint : Managed {
...
@@ -409,7 +411,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetStrokeWidth
(
_ptr
)
_nGetStrokeWidth
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setStrokeWidth
(
value
)
setStrokeWidth
(
value
)
...
@@ -443,7 +445,7 @@ class Paint : Managed {
...
@@ -443,7 +445,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetStrokeMiter
(
_ptr
)
_nGetStrokeMiter
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setStrokeMiter
(
value
)
setStrokeMiter
(
value
)
...
@@ -473,7 +475,7 @@ class Paint : Managed {
...
@@ -473,7 +475,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PaintStrokeCap
.
values
().
get
(
_nGetStrokeCap
(
_ptr
))
PaintStrokeCap
.
values
().
get
(
_nGetStrokeCap
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setStrokeCap
(
value
)
setStrokeCap
(
value
)
...
@@ -489,7 +491,7 @@ class Paint : Managed {
...
@@ -489,7 +491,7 @@ class Paint : Managed {
* @see [https://fiddle.skia.org/c/@Paint_setStrokeCap_b](https://fiddle.skia.org/c/@Paint_setStrokeCap_b)
* @see [https://fiddle.skia.org/c/@Paint_setStrokeCap_b](https://fiddle.skia.org/c/@Paint_setStrokeCap_b)
*/
*/
fun
setStrokeCap
(
cap
:
PaintStrokeCap
):
Paint
{
fun
setStrokeCap
(
cap
:
PaintStrokeCap
):
Paint
{
assert
(
cap
!=
null
)
{
"Paint::setStrokeCap expected cap != null"
}
require
(
cap
!=
null
)
{
"Paint::setStrokeCap expected cap != null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetStrokeCap
(
_ptr
,
cap
.
ordinal
)
_nSetStrokeCap
(
_ptr
,
cap
.
ordinal
)
return
this
return
this
...
@@ -503,7 +505,7 @@ class Paint : Managed {
...
@@ -503,7 +505,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PaintStrokeJoin
.
values
().
get
(
_nGetStrokeJoin
(
_ptr
))
PaintStrokeJoin
.
values
().
get
(
_nGetStrokeJoin
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setStrokeJoin
(
value
)
setStrokeJoin
(
value
)
...
@@ -517,7 +519,7 @@ class Paint : Managed {
...
@@ -517,7 +519,7 @@ class Paint : Managed {
* @see [https://fiddle.skia.org/c/@Paint_setStrokeJoin](https://fiddle.skia.org/c/@Paint_setStrokeJoin)
* @see [https://fiddle.skia.org/c/@Paint_setStrokeJoin](https://fiddle.skia.org/c/@Paint_setStrokeJoin)
*/
*/
fun
setStrokeJoin
(
join
:
PaintStrokeJoin
):
Paint
{
fun
setStrokeJoin
(
join
:
PaintStrokeJoin
):
Paint
{
assert
(
join
!=
null
)
{
"Paint::setStrokeJoin expected join != null"
}
require
(
join
!=
null
)
{
"Paint::setStrokeJoin expected join != null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetStrokeJoin
(
_ptr
,
join
.
ordinal
)
_nSetStrokeJoin
(
_ptr
,
join
.
ordinal
)
return
this
return
this
...
@@ -544,18 +546,18 @@ class Paint : Managed {
...
@@ -544,18 +546,18 @@ class Paint : Managed {
*/
*/
fun
getFillPath
(
src
:
Path
,
cull
:
Rect
?,
resScale
:
Float
):
Path
{
fun
getFillPath
(
src
:
Path
,
cull
:
Rect
?,
resScale
:
Float
):
Path
{
return
try
{
return
try
{
assert
(
src
!=
null
)
{
"Paint::getFillPath expected src != null"
}
require
(
src
!=
null
)
{
"Paint::getFillPath expected src != null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
if
(
cull
==
null
)
org
.
jetbrains
.
skia
.
Path
(
if
(
cull
==
null
)
org
.
jetbrains
.
skia
.
Path
(
_nGetFillPath
(
_nGetFillPath
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
src
),
getPtr
(
src
),
resScale
resScale
)
)
)
else
org
.
jetbrains
.
skia
.
Path
(
)
else
org
.
jetbrains
.
skia
.
Path
(
_nGetFillPathCull
(
_nGetFillPathCull
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
src
),
getPtr
(
src
),
cull
.
left
,
cull
.
left
,
cull
.
top
,
cull
.
top
,
cull
.
right
,
cull
.
right
,
...
@@ -564,8 +566,8 @@ class Paint : Managed {
...
@@ -564,8 +566,8 @@ class Paint : Managed {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
src
)
}
}
}
}
...
@@ -579,7 +581,7 @@ class Paint : Managed {
...
@@ -579,7 +581,7 @@ class Paint : Managed {
val
shaderPtr
=
_nGetShader
(
_ptr
)
val
shaderPtr
=
_nGetShader
(
_ptr
)
if
(
shaderPtr
==
0L
)
null
else
Shader
(
shaderPtr
)
if
(
shaderPtr
==
0L
)
null
else
Shader
(
shaderPtr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setShader
(
value
)
setShader
(
value
)
...
@@ -595,10 +597,10 @@ class Paint : Managed {
...
@@ -595,10 +597,10 @@ class Paint : Managed {
fun
setShader
(
shader
:
Shader
?):
Paint
{
fun
setShader
(
shader
:
Shader
?):
Paint
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetShader
(
_ptr
,
Native
.
Companion
.
getPtr
(
shader
))
_nSetShader
(
_ptr
,
getPtr
(
shader
))
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
shader
)
reachabilityBarrier
(
shader
)
}
}
}
}
...
@@ -612,7 +614,7 @@ class Paint : Managed {
...
@@ -612,7 +614,7 @@ class Paint : Managed {
val
colorFilterPtr
=
_nGetColorFilter
(
_ptr
)
val
colorFilterPtr
=
_nGetColorFilter
(
_ptr
)
if
(
colorFilterPtr
==
0L
)
null
else
ColorFilter
(
colorFilterPtr
)
if
(
colorFilterPtr
==
0L
)
null
else
ColorFilter
(
colorFilterPtr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setColorFilter
(
value
)
setColorFilter
(
value
)
...
@@ -630,11 +632,11 @@ class Paint : Managed {
...
@@ -630,11 +632,11 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetColorFilter
(
_nSetColorFilter
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
colorFilter
)
getPtr
(
colorFilter
)
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
colorFilter
)
reachabilityBarrier
(
colorFilter
)
}
}
}
}
...
@@ -643,12 +645,12 @@ class Paint : Managed {
...
@@ -643,12 +645,12 @@ class Paint : Managed {
*
*
* @return mode used to combine source color with destination color
* @return mode used to combine source color with destination color
*/
*/
var
blendMode
:
BlendMode
?
var
blendMode
:
BlendMode
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
BlendMode
.
values
().
get
(
_nGetBlendMode
(
_ptr
))
BlendMode
.
values
().
get
(
_nGetBlendMode
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setBlendMode
(
value
)
setBlendMode
(
value
)
...
@@ -666,10 +668,9 @@ class Paint : Managed {
...
@@ -666,10 +668,9 @@ class Paint : Managed {
* @param mode BlendMode used to combine source color and destination
* @param mode BlendMode used to combine source color and destination
* @return this
* @return this
*/
*/
fun
setBlendMode
(
mode
:
BlendMode
?):
Paint
{
fun
setBlendMode
(
mode
:
BlendMode
):
Paint
{
assert
(
mode
!=
null
)
{
"Paint::setBlendMode expected mode != null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetBlendMode
(
_ptr
,
mode
!!
.
ordinal
)
_nSetBlendMode
(
_ptr
,
mode
.
ordinal
)
return
this
return
this
}
}
...
@@ -683,7 +684,7 @@ class Paint : Managed {
...
@@ -683,7 +684,7 @@ class Paint : Managed {
val
pathEffectPtr
=
_nGetPathEffect
(
_ptr
)
val
pathEffectPtr
=
_nGetPathEffect
(
_ptr
)
if
(
pathEffectPtr
==
0L
)
null
else
PathEffect
(
pathEffectPtr
)
if
(
pathEffectPtr
==
0L
)
null
else
PathEffect
(
pathEffectPtr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setPathEffect
(
value
)
setPathEffect
(
value
)
...
@@ -699,10 +700,10 @@ class Paint : Managed {
...
@@ -699,10 +700,10 @@ class Paint : Managed {
fun
setPathEffect
(
p
:
PathEffect
?):
Paint
{
fun
setPathEffect
(
p
:
PathEffect
?):
Paint
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetPathEffect
(
_ptr
,
Native
.
Companion
.
getPtr
(
p
))
_nSetPathEffect
(
_ptr
,
getPtr
(
p
))
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
p
)
reachabilityBarrier
(
p
)
}
}
}
}
...
@@ -716,7 +717,7 @@ class Paint : Managed {
...
@@ -716,7 +717,7 @@ class Paint : Managed {
val
maskFilterPtr
=
_nGetMaskFilter
(
_ptr
)
val
maskFilterPtr
=
_nGetMaskFilter
(
_ptr
)
if
(
maskFilterPtr
==
0L
)
null
else
MaskFilter
(
maskFilterPtr
)
if
(
maskFilterPtr
==
0L
)
null
else
MaskFilter
(
maskFilterPtr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -732,11 +733,11 @@ class Paint : Managed {
...
@@ -732,11 +733,11 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetMaskFilter
(
_nSetMaskFilter
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
maskFilter
)
getPtr
(
maskFilter
)
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
maskFilter
)
reachabilityBarrier
(
maskFilter
)
}
}
}
}
...
@@ -750,7 +751,7 @@ class Paint : Managed {
...
@@ -750,7 +751,7 @@ class Paint : Managed {
val
imageFilterPtr
=
_nGetImageFilter
(
_ptr
)
val
imageFilterPtr
=
_nGetImageFilter
(
_ptr
)
if
(
imageFilterPtr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
ImageFilter
(
imageFilterPtr
)
if
(
imageFilterPtr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
ImageFilter
(
imageFilterPtr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -765,11 +766,11 @@ class Paint : Managed {
...
@@ -765,11 +766,11 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetImageFilter
(
_nSetImageFilter
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
imageFilter
)
getPtr
(
imageFilter
)
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
imageFilter
)
reachabilityBarrier
(
imageFilter
)
}
}
}
}
...
@@ -791,7 +792,7 @@ class Paint : Managed {
...
@@ -791,7 +792,7 @@ class Paint : Managed {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nHasNothingToDraw
(
_ptr
)
_nHasNothingToDraw
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Path.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Path.kt
View file @
f794e4bb
...
@@ -4,8 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,8 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.IllegalArgumentException
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
/**
/**
*
*
...
@@ -165,14 +165,14 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -165,14 +165,14 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeCombining
(
val
ptr
=
_nMakeCombining
(
Native
.
Companion
.
getPtr
(
one
),
getPtr
(
one
),
Native
.
Companion
.
getPtr
(
two
),
getPtr
(
two
),
op
.
ordinal
op
.
ordinal
)
)
if
(
ptr
==
0L
)
null
else
Path
(
ptr
)
if
(
ptr
==
0L
)
null
else
Path
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
one
)
reachabilityBarrier
(
one
)
Reference
.
reachabilityFence
(
two
)
reachabilityBarrier
(
two
)
}
}
}
}
...
@@ -199,7 +199,8 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -199,7 +199,8 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
return
Path
(
_nMakeFromBytes
(
data
))
return
Path
(
_nMakeFromBytes
(
data
))
}
}
@JvmStatic
external
fun
_nGetFinalizer
():
Long
@JvmStatic
external
fun
_nGetFinalizer
():
Long
@JvmStatic
external
fun
_nMake
():
Long
@JvmStatic
external
fun
_nMake
():
Long
@JvmStatic
external
fun
_nMakeFromSVGString
(
s
:
String
?):
Long
@JvmStatic
external
fun
_nMakeFromSVGString
(
s
:
String
?):
Long
@JvmStatic
external
fun
_nEquals
(
aPtr
:
Long
,
bPtr
:
Long
):
Boolean
@JvmStatic
external
fun
_nEquals
(
aPtr
:
Long
,
bPtr
:
Long
):
Boolean
...
@@ -370,10 +371,10 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -370,10 +371,10 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*/
*/
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
_nEquals
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
}
}
...
@@ -397,11 +398,11 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -397,11 +398,11 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsInterpolatable
(
_nIsInterpolatable
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
compare
)
getPtr
(
compare
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
compare
)
reachabilityBarrier
(
compare
)
}
}
}
}
...
@@ -436,14 +437,14 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -436,14 +437,14 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeLerp
(
val
ptr
=
_nMakeLerp
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
ending
),
getPtr
(
ending
),
weight
weight
)
)
require
(
ptr
!=
0L
)
{
"Point array is not the same size as ending Point array"
}
require
(
ptr
!=
0L
)
{
"Point array is not the same size as ending Point array"
}
Path
(
ptr
)
Path
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
ending
)
reachabilityBarrier
(
ending
)
}
}
}
}
...
@@ -452,7 +453,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -452,7 +453,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PathFillMode
.
values
().
get
(
_nGetFillMode
(
_ptr
))
PathFillMode
.
values
().
get
(
_nGetFillMode
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
set
(
value
)
{
set
(
value
)
{
setFillMode
(
value
)
setFillMode
(
value
)
...
@@ -474,7 +475,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -474,7 +475,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsConvex
(
_ptr
)
_nIsConvex
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -489,7 +490,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -489,7 +490,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsOval
(
_ptr
)
_nIsOval
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -504,7 +505,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -504,7 +505,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsRRect
(
_ptr
)
_nIsRRect
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -560,7 +561,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -560,7 +561,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsEmpty
(
_ptr
)
_nIsEmpty
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -580,7 +581,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -580,7 +581,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsLastContourClosed
(
_ptr
)
_nIsLastContourClosed
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -595,7 +596,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -595,7 +596,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsFinite
(
_ptr
)
_nIsFinite
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -611,7 +612,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -611,7 +612,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsVolatile
(
_ptr
)
_nIsVolatile
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -655,7 +656,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -655,7 +656,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nMaybeGetAsLine
(
_ptr
)
_nMaybeGetAsLine
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -671,7 +672,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -671,7 +672,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPointsCount
(
_ptr
)
_nGetPointsCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -692,7 +693,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -692,7 +693,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPoint
(
_ptr
,
index
)
_nGetPoint
(
_ptr
,
index
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -727,11 +728,11 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -727,11 +728,11 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*/
*/
fun
getPoints
(
points
:
Array
<
Point
?
>?,
max
:
Int
):
Int
{
fun
getPoints
(
points
:
Array
<
Point
?
>?,
max
:
Int
):
Int
{
return
try
{
return
try
{
assert
(
if
(
points
==
null
)
max
==
0
else
true
)
require
(
if
(
points
==
null
)
max
==
0
else
true
)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPoints
(
_ptr
,
points
,
max
)
_nGetPoints
(
_ptr
,
points
,
max
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -748,7 +749,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -748,7 +749,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nCountVerbs
(
_ptr
)
_nCountVerbs
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
verbs
:
Array
<
PathVerb
?>
val
verbs
:
Array
<
PathVerb
?>
get
()
{
get
()
{
...
@@ -768,16 +769,16 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -768,16 +769,16 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*/
*/
fun
getVerbs
(
verbs
:
Array
<
PathVerb
?
>?,
max
:
Int
):
Int
{
fun
getVerbs
(
verbs
:
Array
<
PathVerb
?
>?,
max
:
Int
):
Int
{
return
try
{
return
try
{
assert
(
if
(
verbs
==
null
)
max
==
0
else
true
)
require
(
if
(
verbs
==
null
)
max
==
0
else
true
)
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
out
=
if
(
verbs
==
null
)
null
else
ByteArray
(
max
)
val
out
=
if
(
verbs
==
null
)
null
else
ByteArray
(
max
)
val
count
=
_nGetVerbs
(
_ptr
,
out
,
max
)
val
count
=
_nGetVerbs
(
_ptr
,
out
,
max
)
if
(
verbs
!=
null
)
for
(
i
in
0
until
Math
.
min
(
count
,
max
))
verbs
[
i
]
=
PathVerb
.
values
().
get
(
if
(
verbs
!=
null
)
for
(
i
in
0
until
minOf
(
count
,
max
))
verbs
[
i
]
=
PathVerb
.
values
().
get
(
out
!!
[
i
].
toInt
()
out
!!
[
i
].
toInt
()
)
)
count
count
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -791,7 +792,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -791,7 +792,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nApproximateBytesUsed
(
_ptr
)
_nApproximateBytesUsed
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -808,10 +809,10 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -808,10 +809,10 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
fun
swap
(
other
:
Path
?):
Path
{
fun
swap
(
other
:
Path
?):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSwap
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nSwap
(
_ptr
,
getPtr
(
other
))
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
}
}
...
@@ -834,7 +835,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -834,7 +835,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetBounds
(
_ptr
)
_nGetBounds
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -882,7 +883,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -882,7 +883,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nComputeTightBounds
(
_ptr
)
_nComputeTightBounds
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -913,7 +914,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -913,7 +914,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
rect
.
bottom
rect
.
bottom
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -1572,7 +1573,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1572,7 +1573,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsRect
(
_ptr
)
_nIsRect
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
* Adds Rect to Path, appending [PathVerb.MOVE], three [PathVerb.LINE], and [PathVerb.CLOSE].
* Adds Rect to Path, appending [PathVerb.MOVE], three [PathVerb.LINE], and [PathVerb.CLOSE].
...
@@ -1609,7 +1610,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1609,7 +1610,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*
*
* @see [https://fiddle.skia.org/c/@Path_addRect](https://fiddle.skia.org/c/@Path_addRect)
* @see [https://fiddle.skia.org/c/@Path_addRect](https://fiddle.skia.org/c/@Path_addRect)
*/
*/
@JvmOverloads
fun
addRect
(
rect
:
Rect
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
,
start
:
Int
=
0
):
Path
{
fun
addRect
(
rect
:
Rect
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
,
start
:
Int
=
0
):
Path
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
,
dir
.
ordinal
,
start
)
_nAddRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
,
dir
.
ordinal
,
start
)
...
@@ -1657,7 +1657,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1657,7 +1657,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*
*
* @see [https://fiddle.skia.org/c/@Path_addOval](https://fiddle.skia.org/c/@Path_addOval)
* @see [https://fiddle.skia.org/c/@Path_addOval](https://fiddle.skia.org/c/@Path_addOval)
*/
*/
@JvmOverloads
fun
addOval
(
oval
:
Rect
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
,
start
:
Int
=
1
):
Path
{
fun
addOval
(
oval
:
Rect
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
,
start
:
Int
=
1
):
Path
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddOval
(
_ptr
,
oval
.
left
,
oval
.
top
,
oval
.
right
,
oval
.
bottom
,
dir
.
ordinal
,
start
)
_nAddOval
(
_ptr
,
oval
.
left
,
oval
.
top
,
oval
.
right
,
oval
.
bottom
,
dir
.
ordinal
,
start
)
...
@@ -1691,7 +1690,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1691,7 +1690,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
* @param radius distance from center to edge
* @param radius distance from center to edge
* @return reference to Path
* @return reference to Path
*/
*/
@JvmOverloads
fun
addCircle
(
x
:
Float
,
y
:
Float
,
radius
:
Float
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
):
Path
{
fun
addCircle
(
x
:
Float
,
y
:
Float
,
radius
:
Float
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
):
Path
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddCircle
(
_ptr
,
x
,
y
,
radius
,
dir
.
ordinal
)
_nAddCircle
(
_ptr
,
x
,
y
,
radius
,
dir
.
ordinal
)
...
@@ -1750,7 +1748,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1750,7 +1748,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*
*
* @see [https://fiddle.skia.org/c/@Path_addRRect](https://fiddle.skia.org/c/@Path_addRRect)
* @see [https://fiddle.skia.org/c/@Path_addRRect](https://fiddle.skia.org/c/@Path_addRRect)
*/
*/
@JvmOverloads
fun
addRRect
(
rrect
:
RRect
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
,
start
:
Int
=
6
):
Path
{
fun
addRRect
(
rrect
:
RRect
,
dir
:
PathDirection
=
PathDirection
.
CLOCKWISE
,
start
:
Int
=
6
):
Path
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddRRect
(
_ptr
,
rrect
.
left
,
rrect
.
top
,
rrect
.
right
,
rrect
.
bottom
,
rrect
.
radii
,
dir
.
ordinal
,
start
)
_nAddRRect
(
_ptr
,
rrect
.
left
,
rrect
.
top
,
rrect
.
right
,
rrect
.
bottom
,
rrect
.
radii
,
dir
.
ordinal
,
start
)
...
@@ -1799,7 +1796,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1799,7 +1796,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
* @see [https://fiddle.skia.org/c/@Path_addPoly](https://fiddle.skia.org/c/@Path_addPoly)
* @see [https://fiddle.skia.org/c/@Path_addPoly](https://fiddle.skia.org/c/@Path_addPoly)
*/
*/
fun
addPoly
(
pts
:
FloatArray
,
close
:
Boolean
):
Path
{
fun
addPoly
(
pts
:
FloatArray
,
close
:
Boolean
):
Path
{
assert
(
pts
.
size
%
2
==
0
)
{
"Expected even amount of pts, got "
+
pts
.
size
}
require
(
pts
.
size
%
2
==
0
)
{
"Expected even amount of pts, got "
+
pts
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddPoly
(
_ptr
,
pts
,
close
)
_nAddPoly
(
_ptr
,
pts
,
close
)
return
this
return
this
...
@@ -1828,18 +1825,17 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1828,18 +1825,17 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
* @param src Path verbs, Point, and conic weights to add
* @param src Path verbs, Point, and conic weights to add
* @return reference to Path
* @return reference to Path
*/
*/
@JvmOverloads
fun
addPath
(
src
:
Path
?,
extend
:
Boolean
=
false
):
Path
{
fun
addPath
(
src
:
Path
?,
extend
:
Boolean
=
false
):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddPath
(
_nAddPath
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
src
),
getPtr
(
src
),
extend
extend
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
src
)
}
}
}
}
/**
/**
...
@@ -1870,20 +1866,19 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1870,20 +1866,19 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
* @param dy offset added to src Point array y-axis coordinates
* @param dy offset added to src Point array y-axis coordinates
* @return reference to Path
* @return reference to Path
*/
*/
@JvmOverloads
fun
addPath
(
src
:
Path
?,
dx
:
Float
,
dy
:
Float
,
extend
:
Boolean
=
false
):
Path
{
fun
addPath
(
src
:
Path
?,
dx
:
Float
,
dy
:
Float
,
extend
:
Boolean
=
false
):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddPathOffset
(
_nAddPathOffset
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
src
),
getPtr
(
src
),
dx
,
dx
,
dy
,
dy
,
extend
extend
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
src
)
}
}
}
}
/**
/**
...
@@ -1914,19 +1909,18 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1914,19 +1909,18 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
* @param matrix transform applied to src
* @param matrix transform applied to src
* @return reference to Path
* @return reference to Path
*/
*/
@JvmOverloads
fun
addPath
(
src
:
Path
?,
matrix
:
Matrix33
,
extend
:
Boolean
=
false
):
Path
{
fun
addPath
(
src
:
Path
?,
matrix
:
Matrix33
,
extend
:
Boolean
=
false
):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nAddPathTransform
(
_nAddPathTransform
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
src
),
getPtr
(
src
),
matrix
.
mat
,
matrix
.
mat
,
extend
extend
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
src
)
}
}
}
}
...
@@ -1942,10 +1936,10 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1942,10 +1936,10 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
fun
reverseAddPath
(
src
:
Path
?):
Path
{
fun
reverseAddPath
(
src
:
Path
?):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nReverseAddPath
(
_ptr
,
Native
.
Companion
.
getPtr
(
src
))
_nReverseAddPath
(
_ptr
,
getPtr
(
src
))
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
src
)
}
}
}
}
/**
/**
...
@@ -1966,14 +1960,13 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -1966,14 +1960,13 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
* @param dy offset added to Point array y-axis coordinates
* @param dy offset added to Point array y-axis coordinates
* @return this
* @return this
*/
*/
@JvmOverloads
fun
offset
(
dx
:
Float
,
dy
:
Float
,
dst
:
Path
?
=
null
):
Path
{
fun
offset
(
dx
:
Float
,
dy
:
Float
,
dst
:
Path
?
=
null
):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nOffset
(
_ptr
,
dx
,
dy
,
Native
.
Companion
.
getPtr
(
dst
))
_nOffset
(
_ptr
,
dx
,
dy
,
getPtr
(
dst
))
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
}
}
}
}
...
@@ -2022,19 +2015,18 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2022,19 +2015,18 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
*
*
* @see [https://fiddle.skia.org/c/@Path_transform](https://fiddle.skia.org/c/@Path_transform)
* @see [https://fiddle.skia.org/c/@Path_transform](https://fiddle.skia.org/c/@Path_transform)
*/
*/
@JvmOverloads
fun
transform
(
matrix
:
Matrix33
,
dst
:
Path
?
=
null
,
applyPerspectiveClip
:
Boolean
=
true
):
Path
{
fun
transform
(
matrix
:
Matrix33
,
dst
:
Path
?
=
null
,
applyPerspectiveClip
:
Boolean
=
true
):
Path
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nTransform
(
_nTransform
(
_ptr
,
_ptr
,
matrix
.
mat
,
matrix
.
mat
,
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
applyPerspectiveClip
applyPerspectiveClip
)
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
}
}
}
}
...
@@ -2050,7 +2042,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2050,7 +2042,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetLastPt
(
_ptr
)
_nGetLastPt
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -2106,7 +2098,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2106,7 +2098,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetSegmentMasks
(
_ptr
)
_nGetSegmentMasks
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
override
fun
iterator
():
PathSegmentIterator
{
override
fun
iterator
():
PathSegmentIterator
{
...
@@ -2132,7 +2124,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2132,7 +2124,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nContains
(
_ptr
,
x
,
y
)
_nContains
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -2206,7 +2198,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2206,7 +2198,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSerializeToBytes
(
_ptr
)
_nSerializeToBytes
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -2233,7 +2225,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2233,7 +2225,7 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetGenerationId
(
_ptr
)
_nGetGenerationId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -2248,6 +2240,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
...
@@ -2248,6 +2240,6 @@ class Path internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR),
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsValid
(
_ptr
)
_nIsValid
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/PathEffect.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/PathEffect.kt
View file @
f794e4bb
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
PathEffect
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
PathEffect
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -13,14 +13,14 @@ class PathEffect internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -13,14 +13,14 @@ class PathEffect internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PathEffect
(
PathEffect
(
_nMakePath1D
(
_nMakePath1D
(
Native
.
Companion
.
getPtr
(
path
),
getPtr
(
path
),
advance
,
advance
,
phase
,
phase
,
style
.
ordinal
style
.
ordinal
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
path
)
reachabilityBarrier
(
path
)
}
}
}
}
...
@@ -30,11 +30,11 @@ class PathEffect internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -30,11 +30,11 @@ class PathEffect internal constructor(ptr: Long) : RefCnt(ptr) {
PathEffect
(
PathEffect
(
_nMakePath2D
(
_nMakePath2D
(
matrix
.
mat
,
matrix
.
mat
,
Native
.
Companion
.
getPtr
(
path
)
getPtr
(
path
)
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
path
)
reachabilityBarrier
(
path
)
}
}
}
}
...
@@ -86,20 +86,20 @@ class PathEffect internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -86,20 +86,20 @@ class PathEffect internal constructor(ptr: Long) : RefCnt(ptr) {
fun
makeSum
(
second
:
PathEffect
?):
PathEffect
{
fun
makeSum
(
second
:
PathEffect
?):
PathEffect
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PathEffect
(
_nMakeSum
(
_ptr
,
Native
.
Companion
.
getPtr
(
second
)))
PathEffect
(
_nMakeSum
(
_ptr
,
getPtr
(
second
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
second
)
reachabilityBarrier
(
second
)
}
}
}
}
fun
makeCompose
(
inner
:
PathEffect
?):
PathEffect
{
fun
makeCompose
(
inner
:
PathEffect
?):
PathEffect
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
PathEffect
(
_nMakeCompose
(
_ptr
,
Native
.
Companion
.
getPtr
(
inner
)))
PathEffect
(
_nMakeCompose
(
_ptr
,
getPtr
(
inner
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
inner
)
reachabilityBarrier
(
inner
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/PathSegment.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/PathSegment.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
java.lang.RuntimeException
class
PathSegment
constructor
(
import
java.util.*
class
PathSegment
@JvmOverloads
constructor
(
val
verb
:
PathVerb
=
PathVerb
.
DONE
,
val
verb
:
PathVerb
=
PathVerb
.
DONE
,
val
p0
:
Point
?
=
null
,
val
p0
:
Point
?
=
null
,
val
p1
:
Point
?
=
null
,
val
p1
:
Point
?
=
null
,
...
@@ -17,9 +14,9 @@ class PathSegment @JvmOverloads constructor(
...
@@ -17,9 +14,9 @@ class PathSegment @JvmOverloads constructor(
constructor
(
verbOrdinal
:
Int
,
x0
:
Float
,
y0
:
Float
,
isClosedContour
:
Boolean
)
:
this
(
constructor
(
verbOrdinal
:
Int
,
x0
:
Float
,
y0
:
Float
,
isClosedContour
:
Boolean
)
:
this
(
PathVerb
.
values
().
get
(
PathVerb
.
values
().
get
(
verbOrdinal
verbOrdinal
),
org
.
jetbrains
.
skia
.
Point
(
x0
,
y0
),
null
,
null
,
null
,
0.0f
,
false
,
isClosedContour
),
Point
(
x0
,
y0
),
null
,
null
,
null
,
0.0f
,
false
,
isClosedContour
)
{
)
{
assert
(
verbOrdinal
==
PathVerb
.
MOVE
.
ordinal
||
verbOrdinal
==
PathVerb
.
CLOSE
.
ordinal
)
{
require
(
verbOrdinal
==
PathVerb
.
MOVE
.
ordinal
||
verbOrdinal
==
PathVerb
.
CLOSE
.
ordinal
)
{
"Expected MOVE or CLOSE, got "
+
PathVerb
.
values
().
get
(
"Expected MOVE or CLOSE, got "
+
PathVerb
.
values
().
get
(
verbOrdinal
verbOrdinal
)
)
...
@@ -28,8 +25,8 @@ class PathSegment @JvmOverloads constructor(
...
@@ -28,8 +25,8 @@ class PathSegment @JvmOverloads constructor(
constructor
(
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
isCloseLine
:
Boolean
,
isClosedContour
:
Boolean
)
:
this
(
constructor
(
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
isCloseLine
:
Boolean
,
isClosedContour
:
Boolean
)
:
this
(
PathVerb
.
LINE
,
PathVerb
.
LINE
,
org
.
jetbrains
.
skia
.
Point
(
x0
,
y0
),
Point
(
x0
,
y0
),
org
.
jetbrains
.
skia
.
Point
(
x1
,
y1
),
Point
(
x1
,
y1
),
null
,
null
,
null
,
null
,
0.0f
,
0.0f
,
...
@@ -40,9 +37,9 @@ class PathSegment @JvmOverloads constructor(
...
@@ -40,9 +37,9 @@ class PathSegment @JvmOverloads constructor(
constructor
(
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
x2
:
Float
,
y2
:
Float
,
isClosedContour
:
Boolean
)
:
this
(
constructor
(
x0
:
Float
,
y0
:
Float
,
x1
:
Float
,
y1
:
Float
,
x2
:
Float
,
y2
:
Float
,
isClosedContour
:
Boolean
)
:
this
(
PathVerb
.
QUAD
,
PathVerb
.
QUAD
,
org
.
jetbrains
.
skia
.
Point
(
x0
,
y0
),
Point
(
x0
,
y0
),
org
.
jetbrains
.
skia
.
Point
(
x1
,
y1
),
Point
(
x1
,
y1
),
org
.
jetbrains
.
skia
.
Point
(
x2
,
y2
),
Point
(
x2
,
y2
),
null
,
null
,
0.0f
,
0.0f
,
false
,
false
,
...
@@ -61,9 +58,9 @@ class PathSegment @JvmOverloads constructor(
...
@@ -61,9 +58,9 @@ class PathSegment @JvmOverloads constructor(
isClosedContour
:
Boolean
isClosedContour
:
Boolean
)
:
this
(
)
:
this
(
PathVerb
.
CONIC
,
PathVerb
.
CONIC
,
org
.
jetbrains
.
skia
.
Point
(
x0
,
y0
),
Point
(
x0
,
y0
),
org
.
jetbrains
.
skia
.
Point
(
x1
,
y1
),
Point
(
x1
,
y1
),
org
.
jetbrains
.
skia
.
Point
(
x2
,
y2
),
Point
(
x2
,
y2
),
null
,
null
,
conicWeight
,
conicWeight
,
false
,
false
,
...
@@ -83,10 +80,10 @@ class PathSegment @JvmOverloads constructor(
...
@@ -83,10 +80,10 @@ class PathSegment @JvmOverloads constructor(
isClosedContour
:
Boolean
isClosedContour
:
Boolean
)
:
this
(
)
:
this
(
PathVerb
.
CUBIC
,
PathVerb
.
CUBIC
,
org
.
jetbrains
.
skia
.
Point
(
x0
,
y0
),
Point
(
x0
,
y0
),
org
.
jetbrains
.
skia
.
Point
(
x1
,
y1
),
Point
(
x1
,
y1
),
org
.
jetbrains
.
skia
.
Point
(
x2
,
y2
),
Point
(
x2
,
y2
),
org
.
jetbrains
.
skia
.
Point
(
x3
,
y3
),
Point
(
x3
,
y3
),
0.0f
,
0.0f
,
false
,
false
,
isClosedContour
isClosedContour
...
@@ -94,26 +91,30 @@ class PathSegment @JvmOverloads constructor(
...
@@ -94,26 +91,30 @@ class PathSegment @JvmOverloads constructor(
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"Segment("
+
"verb="
+
verb
+
(
if
(
verb
!=
PathVerb
.
DONE
)
", p0=
"
+
p0
else
""
)
+
(
if
(
verb
==
PathVerb
.
LINE
||
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
", p1="
+
p1
else
""
)
+
(
if
(
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
", p2="
+
p2
else
""
)
+
(
if
(
verb
==
PathVerb
.
CUBIC
)
", p3="
+
p3
else
""
)
+
(
if
(
verb
==
PathVerb
.
CONIC
)
", conicWeight="
+
conicWeight
else
""
)
+
(
if
(
verb
==
PathVerb
.
LINE
)
", closeLine="
+
isCloseLine
else
""
)
+
(
if
(
verb
!=
PathVerb
.
DONE
)
", closedContour="
+
isClosedContour
else
""
)
+
")"
return
"Segment("
+
"verb="
+
verb
+
(
if
(
verb
!=
PathVerb
.
DONE
)
", p0=
$p0"
else
""
)
+
(
if
(
verb
==
PathVerb
.
LINE
||
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
", p1="
+
p1
else
""
)
+
(
if
(
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
", p2="
+
p2
else
""
)
+
(
if
(
verb
==
PathVerb
.
CUBIC
)
", p3="
+
p3
else
""
)
+
(
if
(
verb
==
PathVerb
.
CONIC
)
", conicWeight="
+
conicWeight
else
""
)
+
(
if
(
verb
==
PathVerb
.
LINE
)
", closeLine="
+
isCloseLine
else
""
)
+
(
if
(
verb
!=
PathVerb
.
DONE
)
", closedContour="
+
isClosedContour
else
""
)
+
")"
}
}
override
fun
equals
(
o
:
Any
?):
Boolean
{
override
fun
equals
(
o
:
Any
?):
Boolean
{
if
(
this
===
o
)
return
true
if
(
this
===
o
)
return
true
if
(
o
==
null
||
javaClass
!=
o
.
javaClass
)
return
false
if
(
o
==
null
||
o
!
is
PathSegment
)
return
false
val
segment
=
o
as
PathSegment
val
segment
=
o
return
verb
==
segment
.
verb
&&
(
if
(
verb
!=
PathVerb
.
DONE
)
p0
==
segment
.
p0
else
true
)
&&
(
if
(
verb
==
PathVerb
.
LINE
||
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
p1
==
segment
.
p1
else
true
)
&&
(
if
(
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
p2
==
segment
.
p2
else
true
)
&&
(
if
(
verb
==
PathVerb
.
CUBIC
)
p3
==
segment
.
p3
else
true
)
&&
(
if
(
verb
==
PathVerb
.
CONIC
)
java
.
lang
.
Float
.
compare
(
return
verb
==
segment
.
verb
&&
segment
.
conicWeight
,
(
if
(
verb
!=
PathVerb
.
DONE
)
p0
==
segment
.
p0
else
true
)
&&
conicWeight
(
if
(
verb
==
PathVerb
.
LINE
||
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
p1
==
segment
.
p1
else
true
)
&&
)
==
0
else
true
)
&&
(
if
(
verb
==
PathVerb
.
LINE
)
isCloseLine
==
segment
.
isCloseLine
else
true
)
&&
if
(
verb
!=
PathVerb
.
DONE
)
isClosedContour
==
segment
.
isClosedContour
else
true
(
if
(
verb
==
PathVerb
.
QUAD
||
verb
==
PathVerb
.
CONIC
||
verb
==
PathVerb
.
CUBIC
)
p2
==
segment
.
p2
else
true
)
&&
(
if
(
verb
==
PathVerb
.
CUBIC
)
p3
==
segment
.
p3
else
true
)
&&
(
if
(
verb
==
PathVerb
.
CONIC
)
segment
.
conicWeight
.
compareTo
(
conicWeight
)
==
0
else
true
)
&&
(
if
(
verb
==
PathVerb
.
LINE
)
isCloseLine
==
segment
.
isCloseLine
else
true
)
&&
if
(
verb
!=
PathVerb
.
DONE
)
isClosedContour
==
segment
.
isClosedContour
else
true
}
}
override
fun
hashCode
():
Int
{
override
fun
hashCode
():
Int
{
return
when
(
verb
)
{
return
when
(
verb
)
{
PathVerb
.
DONE
->
Objects
.
hash
(
verb
)
PathVerb
.
DONE
->
objectHashes
(
verb
)
PathVerb
.
MOVE
->
Objects
.
hash
(
verb
,
p0
,
isClosedContour
)
PathVerb
.
MOVE
->
objectHashes
(
verb
,
p0
,
isClosedContour
)
PathVerb
.
LINE
->
Objects
.
hash
(
verb
,
p0
,
p1
,
isCloseLine
,
isClosedContour
)
PathVerb
.
LINE
->
objectHashes
(
verb
,
p0
,
p1
,
isCloseLine
,
isClosedContour
)
PathVerb
.
QUAD
->
Objects
.
hash
(
verb
,
p0
,
p1
,
p2
,
isClosedContour
)
PathVerb
.
QUAD
->
objectHashes
(
verb
,
p0
,
p1
,
p2
,
isClosedContour
)
PathVerb
.
CONIC
->
Objects
.
hash
(
PathVerb
.
CONIC
->
objectHashes
(
verb
,
verb
,
p0
,
p0
,
p1
,
p1
,
...
@@ -121,8 +122,12 @@ class PathSegment @JvmOverloads constructor(
...
@@ -121,8 +122,12 @@ class PathSegment @JvmOverloads constructor(
conicWeight
,
conicWeight
,
isClosedContour
isClosedContour
)
)
PathVerb
.
CUBIC
->
Objects
.
hash
(
verb
,
p0
,
p1
,
p2
,
p3
,
isClosedContour
)
PathVerb
.
CUBIC
->
objectHashes
(
verb
,
p0
,
p1
,
p2
,
p3
,
isClosedContour
)
else
->
throw
RuntimeException
(
"Unreachable"
)
else
->
throw
RuntimeException
(
"Unreachable"
)
}
}
}
}
}
internal
fun
objectHashes
(
vararg
args
:
Any
?):
Int
{
return
args
.
contentHashCode
()
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/PathSegmentIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/PathSegmentIterator.kt
View file @
f794e4bb
...
@@ -2,10 +2,8 @@ package org.jetbrains.skia
...
@@ -2,10 +2,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.util.NoSuchElementException
class
PathSegmentIterator
internal
constructor
(
val
_path
:
Path
?,
ptr
:
Long
)
:
Managed
(
ptr
,
_nGetFinalizer
()),
class
PathSegmentIterator
internal
constructor
(
val
_path
:
Path
?,
ptr
:
Long
)
:
Managed
(
ptr
,
_nGetFinalizer
()),
MutableIterator
<
PathSegment
?>
{
MutableIterator
<
PathSegment
?>
{
...
@@ -13,12 +11,12 @@ class PathSegmentIterator internal constructor(val _path: Path?, ptr: Long) : Ma
...
@@ -13,12 +11,12 @@ class PathSegmentIterator internal constructor(val _path: Path?, ptr: Long) : Ma
fun
make
(
path
:
Path
?,
forceClose
:
Boolean
):
PathSegmentIterator
{
fun
make
(
path
:
Path
?,
forceClose
:
Boolean
):
PathSegmentIterator
{
return
try
{
return
try
{
val
ptr
=
val
ptr
=
_nMake
(
Native
.
Companion
.
getPtr
(
path
),
forceClose
)
_nMake
(
getPtr
(
path
),
forceClose
)
val
i
=
PathSegmentIterator
(
path
,
ptr
)
val
i
=
PathSegmentIterator
(
path
,
ptr
)
i
.
_nextSegment
=
_nNext
(
ptr
)
i
.
_nextSegment
=
_nNext
(
ptr
)
i
i
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
path
)
reachabilityBarrier
(
path
)
}
}
}
}
...
@@ -39,7 +37,7 @@ class PathSegmentIterator internal constructor(val _path: Path?, ptr: Long) : Ma
...
@@ -39,7 +37,7 @@ class PathSegmentIterator internal constructor(val _path: Path?, ptr: Long) : Ma
_nextSegment
=
_nNext
(
_ptr
)
_nextSegment
=
_nNext
(
_ptr
)
res
res
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Picture.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Picture.kt
View file @
f794e4bb
...
@@ -2,10 +2,9 @@ package org.jetbrains.skia
...
@@ -2,10 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.util.function.BooleanSupplier
import
kotlin.jvm.JvmStatic
class
Picture
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
Picture
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -17,10 +16,10 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -17,10 +16,10 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
fun
makeFromData
(
data
:
Data
?):
Picture
?
{
fun
makeFromData
(
data
:
Data
?):
Picture
?
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeFromData
(
Native
.
getPtr
(
data
))
val
ptr
=
_nMakeFromData
(
getPtr
(
data
))
if
(
ptr
==
0L
)
null
else
Picture
(
ptr
)
if
(
ptr
==
0L
)
null
else
Picture
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
data
)
reachabilityBarrier
(
data
)
}
}
}
}
...
@@ -94,14 +93,13 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -94,14 +93,13 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
*
*
* @see [https://fiddle.skia.org/c/@Picture_playback](https://fiddle.skia.org/c/@Picture_playback)
* @see [https://fiddle.skia.org/c/@Picture_playback](https://fiddle.skia.org/c/@Picture_playback)
*/
*/
@JvmOverloads
fun
playback
(
canvas
:
Canvas
?,
abort
:
BooleanSupplier
?
=
null
):
Picture
{
fun
playback
(
canvas
:
Canvas
?,
abort
:
BooleanSupplier
?
=
null
):
Picture
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nPlayback
(
_ptr
,
Native
.
Companion
.
getPtr
(
canvas
),
abort
)
_nPlayback
(
_ptr
,
getPtr
(
canvas
),
abort
)
this
this
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
canvas
)
reachabilityBarrier
(
canvas
)
}
}
}
}
...
@@ -123,7 +121,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -123,7 +121,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetCullRect
(
_ptr
)
_nGetCullRect
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -136,7 +134,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -136,7 +134,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUniqueId
(
_ptr
)
_nGetUniqueId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -147,9 +145,9 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -147,9 +145,9 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
fun
serializeToData
():
Data
{
fun
serializeToData
():
Data
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
Data
(
_nSerializeToData
(
_ptr
))
Data
(
_nSerializeToData
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -168,7 +166,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -168,7 +166,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetApproximateOpCount
(
_ptr
)
_nGetApproximateOpCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -184,7 +182,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -184,7 +182,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetApproximateBytesUsed
(
_ptr
)
_nGetApproximateBytesUsed
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
* Return a new shader that will draw with this picture.
* Return a new shader that will draw with this picture.
...
@@ -219,7 +217,6 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -219,7 +217,6 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
* @param localMatrix Optional matrix used when sampling
* @param localMatrix Optional matrix used when sampling
* @return Returns a new shader object. Note: this function never returns null.
* @return Returns a new shader object. Note: this function never returns null.
*/
*/
@JvmOverloads
fun
makeShader
(
fun
makeShader
(
tmx
:
FilterTileMode
,
tmx
:
FilterTileMode
,
tmy
:
FilterTileMode
,
tmy
:
FilterTileMode
,
...
@@ -232,7 +229,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -232,7 +229,7 @@ class Picture internal constructor(ptr: Long) : RefCnt(ptr) {
val
arr
=
localMatrix
?.
mat
val
arr
=
localMatrix
?.
mat
Shader
(
_nMakeShader
(
_ptr
,
tmx
.
ordinal
,
tmy
.
ordinal
,
mode
.
ordinal
,
arr
,
tileRect
))
Shader
(
_nMakeShader
(
_ptr
,
tmx
.
ordinal
,
tmy
.
ordinal
,
mode
.
ordinal
,
arr
,
tileRect
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/PixelRef.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/PixelRef.kt
View file @
f794e4bb
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
...
@@ -3,7 +3,8 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
PixelRef
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
PixelRef
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -25,21 +26,21 @@ class PixelRef internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -25,21 +26,21 @@ class PixelRef internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetWidth
(
_ptr
)
_nGetWidth
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
height
:
Int
val
height
:
Int
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetHeight
(
_ptr
)
_nGetHeight
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
rowBytes
:
Long
val
rowBytes
:
Long
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetRowBytes
(
_ptr
)
_nGetRowBytes
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -52,7 +53,7 @@ class PixelRef internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -52,7 +53,7 @@ class PixelRef internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetGenerationId
(
_ptr
)
_nGetGenerationId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -75,7 +76,7 @@ class PixelRef internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -75,7 +76,7 @@ class PixelRef internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsImmutable
(
_ptr
)
_nIsImmutable
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Pixmap.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Pixmap.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
org.jetbrains.skia.impl.*
import
org.jetbrains.skia.impl.*
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
import
java.nio.ByteBuffer
class
Pixmap
internal
constructor
(
ptr
:
Long
,
managed
:
Boolean
)
:
class
Pixmap
internal
constructor
(
ptr
:
Long
,
managed
:
Boolean
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
,
managed
)
{
Managed
(
ptr
,
_FinalizerHolder
.
PTR
,
managed
)
{
...
@@ -13,7 +12,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -13,7 +12,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
fun
reset
()
{
fun
reset
()
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nReset
(
_ptr
)
_nReset
(
_ptr
)
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
fun
reset
(
info
:
ImageInfo
,
addr
:
Long
,
rowBytes
:
Int
)
{
fun
reset
(
info
:
ImageInfo
,
addr
:
Long
,
rowBytes
:
Int
)
{
...
@@ -23,10 +22,10 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -23,10 +22,10 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
info
.
width
,
info
.
height
,
info
.
width
,
info
.
height
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
)
)
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
info
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
info
.
colorInfo
.
colorSpace
)
}
}
fun
reset
(
info
:
ImageInfo
,
buffer
:
ByteBuffer
,
rowBytes
:
Int
)
{
fun
reset
(
info
:
ImageInfo
,
buffer
:
ByteBuffer
,
rowBytes
:
Int
)
{
...
@@ -35,9 +34,9 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -35,9 +34,9 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
fun
setColorSpace
(
colorSpace
:
ColorSpace
?)
{
fun
setColorSpace
(
colorSpace
:
ColorSpace
?)
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetColorSpace
(
_ptr
,
Native
.
Companion
.
getPtr
(
colorSpace
))
_nSetColorSpace
(
_ptr
,
getPtr
(
colorSpace
))
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
colorSpace
)
reachabilityBarrier
(
colorSpace
)
}
}
fun
extractSubset
(
subsetPtr
:
Long
,
area
:
IRect
):
Boolean
{
fun
extractSubset
(
subsetPtr
:
Long
,
area
:
IRect
):
Boolean
{
...
@@ -52,7 +51,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -52,7 +51,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
area
.
bottom
area
.
bottom
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -66,7 +65,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -66,7 +65,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetInfo
(
_ptr
)
_nGetInfo
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
rowBytes
:
Int
val
rowBytes
:
Int
...
@@ -75,7 +74,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -75,7 +74,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetRowBytes
(
_ptr
)
_nGetRowBytes
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
addr
:
Long
val
addr
:
Long
...
@@ -84,7 +83,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -84,7 +83,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetAddr
(
_ptr
)
_nGetAddr
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
rowBytesAsPixels
:
Int
val
rowBytesAsPixels
:
Int
...
@@ -93,7 +92,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -93,7 +92,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetRowBytesAsPixels
(
_ptr
)
_nGetRowBytesAsPixels
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -102,7 +101,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -102,7 +101,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nComputeByteSize
(
_ptr
)
_nComputeByteSize
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -111,7 +110,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -111,7 +110,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nComputeIsOpaque
(
_ptr
)
_nComputeIsOpaque
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -120,7 +119,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -120,7 +119,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetColor
(
_ptr
,
x
,
y
)
_nGetColor
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -129,7 +128,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -129,7 +128,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetAlphaF
(
_ptr
,
x
,
y
)
_nGetAlphaF
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -138,7 +137,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -138,7 +137,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nGetAddrAt
(
_ptr
,
x
,
y
)
_nGetAddrAt
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -150,11 +149,11 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -150,11 +149,11 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
info
.
width
,
info
.
height
,
info
.
width
,
info
.
height
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
info
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
info
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -166,12 +165,12 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -166,12 +165,12 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
info
.
width
,
info
.
height
,
info
.
width
,
info
.
height
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
,
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
,
srcX
,
srcY
srcX
,
srcY
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
info
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
info
.
colorInfo
.
colorSpace
)
}
}
}
}
...
@@ -180,11 +179,11 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -180,11 +179,11 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nReadPixelsToPixmap
(
_nReadPixelsToPixmap
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
pixmap
)
getPtr
(
pixmap
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
pixmap
)
reachabilityBarrier
(
pixmap
)
}
}
}
}
...
@@ -193,13 +192,13 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -193,13 +192,13 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nReadPixelsToPixmapFromPoint
(
_nReadPixelsToPixmapFromPoint
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
pixmap
),
getPtr
(
pixmap
),
srcX
,
srcX
,
srcY
srcY
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
pixmap
)
reachabilityBarrier
(
pixmap
)
}
}
}
}
...
@@ -208,12 +207,12 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -208,12 +207,12 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nScalePixels
(
_nScalePixels
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
dstPixmap
),
getPtr
(
dstPixmap
),
samplingMode
.
_pack
()
samplingMode
.
_pack
()
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
dstPixmap
)
reachabilityBarrier
(
dstPixmap
)
}
}
}
}
...
@@ -222,7 +221,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -222,7 +221,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
return
try
{
return
try
{
_nErase
(
_ptr
,
color
)
_nErase
(
_ptr
,
color
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -238,7 +237,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -238,7 +237,7 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
subset
.
bottom
subset
.
bottom
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -260,12 +259,12 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
...
@@ -260,12 +259,12 @@ class Pixmap internal constructor(ptr: Long, managed: Boolean) :
info
.
width
,
info
.
height
,
info
.
width
,
info
.
height
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
colorType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
info
.
colorInfo
.
alphaType
.
ordinal
,
Native
.
Companion
.
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
getPtr
(
info
.
colorInfo
.
colorSpace
),
addr
,
rowBytes
)
)
require
(
ptr
!=
0L
)
{
"Failed to create Pixmap."
}
require
(
ptr
!=
0L
)
{
"Failed to create Pixmap."
}
Pixmap
(
ptr
,
true
)
Pixmap
(
ptr
,
true
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
info
.
colorInfo
.
colorSpace
)
reachabilityBarrier
(
info
.
colorInfo
.
colorSpace
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/RSXform.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/RSXform.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
kotlin.math.cos
import
kotlin.math.sin
/**
/**
*
*
* A compressed form of a rotation+scale matrix.
* A compressed form of a rotation+scale matrix.
...
@@ -20,10 +23,10 @@ class RSXform(
...
@@ -20,10 +23,10 @@ class RSXform(
if
(
o
!
is
RSXform
)
return
false
if
(
o
!
is
RSXform
)
return
false
val
other
=
o
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(
java
.
lang
.
Float
.
compare
(
scos
,
other
.
scos
)
!=
0
)
return
false
if
(
scos
.
compareTo
(
other
.
scos
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
ssin
,
other
.
ssin
)
!=
0
)
return
false
if
(
ssin
.
compareTo
(
other
.
ssin
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
tx
,
other
.
tx
)
!=
0
)
return
false
if
(
tx
.
compareTo
(
other
.
tx
)
!=
0
)
return
false
return
if
(
java
.
lang
.
Float
.
compare
(
ty
,
other
.
ty
)
!=
0
)
false
else
true
return
ty
.
compareTo
(
other
.
ty
)
==
0
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -33,15 +36,15 @@ class RSXform(
...
@@ -33,15 +36,15 @@ class RSXform(
override
fun
hashCode
():
Int
{
override
fun
hashCode
():
Int
{
val
PRIME
=
59
val
PRIME
=
59
var
result
=
1
var
result
=
1
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
scos
)
result
=
result
*
PRIME
+
scos
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
ssin
)
result
=
result
*
PRIME
+
ssin
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
tx
)
result
=
result
*
PRIME
+
tx
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
ty
)
result
=
result
*
PRIME
+
ty
.
toBits
(
)
return
result
return
result
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"RSXform(_scos=
"
+
scos
+
", _ssin="
+
ssin
+
", _tx="
+
tx
+
", _ty="
+
ty
+
"
)"
return
"RSXform(_scos=
$scos, _ssin=$ssin, _tx=$tx, _ty=$ty
)"
}
}
companion
object
{
companion
object
{
...
@@ -52,8 +55,8 @@ class RSXform(
...
@@ -52,8 +55,8 @@ class RSXform(
* Note: the anchor point is not normalized (e.g. 0...1) but is in pixels of the src image.
* Note: the anchor point is not normalized (e.g. 0...1) but is in pixels of the src image.
*/
*/
fun
makeFromRadians
(
scale
:
Float
,
radians
:
Float
,
tx
:
Float
,
ty
:
Float
,
ax
:
Float
,
ay
:
Float
):
RSXform
{
fun
makeFromRadians
(
scale
:
Float
,
radians
:
Float
,
tx
:
Float
,
ty
:
Float
,
ax
:
Float
,
ay
:
Float
):
RSXform
{
val
s
=
Math
.
sin
(
radians
.
toDouble
()).
toFloat
()
*
scale
val
s
=
sin
(
radians
.
toDouble
()).
toFloat
()
*
scale
val
c
=
Math
.
cos
(
radians
.
toDouble
()).
toFloat
()
*
scale
val
c
=
cos
(
radians
.
toDouble
()).
toFloat
()
*
scale
return
RSXform
(
c
,
s
,
tx
+
-
c
*
ax
+
s
*
ay
,
ty
+
-
s
*
ax
-
c
*
ay
)
return
RSXform
(
c
,
s
,
tx
+
-
c
*
ax
+
s
*
ay
,
ty
+
-
s
*
ax
-
c
*
ay
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Region.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Region.kt
View file @
f794e4bb
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
Region
:
Managed
(
_nMake
(),
_FinalizerHolder
.
PTR
)
{
class
Region
:
Managed
(
_nMake
(),
_FinalizerHolder
.
PTR
)
{
companion
object
{
companion
object
{
...
@@ -71,10 +71,10 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -71,10 +71,10 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
fun
set
(
r
:
Region
?):
Boolean
{
fun
set
(
r
:
Region
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSet
(
_ptr
,
Native
.
Companion
.
getPtr
(
r
))
_nSet
(
_ptr
,
getPtr
(
r
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -83,28 +83,28 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -83,28 +83,28 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsEmpty
(
_ptr
)
_nIsEmpty
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
isRect
:
Boolean
val
isRect
:
Boolean
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsRect
(
_ptr
)
_nIsRect
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
isComplex
:
Boolean
val
isComplex
:
Boolean
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsComplex
(
_ptr
)
_nIsComplex
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
val
bounds
:
IRect
val
bounds
:
IRect
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetBounds
(
_ptr
)
_nGetBounds
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
fun
computeRegionComplexity
():
Int
{
fun
computeRegionComplexity
():
Int
{
...
@@ -112,7 +112,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -112,7 +112,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nComputeRegionComplexity
(
_ptr
)
_nComputeRegionComplexity
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -121,11 +121,11 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -121,11 +121,11 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetBoundaryPath
(
_nGetBoundaryPath
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
p
)
getPtr
(
p
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
p
)
reachabilityBarrier
(
p
)
}
}
}
}
...
@@ -134,7 +134,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -134,7 +134,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetEmpty
(
_ptr
)
_nSetEmpty
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -143,7 +143,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -143,7 +143,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
_nSetRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -159,17 +159,17 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -159,17 +159,17 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetRects
(
_ptr
,
arr
)
_nSetRects
(
_ptr
,
arr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
fun
setRegion
(
r
:
Region
?):
Boolean
{
fun
setRegion
(
r
:
Region
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetRegion
(
_ptr
,
Native
.
Companion
.
getPtr
(
r
))
_nSetRegion
(
_ptr
,
getPtr
(
r
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -178,13 +178,13 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -178,13 +178,13 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nSetPath
(
_nSetPath
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
path
),
getPtr
(
path
),
Native
.
Companion
.
getPtr
(
clip
)
getPtr
(
clip
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
path
)
reachabilityBarrier
(
path
)
Reference
.
reachabilityFence
(
clip
)
reachabilityBarrier
(
clip
)
}
}
}
}
...
@@ -193,7 +193,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -193,7 +193,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIntersectsIRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
_nIntersectsIRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -202,11 +202,11 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -202,11 +202,11 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIntersectsRegion
(
_nIntersectsRegion
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
r
)
getPtr
(
r
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -215,7 +215,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -215,7 +215,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nContainsIPoint
(
_ptr
,
x
,
y
)
_nContainsIPoint
(
_ptr
,
x
,
y
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -224,17 +224,17 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -224,17 +224,17 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nContainsIRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
_nContainsIRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
operator
fun
contains
(
r
:
Region
?):
Boolean
{
operator
fun
contains
(
r
:
Region
?):
Boolean
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nContainsRegion
(
_ptr
,
Native
.
Companion
.
getPtr
(
r
))
_nContainsRegion
(
_ptr
,
getPtr
(
r
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -243,7 +243,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -243,7 +243,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nQuickContains
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
_nQuickContains
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -252,7 +252,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -252,7 +252,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nQuickRejectIRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
_nQuickRejectIRect
(
_ptr
,
rect
.
left
,
rect
.
top
,
rect
.
right
,
rect
.
bottom
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -261,11 +261,11 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -261,11 +261,11 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nQuickRejectRegion
(
_nQuickRejectRegion
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
r
)
getPtr
(
r
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -274,7 +274,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -274,7 +274,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nTranslate
(
_ptr
,
dx
,
dy
)
_nTranslate
(
_ptr
,
dx
,
dy
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -290,7 +290,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -290,7 +290,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
op
.
ordinal
op
.
ordinal
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -299,12 +299,12 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -299,12 +299,12 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nOpRegion
(
_nOpRegion
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
r
),
getPtr
(
r
),
op
.
ordinal
op
.
ordinal
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -317,12 +317,12 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -317,12 +317,12 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
rect
.
top
,
rect
.
top
,
rect
.
right
,
rect
.
right
,
rect
.
bottom
,
rect
.
bottom
,
Native
.
Companion
.
getPtr
(
r
),
getPtr
(
r
),
op
.
ordinal
op
.
ordinal
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -331,7 +331,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -331,7 +331,7 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nOpRegionIRect
(
_nOpRegionIRect
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
r
),
getPtr
(
r
),
rect
.
left
,
rect
.
left
,
rect
.
top
,
rect
.
top
,
rect
.
right
,
rect
.
right
,
...
@@ -339,8 +339,8 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -339,8 +339,8 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
op
.
ordinal
op
.
ordinal
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
r
)
reachabilityBarrier
(
r
)
}
}
}
}
...
@@ -349,14 +349,14 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
...
@@ -349,14 +349,14 @@ class Region : Managed(_nMake(), _FinalizerHolder.PTR) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nOpRegionRegion
(
_nOpRegionRegion
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
a
),
getPtr
(
a
),
Native
.
Companion
.
getPtr
(
b
),
getPtr
(
b
),
op
.
ordinal
op
.
ordinal
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
a
)
reachabilityBarrier
(
a
)
Reference
.
reachabilityFence
(
b
)
reachabilityBarrier
(
b
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Shader.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Shader.kt
View file @
f794e4bb
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
...
@@ -2,9 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
Shader
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
Shader
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -27,7 +27,6 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -27,7 +27,6 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
return
makeLinearGradient
(
p0
.
x
,
p0
.
y
,
p1
.
x
,
p1
.
y
,
colors
,
positions
,
style
)
return
makeLinearGradient
(
p0
.
x
,
p0
.
y
,
p1
.
x
,
p1
.
y
,
colors
,
positions
,
style
)
}
}
@JvmOverloads
fun
makeLinearGradient
(
fun
makeLinearGradient
(
x0
:
Float
,
x0
:
Float
,
y0
:
Float
,
y0
:
Float
,
...
@@ -37,7 +36,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -37,7 +36,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
positions
:
FloatArray
?
=
null
,
positions
:
FloatArray
?
=
null
,
style
:
GradientStyle
=
GradientStyle
.
Companion
.
DEFAULT
style
:
GradientStyle
=
GradientStyle
.
Companion
.
DEFAULT
):
Shader
{
):
Shader
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
return
Shader
(
return
Shader
(
_nMakeLinearGradient
(
_nMakeLinearGradient
(
...
@@ -76,7 +75,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -76,7 +75,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
style
:
GradientStyle
style
:
GradientStyle
):
Shader
{
):
Shader
{
return
try
{
return
try
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shader
(
Shader
(
_nMakeLinearGradientCS
(
_nMakeLinearGradientCS
(
...
@@ -84,8 +83,8 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -84,8 +83,8 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
y0
,
y0
,
x1
,
x1
,
y1
,
y1
,
Color4f
.
Companion
.
flattenArray
(
colors
),
Color4f
.
flattenArray
(
colors
),
Native
.
Companion
.
getPtr
(
cs
),
getPtr
(
cs
),
positions
,
positions
,
style
.
tileMode
.
ordinal
,
style
.
tileMode
.
ordinal
,
style
.
_getFlags
(),
style
.
_getFlags
(),
...
@@ -93,7 +92,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -93,7 +92,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
cs
)
reachabilityBarrier
(
cs
)
}
}
}
}
...
@@ -116,7 +115,6 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -116,7 +115,6 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
return
makeRadialGradient
(
center
.
x
,
center
.
y
,
r
,
colors
,
positions
,
style
)
return
makeRadialGradient
(
center
.
x
,
center
.
y
,
r
,
colors
,
positions
,
style
)
}
}
@JvmOverloads
fun
makeRadialGradient
(
fun
makeRadialGradient
(
x
:
Float
,
x
:
Float
,
y
:
Float
,
y
:
Float
,
...
@@ -125,7 +123,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -125,7 +123,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
positions
:
FloatArray
?
=
null
,
positions
:
FloatArray
?
=
null
,
style
:
GradientStyle
=
GradientStyle
.
Companion
.
DEFAULT
style
:
GradientStyle
=
GradientStyle
.
Companion
.
DEFAULT
):
Shader
{
):
Shader
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
return
Shader
(
return
Shader
(
_nMakeRadialGradient
(
_nMakeRadialGradient
(
...
@@ -162,15 +160,15 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -162,15 +160,15 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
style
:
GradientStyle
style
:
GradientStyle
):
Shader
{
):
Shader
{
return
try
{
return
try
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shader
(
Shader
(
_nMakeRadialGradientCS
(
_nMakeRadialGradientCS
(
x
,
x
,
y
,
y
,
r
,
r
,
Color4f
.
Companion
.
flattenArray
(
colors
),
Color4f
.
flattenArray
(
colors
),
Native
.
Companion
.
getPtr
(
cs
),
getPtr
(
cs
),
positions
,
positions
,
style
.
tileMode
.
ordinal
,
style
.
tileMode
.
ordinal
,
style
.
_getFlags
(),
style
.
_getFlags
(),
...
@@ -178,7 +176,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -178,7 +176,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
cs
)
reachabilityBarrier
(
cs
)
}
}
}
}
...
@@ -210,7 +208,6 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -210,7 +208,6 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
return
makeTwoPointConicalGradient
(
p0
.
x
,
p0
.
y
,
r0
,
p1
.
x
,
p1
.
y
,
r1
,
colors
,
positions
,
style
)
return
makeTwoPointConicalGradient
(
p0
.
x
,
p0
.
y
,
r0
,
p1
.
x
,
p1
.
y
,
r1
,
colors
,
positions
,
style
)
}
}
@JvmOverloads
fun
makeTwoPointConicalGradient
(
fun
makeTwoPointConicalGradient
(
x0
:
Float
,
x0
:
Float
,
y0
:
Float
,
y0
:
Float
,
...
@@ -222,7 +219,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -222,7 +219,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
positions
:
FloatArray
?
=
null
,
positions
:
FloatArray
?
=
null
,
style
:
GradientStyle
=
GradientStyle
.
Companion
.
DEFAULT
style
:
GradientStyle
=
GradientStyle
.
Companion
.
DEFAULT
):
Shader
{
):
Shader
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
return
Shader
(
return
Shader
(
_nMakeTwoPointConicalGradient
(
_nMakeTwoPointConicalGradient
(
...
@@ -267,7 +264,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -267,7 +264,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
style
:
GradientStyle
style
:
GradientStyle
):
Shader
{
):
Shader
{
return
try
{
return
try
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shader
(
Shader
(
_nMakeTwoPointConicalGradientCS
(
_nMakeTwoPointConicalGradientCS
(
...
@@ -277,8 +274,8 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -277,8 +274,8 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
x1
,
x1
,
y1
,
y1
,
r1
,
r1
,
Color4f
.
Companion
.
flattenArray
(
colors
),
Color4f
.
flattenArray
(
colors
),
Native
.
Companion
.
getPtr
(
cs
),
getPtr
(
cs
),
positions
,
positions
,
style
.
tileMode
.
ordinal
,
style
.
tileMode
.
ordinal
,
style
.
_getFlags
(),
style
.
_getFlags
(),
...
@@ -286,7 +283,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -286,7 +283,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
cs
)
reachabilityBarrier
(
cs
)
}
}
}
}
...
@@ -341,7 +338,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -341,7 +338,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
positions
:
FloatArray
?,
positions
:
FloatArray
?,
style
:
GradientStyle
style
:
GradientStyle
):
Shader
{
):
Shader
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
return
Shader
(
return
Shader
(
_nMakeSweepGradient
(
_nMakeSweepGradient
(
...
@@ -381,7 +378,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -381,7 +378,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
style
:
GradientStyle
style
:
GradientStyle
):
Shader
{
):
Shader
{
return
try
{
return
try
{
assert
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
require
(
positions
==
null
||
colors
.
size
==
positions
.
size
)
{
"colors.length "
+
colors
.
size
+
"!= positions.length "
+
positions
!!
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shader
(
Shader
(
_nMakeSweepGradientCS
(
_nMakeSweepGradientCS
(
...
@@ -389,8 +386,8 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -389,8 +386,8 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
y
,
y
,
startAngle
,
startAngle
,
endAngle
,
endAngle
,
Color4f
.
Companion
.
flattenArray
(
colors
),
Color4f
.
flattenArray
(
colors
),
Native
.
Companion
.
getPtr
(
cs
),
getPtr
(
cs
),
positions
,
positions
,
style
.
tileMode
.
ordinal
,
style
.
tileMode
.
ordinal
,
style
.
_getFlags
(),
style
.
_getFlags
(),
...
@@ -398,7 +395,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -398,7 +395,7 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
cs
)
reachabilityBarrier
(
cs
)
}
}
}
}
...
@@ -422,11 +419,11 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -422,11 +419,11 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
color
.
g
,
color
.
g
,
color
.
b
,
color
.
b
,
color
.
a
,
color
.
a
,
Native
.
Companion
.
getPtr
(
space
)
getPtr
(
space
)
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
space
)
reachabilityBarrier
(
space
)
}
}
}
}
...
@@ -436,13 +433,13 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -436,13 +433,13 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
Shader
(
Shader
(
_nMakeBlend
(
_nMakeBlend
(
mode
.
ordinal
,
mode
.
ordinal
,
Native
.
Companion
.
getPtr
(
dst
),
getPtr
(
dst
),
Native
.
Companion
.
getPtr
(
src
)
getPtr
(
src
)
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
dst
)
reachabilityBarrier
(
dst
)
Reference
.
reachabilityFence
(
src
)
reachabilityBarrier
(
src
)
}
}
}
}
...
@@ -561,10 +558,10 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -561,10 +558,10 @@ class Shader internal constructor(ptr: Long) : RefCnt(ptr) {
fun
makeWithColorFilter
(
f
:
ColorFilter
?):
Shader
{
fun
makeWithColorFilter
(
f
:
ColorFilter
?):
Shader
{
return
try
{
return
try
{
Shader
(
_nMakeWithColorFilter
(
_ptr
,
Native
.
Companion
.
getPtr
(
f
)))
Shader
(
_nMakeWithColorFilter
(
_ptr
,
getPtr
(
f
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
f
)
reachabilityBarrier
(
f
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/SurfaceProps.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/SurfaceProps.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
class
SurfaceProps
constructor
(
class
SurfaceProps
@JvmOverloads
constructor
(
internal
val
isDeviceIndependentFonts
:
Boolean
=
false
,
internal
val
isDeviceIndependentFonts
:
Boolean
=
false
,
internal
val
pixelGeometry
:
PixelGeometry
=
PixelGeometry
.
UNKNOWN
internal
val
pixelGeometry
:
PixelGeometry
=
PixelGeometry
.
UNKNOWN
)
{
)
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/TextBlob.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/TextBlob.kt
View file @
f794e4bb
...
@@ -2,10 +2,9 @@ package org.jetbrains.skia
...
@@ -2,10 +2,9 @@ package org.jetbrains.skia
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.IllegalArgumentException
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
class
TextBlob
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
class
TextBlob
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
companion
object
{
companion
object
{
...
@@ -21,17 +20,17 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -21,17 +20,17 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
*/
*/
fun
makeFromPosH
(
glyphs
:
ShortArray
,
xpos
:
FloatArray
,
ypos
:
Float
,
font
:
Font
?):
TextBlob
?
{
fun
makeFromPosH
(
glyphs
:
ShortArray
,
xpos
:
FloatArray
,
ypos
:
Float
,
font
:
Font
?):
TextBlob
?
{
return
try
{
return
try
{
assert
(
glyphs
.
size
==
xpos
.
size
)
{
"glyphs.length "
+
glyphs
.
size
+
" != xpos.length "
+
xpos
.
size
}
require
(
glyphs
.
size
==
xpos
.
size
)
{
"glyphs.length "
+
glyphs
.
size
+
" != xpos.length "
+
xpos
.
size
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeFromPosH
(
val
ptr
=
_nMakeFromPosH
(
glyphs
,
glyphs
,
xpos
,
xpos
,
ypos
,
ypos
,
Native
.
Companion
.
getPtr
(
font
)
getPtr
(
font
)
)
)
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
}
}
}
}
...
@@ -46,7 +45,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -46,7 +45,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
*/
*/
fun
makeFromPos
(
glyphs
:
ShortArray
,
pos
:
Array
<
Point
>,
font
:
Font
?):
TextBlob
?
{
fun
makeFromPos
(
glyphs
:
ShortArray
,
pos
:
Array
<
Point
>,
font
:
Font
?):
TextBlob
?
{
return
try
{
return
try
{
assert
(
glyphs
.
size
==
pos
.
size
)
{
"glyphs.length "
+
glyphs
.
size
+
" != pos.length "
+
pos
.
size
}
require
(
glyphs
.
size
==
pos
.
size
)
{
"glyphs.length "
+
glyphs
.
size
+
" != pos.length "
+
pos
.
size
}
val
floatPos
=
FloatArray
(
pos
.
size
*
2
)
val
floatPos
=
FloatArray
(
pos
.
size
*
2
)
for
(
i
in
pos
.
indices
)
{
for
(
i
in
pos
.
indices
)
{
floatPos
[
i
*
2
]
=
pos
[
i
].
x
floatPos
[
i
*
2
]
=
pos
[
i
].
x
...
@@ -54,16 +53,16 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -54,16 +53,16 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
}
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
val
ptr
=
_nMakeFromPos
(
glyphs
,
floatPos
,
Native
.
Companion
.
getPtr
(
font
))
_nMakeFromPos
(
glyphs
,
floatPos
,
getPtr
(
font
))
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
}
}
}
}
fun
makeFromRSXform
(
glyphs
:
ShortArray
,
xform
:
Array
<
RSXform
>,
font
:
Font
?):
TextBlob
?
{
fun
makeFromRSXform
(
glyphs
:
ShortArray
,
xform
:
Array
<
RSXform
>,
font
:
Font
?):
TextBlob
?
{
return
try
{
return
try
{
assert
(
glyphs
.
size
==
xform
.
size
)
{
"glyphs.length "
+
glyphs
.
size
+
" != xform.length "
+
xform
.
size
}
require
(
glyphs
.
size
==
xform
.
size
)
{
"glyphs.length "
+
glyphs
.
size
+
" != xform.length "
+
xform
.
size
}
val
floatXform
=
FloatArray
(
xform
.
size
*
4
)
val
floatXform
=
FloatArray
(
xform
.
size
*
4
)
for
(
i
in
xform
.
indices
)
{
for
(
i
in
xform
.
indices
)
{
floatXform
[
i
*
4
]
=
xform
[
i
].
scos
floatXform
[
i
*
4
]
=
xform
[
i
].
scos
...
@@ -75,21 +74,21 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -75,21 +74,21 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
ptr
=
_nMakeFromRSXform
(
val
ptr
=
_nMakeFromRSXform
(
glyphs
,
glyphs
,
floatXform
,
floatXform
,
Native
.
Companion
.
getPtr
(
font
)
getPtr
(
font
)
)
)
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
}
}
}
}
fun
makeFromData
(
data
:
Data
?):
TextBlob
?
{
fun
makeFromData
(
data
:
Data
?):
TextBlob
?
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeFromData
(
Native
.
Companion
.
getPtr
(
data
))
val
ptr
=
_nMakeFromData
(
getPtr
(
data
))
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
if
(
ptr
==
0L
)
null
else
TextBlob
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
data
)
reachabilityBarrier
(
data
)
}
}
}
}
...
@@ -127,7 +126,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -127,7 +126,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nBounds
(
_ptr
)
_nBounds
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -140,7 +139,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -140,7 +139,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUniqueId
(
_ptr
)
_nGetUniqueId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -183,20 +182,20 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -183,20 +182,20 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
_ptr
,
_ptr
,
lowerBound
,
lowerBound
,
upperBound
,
upperBound
,
Native
.
Companion
.
getPtr
(
paint
)
getPtr
(
paint
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
}
}
}
}
fun
serializeToData
():
Data
{
fun
serializeToData
():
Data
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
Data
(
_nSerializeToData
(
_ptr
))
Data
(
_nSerializeToData
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -208,7 +207,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -208,7 +207,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetGlyphs
(
_ptr
)
_nGetGlyphs
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -230,7 +229,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -230,7 +229,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetPositions
(
_ptr
)
_nGetPositions
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -245,7 +244,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -245,7 +244,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
res
=
_nGetClusters
(
_ptr
)
?:
throw
IllegalArgumentException
()
val
res
=
_nGetClusters
(
_ptr
)
?:
throw
IllegalArgumentException
()
res
res
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -260,7 +259,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -260,7 +259,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
res
=
_nGetTightBounds
(
_ptr
)
?:
throw
IllegalArgumentException
()
val
res
=
_nGetTightBounds
(
_ptr
)
?:
throw
IllegalArgumentException
()
res
res
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -275,7 +274,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -275,7 +274,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
res
=
_nGetBlockBounds
(
_ptr
)
?:
throw
IllegalArgumentException
()
val
res
=
_nGetBlockBounds
(
_ptr
)
?:
throw
IllegalArgumentException
()
res
res
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -290,7 +289,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -290,7 +289,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
res
=
_nGetFirstBaseline
(
_ptr
)
?:
throw
IllegalArgumentException
()
val
res
=
_nGetFirstBaseline
(
_ptr
)
?:
throw
IllegalArgumentException
()
res
res
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -305,7 +304,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -305,7 +304,7 @@ class TextBlob internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
res
=
_nGetLastBaseline
(
_ptr
)
?:
throw
IllegalArgumentException
()
val
res
=
_nGetLastBaseline
(
_ptr
)
?:
throw
IllegalArgumentException
()
res
res
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
private
object
_FinalizerHolder
{
private
object
_FinalizerHolder
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/TextLine.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/TextLine.kt
View file @
f794e4bb
package
org.jetbrains.skia
package
org.jetbrains.skia
import
org.jetbrains.skia.impl.Library
import
org.jetbrains.skia.impl.*
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.shaper.*
import
org.jetbrains.skia.shaper.*
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
class
TextLine
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
class
TextLine
internal
constructor
(
ptr
:
Long
)
:
Managed
(
ptr
,
_FinalizerHolder
.
PTR
)
{
companion
object
{
companion
object
{
...
@@ -13,7 +11,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -13,7 +11,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
}
}
fun
make
(
text
:
String
?,
font
:
Font
?,
opts
:
ShapingOptions
?):
TextLine
{
fun
make
(
text
:
String
?,
font
:
Font
?,
opts
:
ShapingOptions
?):
TextLine
{
Shaper
.
makeShapeDontWrapOrReorder
().
use
{
shaper
->
return
shaper
.
shapeLine
(
text
,
font
,
opts
!!
)
}
return
Shaper
.
makeShapeDontWrapOrReorder
().
use
{
shaper
->
shaper
.
shapeLine
(
text
,
font
,
opts
!!
)
}
}
}
@JvmStatic
external
fun
_nGetFinalizer
():
Long
@JvmStatic
external
fun
_nGetFinalizer
():
Long
...
@@ -49,7 +47,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -49,7 +47,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetAscent
(
_ptr
)
_nGetAscent
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
capHeight
:
Float
val
capHeight
:
Float
...
@@ -58,7 +56,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -58,7 +56,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetCapHeight
(
_ptr
)
_nGetCapHeight
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
xHeight
:
Float
val
xHeight
:
Float
...
@@ -67,7 +65,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -67,7 +65,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetXHeight
(
_ptr
)
_nGetXHeight
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
descent
:
Float
val
descent
:
Float
...
@@ -76,7 +74,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -76,7 +74,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetDescent
(
_ptr
)
_nGetDescent
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
leading
:
Float
val
leading
:
Float
...
@@ -85,7 +83,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -85,7 +83,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetLeading
(
_ptr
)
_nGetLeading
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
width
:
Float
val
width
:
Float
...
@@ -94,7 +92,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -94,7 +92,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetWidth
(
_ptr
)
_nGetWidth
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
height
:
Float
val
height
:
Float
...
@@ -103,7 +101,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -103,7 +101,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetHeight
(
_ptr
)
_nGetHeight
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
textBlob
:
TextBlob
?
val
textBlob
:
TextBlob
?
...
@@ -113,7 +111,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -113,7 +111,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
val
res
=
_nGetTextBlob
(
_ptr
)
val
res
=
_nGetTextBlob
(
_ptr
)
if
(
res
==
0L
)
null
else
TextBlob
(
res
)
if
(
res
==
0L
)
null
else
TextBlob
(
res
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
val
glyphs
:
ShortArray
val
glyphs
:
ShortArray
...
@@ -122,7 +120,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -122,7 +120,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetGlyphs
(
_ptr
)
_nGetGlyphs
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -135,7 +133,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -135,7 +133,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
return
try
{
return
try
{
_nGetPositions
(
_ptr
)
_nGetPositions
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -148,7 +146,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -148,7 +146,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetOffsetAtCoord
(
_ptr
,
x
)
_nGetOffsetAtCoord
(
_ptr
,
x
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -161,7 +159,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -161,7 +159,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetLeftOffsetAtCoord
(
_ptr
,
x
)
_nGetLeftOffsetAtCoord
(
_ptr
,
x
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -174,7 +172,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -174,7 +172,7 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetCoordAtOffset
(
_ptr
,
offset
)
_nGetCoordAtOffset
(
_ptr
,
offset
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -207,10 +205,10 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
...
@@ -207,10 +205,10 @@ class TextLine internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.P
*/
*/
fun
getIntercepts
(
lowerBound
:
Float
,
upperBound
:
Float
,
paint
:
Paint
?):
FloatArray
?
{
fun
getIntercepts
(
lowerBound
:
Float
,
upperBound
:
Float
,
paint
:
Paint
?):
FloatArray
?
{
try
{
try
{
textBlob
.
use
{
blob
->
return
blob
?
.
getIntercepts
(
lowerBound
,
upperBound
,
paint
)
}
textBlob
!!
.
use
{
blob
->
return
blob
.
getIntercepts
(
lowerBound
,
upperBound
,
paint
)
}
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
paint
)
reachabilityBarrier
(
paint
)
}
}
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/Typeface.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/Typeface.kt
View file @
f794e4bb
...
@@ -4,9 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,9 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.RefCnt
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.util.*
import
kotlin.jvm.JvmStatic
import
kotlin.streams.toList
class
Typeface
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
class
Typeface
internal
constructor
(
ptr
:
Long
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -38,7 +37,6 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -38,7 +37,6 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
* @return a new typeface given a file
* @return a new typeface given a file
* @throws IllegalArgumentException If the file does not exist, or is not a valid font file
* @throws IllegalArgumentException If the file does not exist, or is not a valid font file
*/
*/
@JvmOverloads
fun
makeFromFile
(
path
:
String
,
index
:
Int
=
0
):
Typeface
{
fun
makeFromFile
(
path
:
String
,
index
:
Int
=
0
):
Typeface
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeFromFile
(
path
,
index
)
val
ptr
=
_nMakeFromFile
(
path
,
index
)
...
@@ -53,15 +51,14 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -53,15 +51,14 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
* @return a new typeface given a Data
* @return a new typeface given a Data
* @throws IllegalArgumentException If the data is null, or is not a valid font file
* @throws IllegalArgumentException If the data is null, or is not a valid font file
*/
*/
@JvmOverloads
fun
makeFromData
(
data
:
Data
,
index
:
Int
=
0
):
Typeface
{
fun
makeFromData
(
data
:
Data
,
index
:
Int
=
0
):
Typeface
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeFromData
(
Native
.
Companion
.
getPtr
(
data
),
index
)
val
ptr
=
_nMakeFromData
(
getPtr
(
data
),
index
)
require
(
ptr
!=
0L
)
{
"Failed to create Typeface from data $data"
}
require
(
ptr
!=
0L
)
{
"Failed to create Typeface from data $data"
}
Typeface
(
ptr
)
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
data
)
reachabilityBarrier
(
data
)
}
}
}
}
...
@@ -102,14 +99,14 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -102,14 +99,14 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
FontStyle
(
_nGetFontStyle
(
_ptr
))
org
.
jetbrains
.
skia
.
FontStyle
(
_nGetFontStyle
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
* @return true if [.getFontStyle] has the bold bit set
* @return true if [.getFontStyle] has the bold bit set
*/
*/
val
isBold
:
Boolean
val
isBold
:
Boolean
get
()
=
fontStyle
.
weight
>=
FontWeight
.
Companion
.
SEMI_BOLD
get
()
=
fontStyle
.
weight
>=
FontWeight
.
SEMI_BOLD
/**
/**
* @return true if [.getFontStyle] has the italic bit set
* @return true if [.getFontStyle] has the italic bit set
...
@@ -126,7 +123,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -126,7 +123,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nIsFixedPitch
(
_ptr
)
_nIsFixedPitch
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -138,7 +135,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -138,7 +135,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetVariations
(
_ptr
)
_nGetVariations
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -150,7 +147,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -150,7 +147,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetVariationAxes
(
_ptr
)
_nGetVariationAxes
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -161,7 +158,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -161,7 +158,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUniqueId
(
_ptr
)
_nGetUniqueId
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -169,10 +166,10 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -169,10 +166,10 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
*/
*/
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
override
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
return
try
{
return
try
{
_nEquals
(
_ptr
,
Native
.
Companion
.
getPtr
(
other
))
_nEquals
(
_ptr
,
getPtr
(
other
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
other
)
reachabilityBarrier
(
other
)
}
}
}
}
...
@@ -200,20 +197,17 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -200,20 +197,17 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
* @return same typeface if all variation already match, new typeface otherwise
* @return same typeface if all variation already match, new typeface otherwise
* @throws IllegalArgumentException on failure
* @throws IllegalArgumentException on failure
*/
*/
@JvmOverloads
fun
makeClone
(
variations
:
Array
<
FontVariation
>,
collectionIndex
:
Int
=
0
):
Typeface
{
fun
makeClone
(
variations
:
Array
<
FontVariation
>,
collectionIndex
:
Int
=
0
):
Typeface
{
return
try
{
return
try
{
if
(
variations
.
size
==
0
)
return
this
if
(
variations
.
size
==
0
)
return
this
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nMakeClone
(
_ptr
,
variations
,
collectionIndex
)
val
ptr
=
_nMakeClone
(
_ptr
,
variations
,
collectionIndex
)
require
(
ptr
!=
0L
)
{
require
(
ptr
!=
0L
)
{
"Failed to clone Typeface $this with "
+
Arrays
.
toString
(
"Failed to clone Typeface $this with $variations"
variations
)
}
}
Typeface
(
ptr
)
Typeface
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -223,7 +217,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -223,7 +217,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
* @return the corresponding glyph ids for each character.
* @return the corresponding glyph ids for each character.
*/
*/
fun
getStringGlyphs
(
s
:
String
):
ShortArray
{
fun
getStringGlyphs
(
s
:
String
):
ShortArray
{
return
getUTF32Glyphs
(
s
.
codePoints
().
toArray
())
return
getUTF32Glyphs
(
s
.
intCodePoints
())
}
}
/**
/**
...
@@ -236,7 +230,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -236,7 +230,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUTF32Glyphs
(
_ptr
,
uni
)
_nGetUTF32Glyphs
(
_ptr
,
uni
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -249,7 +243,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -249,7 +243,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUTF32Glyph
(
_ptr
,
unichar
)
_nGetUTF32Glyph
(
_ptr
,
unichar
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -261,7 +255,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -261,7 +255,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetGlyphsCount
(
_ptr
)
_nGetGlyphsCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -272,7 +266,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -272,7 +266,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetTablesCount
(
_ptr
)
_nGetTablesCount
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -281,11 +275,9 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -281,11 +275,9 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
val
tableTags
:
Array
<
String
>
val
tableTags
:
Array
<
String
>
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Arrays
.
stream
(
_nGetTableTags
(
_ptr
))
_nGetTableTags
(
_ptr
)
!!
.
map
{
tag
->
FourByteTag
.
toString
(
tag
)
}.
toTypedArray
()
.
mapToObj
{
tag
:
Int
->
FourByteTag
.
toString
(
tag
)
}
.
toList
().
toTypedArray
()
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -294,9 +286,9 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -294,9 +286,9 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
fun
getTableSize
(
tag
:
String
):
Long
{
fun
getTableSize
(
tag
:
String
):
Long
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetTableSize
(
_ptr
,
FourByteTag
.
Companion
.
fromString
(
tag
))
_nGetTableSize
(
_ptr
,
FourByteTag
.
fromString
(
tag
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -310,10 +302,10 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -310,10 +302,10 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
fun
getTableData
(
tag
:
String
):
Data
?
{
fun
getTableData
(
tag
:
String
):
Data
?
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nGetTableData
(
_ptr
,
FourByteTag
.
Companion
.
fromString
(
tag
))
val
ptr
=
_nGetTableData
(
_ptr
,
FourByteTag
.
fromString
(
tag
))
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Data
(
ptr
)
if
(
ptr
==
0L
)
null
else
Data
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -325,7 +317,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -325,7 +317,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetUnitsPerEm
(
_ptr
)
_nGetUnitsPerEm
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -345,7 +337,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -345,7 +337,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetKerningPairAdjustments
(
_ptr
,
glyphs
)
_nGetKerningPairAdjustments
(
_ptr
,
glyphs
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
@@ -357,7 +349,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -357,7 +349,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetFamilyNames
(
_ptr
)
_nGetFamilyNames
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -368,7 +360,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -368,7 +360,7 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetFamilyName
(
_ptr
)
_nGetFamilyName
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
/**
/**
...
@@ -381,6 +373,6 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -381,6 +373,6 @@ class Typeface internal constructor(ptr: Long) : RefCnt(ptr) {
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nGetBounds
(
_ptr
)
_nGetBounds
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/WStream.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/WStream.kt
View file @
f794e4bb
File moved
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/impl/BufferUtil.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/impl/BufferUtil.kt
View file @
f794e4bb
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
import
java.nio.ByteBuffer
import
org.jetbrains.skia.ByteBuffer
import
kotlin.jvm.JvmStatic
object
BufferUtil
{
object
BufferUtil
{
fun
getByteBufferFromPointer
(
ptr
:
Long
,
size
:
Int
):
ByteBuffer
{
fun
getByteBufferFromPointer
(
ptr
:
Long
,
size
:
Int
):
ByteBuffer
{
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Managed.kt
View file @
f794e4bb
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
expect
abstract
class
Managed
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
=
true
)
:
Native
{
expect
abstract
class
Managed
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
=
true
)
:
Native
{
open
fun
close
()
open
fun
close
():
Unit
}
inline
fun
<
T
:
Managed
,
R
>
T
.
use
(
block
:
(
T
)
->
R
):
R
{
return
try
{
block
(
this
)
}
finally
{
this
.
close
()
}
}
}
\ No newline at end of file
skiko/src/commonMain/kotlin/org/jetbrains/skia/impl/Native.kt
View file @
f794e4bb
...
@@ -6,6 +6,8 @@ expect abstract class Native(ptr: Long) {
...
@@ -6,6 +6,8 @@ expect abstract class Native(ptr: Long) {
companion
object
{
companion
object
{
fun
getPtr
(
n
:
Native
?):
Long
fun
getPtr
(
n
:
Native
?):
Long
}
}
open
fun
_nativeEquals
(
other
:
Native
?):
Boolean
}
}
expect
fun
reachabilityBarrier
(
obj
:
Any
?)
expect
fun
reachabilityBarrier
(
obj
:
Any
?)
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/BidiRun.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/BidiRun.kt
View file @
f794e4bb
File moved
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/FontMgrRunIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/FontMgrRunIterator.kt
View file @
f794e4bb
...
@@ -4,7 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
...
@@ -4,7 +4,8 @@ import org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.*
import
org.jetbrains.skia.*
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
FontMgrRunIterator
(
text
:
ManagedString
?,
manageText
:
Boolean
,
font
:
Font
?,
opts
:
ShapingOptions
)
:
class
FontMgrRunIterator
(
text
:
ManagedString
?,
manageText
:
Boolean
,
font
:
Font
?,
opts
:
ShapingOptions
)
:
ManagedRunIterator
<
FontRun
?
>(
ManagedRunIterator
<
FontRun
?
>(
...
@@ -25,17 +26,17 @@ class FontMgrRunIterator(text: ManagedString?, manageText: Boolean, font: Font?,
...
@@ -25,17 +26,17 @@ class FontMgrRunIterator(text: ManagedString?, manageText: Boolean, font: Font?,
override
operator
fun
next
():
FontRun
{
override
operator
fun
next
():
FontRun
{
return
try
{
return
try
{
_nConsume
(
_ptr
)
_nConsume
(
_ptr
)
FontRun
(
_getEndOfCurrentRun
(),
org
.
jetbrains
.
skia
.
Font
(
_nGetCurrentFont
(
_ptr
)))
FontRun
(
_getEndOfCurrentRun
(),
Font
(
_nGetCurrentFont
(
_ptr
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
init
{
init
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
text
)
reachabilityBarrier
(
text
)
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
Reference
.
reachabilityFence
(
opts
)
reachabilityBarrier
(
opts
)
}
}
override
fun
remove
()
{
override
fun
remove
()
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/FontRun.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/FontRun.kt
View file @
f794e4bb
...
@@ -2,14 +2,14 @@ package org.jetbrains.skia.shaper
...
@@ -2,14 +2,14 @@ package org.jetbrains.skia.shaper
import
org.jetbrains.skia.*
import
org.jetbrains.skia.*
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Native
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
class
FontRun
(
internal
val
end
:
Int
,
internal
val
font
:
Font
)
{
class
FontRun
(
internal
val
end
:
Int
,
internal
val
font
:
Font
)
{
private
fun
_getFontPtr
():
Long
{
private
fun
_getFontPtr
():
Long
{
return
try
{
return
try
{
Native
.
Companion
.
getPtr
(
font
)
Native
.
Companion
.
getPtr
(
font
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
}
}
}
}
...
@@ -21,7 +21,7 @@ class FontRun(internal val end: Int, internal val font: Font) {
...
@@ -21,7 +21,7 @@ class FontRun(internal val end: Int, internal val font: Font) {
if
(
end
!=
other
.
end
)
return
false
if
(
end
!=
other
.
end
)
return
false
val
`
this
$
_font
`
:
Any
=
font
val
`
this
$
_font
`
:
Any
=
font
val
`
other
$
_font
`
:
Any
=
other
.
font
val
`
other
$
_font
`
:
Any
=
other
.
font
return
if
(
if
(
`
this
$
_font
`
==
null
)
`
other
$
_font
`
!=
null
else
`
this
$
_font
`
!=
`
other
$
_font
`
)
false
else
true
return
`
this
$
_font
`
==
`
other
$
_font
`
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -33,11 +33,11 @@ class FontRun(internal val end: Int, internal val font: Font) {
...
@@ -33,11 +33,11 @@ class FontRun(internal val end: Int, internal val font: Font) {
var
result
=
1
var
result
=
1
result
=
result
*
PRIME
+
end
result
=
result
*
PRIME
+
end
val
`$
_font
`
:
Any
=
font
val
`$
_font
`
:
Any
=
font
result
=
result
*
PRIME
+
(
`$
_font
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_font
`
.
hashCode
(
)
return
result
return
result
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"FontRun(_end=
"
+
end
+
", _font="
+
font
+
"
)"
return
"FontRun(_end=
$end, _font=$font
)"
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/HbIcuScriptRunIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/HbIcuScriptRunIterator.kt
View file @
f794e4bb
...
@@ -2,13 +2,13 @@ package org.jetbrains.skia.shaper
...
@@ -2,13 +2,13 @@ package org.jetbrains.skia.shaper
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.ManagedString
import
org.jetbrains.skia.ManagedString
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
HbIcuScriptRunIterator
(
text
:
ManagedString
?,
manageText
:
Boolean
)
:
ManagedRunIterator
<
ScriptRun
?
>(
class
HbIcuScriptRunIterator
(
text
:
ManagedString
?,
manageText
:
Boolean
)
:
ManagedRunIterator
<
ScriptRun
?
>(
_nMake
(
_nMake
(
Native
.
getPtr
(
text
)
getPtr
(
text
)
),
text
,
manageText
),
text
,
manageText
)
{
)
{
companion
object
{
companion
object
{
...
@@ -27,13 +27,13 @@ class HbIcuScriptRunIterator(text: ManagedString?, manageText: Boolean) : Manage
...
@@ -27,13 +27,13 @@ class HbIcuScriptRunIterator(text: ManagedString?, manageText: Boolean) : Manage
_nConsume
(
_ptr
)
_nConsume
(
_ptr
)
ScriptRun
(
_getEndOfCurrentRun
(),
_nGetCurrentScriptTag
(
_ptr
))
ScriptRun
(
_getEndOfCurrentRun
(),
_nGetCurrentScriptTag
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
init
{
init
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
text
)
reachabilityBarrier
(
text
)
}
}
override
fun
remove
()
{
override
fun
remove
()
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/IcuBidiRunIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/IcuBidiRunIterator.kt
View file @
f794e4bb
...
@@ -2,12 +2,12 @@ package org.jetbrains.skia.shaper
...
@@ -2,12 +2,12 @@ package org.jetbrains.skia.shaper
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.ManagedString
import
org.jetbrains.skia.ManagedString
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.reachabilityBarrier
import
kotlin.jvm.JvmStatic
class
IcuBidiRunIterator
(
text
:
ManagedString
?,
manageText
:
Boolean
,
bidiLevel
:
Int
)
:
ManagedRunIterator
<
BidiRun
?
>(
class
IcuBidiRunIterator
(
text
:
ManagedString
?,
manageText
:
Boolean
,
bidiLevel
:
Int
)
:
ManagedRunIterator
<
BidiRun
?
>(
_nMake
(
Native
.
Companion
.
getPtr
(
text
),
bidiLevel
),
text
,
manageText
_nMake
(
getPtr
(
text
),
bidiLevel
),
text
,
manageText
)
{
)
{
companion
object
{
companion
object
{
@JvmStatic
external
fun
_nMake
(
textPtr
:
Long
,
bidiLevel
:
Int
):
Long
@JvmStatic
external
fun
_nMake
(
textPtr
:
Long
,
bidiLevel
:
Int
):
Long
...
@@ -25,13 +25,13 @@ class IcuBidiRunIterator(text: ManagedString?, manageText: Boolean, bidiLevel: I
...
@@ -25,13 +25,13 @@ class IcuBidiRunIterator(text: ManagedString?, manageText: Boolean, bidiLevel: I
_nConsume
(
_ptr
)
_nConsume
(
_ptr
)
BidiRun
(
_getEndOfCurrentRun
(),
_nGetCurrentLevel
(
_ptr
))
BidiRun
(
_getEndOfCurrentRun
(),
_nGetCurrentLevel
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
init
{
init
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Reference
.
reachabilityFence
(
text
)
reachabilityBarrier
(
text
)
}
}
override
fun
remove
()
{
override
fun
remove
()
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/LanguageRun.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/LanguageRun.kt
View file @
f794e4bb
...
@@ -18,7 +18,7 @@ class LanguageRun(
...
@@ -18,7 +18,7 @@ class LanguageRun(
if
(
end
!=
other
.
end
)
return
false
if
(
end
!=
other
.
end
)
return
false
val
`
this
$
_language
`
:
Any
=
language
val
`
this
$
_language
`
:
Any
=
language
val
`
other
$
_language
`
:
Any
=
other
.
language
val
`
other
$
_language
`
:
Any
=
other
.
language
return
if
(
if
(
`
this
$
_language
`
==
null
)
`
other
$
_language
`
!=
null
else
`
this
$
_language
`
!=
`
other
$
_language
`
)
false
else
true
return
`
this
$
_language
`
==
`
other
$
_language
`
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -30,11 +30,11 @@ class LanguageRun(
...
@@ -30,11 +30,11 @@ class LanguageRun(
var
result
=
1
var
result
=
1
result
=
result
*
PRIME
+
end
result
=
result
*
PRIME
+
end
val
`$
_language
`
:
Any
=
language
val
`$
_language
`
:
Any
=
language
result
=
result
*
PRIME
+
(
`$
_language
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
`$
_language
`
.
hashCode
(
)
return
result
return
result
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"LanguageRun(_end=
"
+
end
+
", _language="
+
language
+
"
)"
return
"LanguageRun(_end=
$end, _language=$language
)"
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/ManagedRunIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/ManagedRunIterator.kt
View file @
f794e4bb
...
@@ -3,8 +3,8 @@ package org.jetbrains.skia.shaper
...
@@ -3,8 +3,8 @@ package org.jetbrains.skia.shaper
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.ManagedString
import
org.jetbrains.skia.ManagedString
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.
Native
import
org.jetbrains.skia.impl.
reachabilityBarrier
import
java.lang.ref.Reference
import
kotlin.jvm.JvmStatic
abstract
class
ManagedRunIterator
<
T
>
internal
constructor
(
abstract
class
ManagedRunIterator
<
T
>
internal
constructor
(
ptr
:
Long
,
ptr
:
Long
,
...
@@ -30,10 +30,10 @@ abstract class ManagedRunIterator<T> internal constructor(
...
@@ -30,10 +30,10 @@ abstract class ManagedRunIterator<T> internal constructor(
internal
fun
_getEndOfCurrentRun
():
Int
{
internal
fun
_getEndOfCurrentRun
():
Int
{
return
try
{
return
try
{
_nGetEndOfCurrentRun
(
_ptr
,
Native
.
Companion
.
getPtr
(
_text
))
_nGetEndOfCurrentRun
(
_ptr
,
getPtr
(
_text
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
_text
)
reachabilityBarrier
(
_text
)
}
}
}
}
...
@@ -41,7 +41,7 @@ abstract class ManagedRunIterator<T> internal constructor(
...
@@ -41,7 +41,7 @@ abstract class ManagedRunIterator<T> internal constructor(
return
try
{
return
try
{
!
_nIsAtEnd
(
_ptr
)
!
_nIsAtEnd
(
_ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/RunHandler.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/RunHandler.kt
View file @
f794e4bb
File moved
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/RunInfo.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/RunInfo.kt
View file @
f794e4bb
...
@@ -45,11 +45,11 @@ class RunInfo(
...
@@ -45,11 +45,11 @@ class RunInfo(
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(
_fontPtr
!=
other
.
_fontPtr
)
return
false
if
(
_fontPtr
!=
other
.
_fontPtr
)
return
false
if
(
bidiLevel
!=
other
.
bidiLevel
)
return
false
if
(
bidiLevel
!=
other
.
bidiLevel
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
advanceX
,
other
.
advanceX
)
!=
0
)
return
false
if
(
advanceX
.
compareTo
(
other
.
advanceX
)
!=
0
)
return
false
if
(
java
.
lang
.
Float
.
compare
(
advanceY
,
other
.
advanceY
)
!=
0
)
return
false
if
(
advanceY
.
compareTo
(
other
.
advanceY
)
!=
0
)
return
false
if
(
glyphCount
!=
other
.
glyphCount
)
return
false
if
(
glyphCount
!=
other
.
glyphCount
)
return
false
if
(
rangeBegin
!=
other
.
rangeBegin
)
return
false
if
(
rangeBegin
!=
other
.
rangeBegin
)
return
false
return
if
(
rangeSize
!=
other
.
rangeSize
)
false
else
tru
e
return
rangeSize
==
other
.
rangeSiz
e
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -62,8 +62,8 @@ class RunInfo(
...
@@ -62,8 +62,8 @@ class RunInfo(
val
`$
_fontPtr
`
=
_fontPtr
val
`$
_fontPtr
`
=
_fontPtr
result
=
result
*
PRIME
+
(
`$
_fontPtr
`
ushr
32
xor
`$
_fontPtr
`
).
toInt
()
result
=
result
*
PRIME
+
(
`$
_fontPtr
`
ushr
32
xor
`$
_fontPtr
`
).
toInt
()
result
=
result
*
PRIME
+
bidiLevel
result
=
result
*
PRIME
+
bidiLevel
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
advanceX
)
result
=
result
*
PRIME
+
advanceX
.
toBits
(
)
result
=
result
*
PRIME
+
java
.
lang
.
Float
.
floatToIntBits
(
advanceY
)
result
=
result
*
PRIME
+
advanceY
.
toBits
(
)
val
`$
_glyphCount
`
=
glyphCount
val
`$
_glyphCount
`
=
glyphCount
result
=
result
*
PRIME
+
(
`$
_glyphCount
`
ushr
32
xor
`$
_glyphCount
`
).
toInt
()
result
=
result
*
PRIME
+
(
`$
_glyphCount
`
ushr
32
xor
`$
_glyphCount
`
).
toInt
()
result
=
result
*
PRIME
+
rangeBegin
result
=
result
*
PRIME
+
rangeBegin
...
@@ -72,6 +72,6 @@ class RunInfo(
...
@@ -72,6 +72,6 @@ class RunInfo(
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"RunInfo(_fontPtr=
"
+
_fontPtr
+
", _bidiLevel="
+
bidiLevel
+
", _advanceX="
+
advanceX
+
", _advanceY="
+
advanceY
+
", _glyphCount="
+
glyphCount
+
", _rangeBegin="
+
rangeBegin
+
", _rangeSize="
+
rangeSize
+
"
)"
return
"RunInfo(_fontPtr=
$_fontPtr, _bidiLevel=$bidiLevel, _advanceX=$advanceX, _advanceY=$advanceY, _glyphCount=$glyphCount, _rangeBegin=$rangeBegin, _rangeSize=$rangeSize
)"
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/ScriptRun.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/ScriptRun.kt
View file @
f794e4bb
...
@@ -10,7 +10,7 @@ class ScriptRun(internal val end: Int, internal val scriptTag: Int) {
...
@@ -10,7 +10,7 @@ class ScriptRun(internal val end: Int, internal val scriptTag: Int) {
* Should be iso15924 codes.
* Should be iso15924 codes.
*/
*/
val
script
:
String
val
script
:
String
get
()
=
FourByteTag
.
Companion
.
toString
(
scriptTag
)
get
()
=
FourByteTag
.
toString
(
scriptTag
)
override
fun
equals
(
o
:
Any
?):
Boolean
{
override
fun
equals
(
o
:
Any
?):
Boolean
{
if
(
o
===
this
)
return
true
if
(
o
===
this
)
return
true
...
@@ -18,7 +18,7 @@ class ScriptRun(internal val end: Int, internal val scriptTag: Int) {
...
@@ -18,7 +18,7 @@ class ScriptRun(internal val end: Int, internal val scriptTag: Int) {
val
other
=
o
val
other
=
o
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(!
other
.
canEqual
(
this
as
Any
))
return
false
if
(
end
!=
other
.
end
)
return
false
if
(
end
!=
other
.
end
)
return
false
return
if
(
scriptTag
!=
other
.
scriptTag
)
false
else
true
return
scriptTag
==
other
.
scriptTag
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -34,6 +34,6 @@ class ScriptRun(internal val end: Int, internal val scriptTag: Int) {
...
@@ -34,6 +34,6 @@ class ScriptRun(internal val end: Int, internal val scriptTag: Int) {
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"ScriptRun(_end=
"
+
end
+
", _scriptTag="
+
scriptTag
+
"
)"
return
"ScriptRun(_end=
$end, _scriptTag=$scriptTag
)"
}
}
}
}
\ No newline at end of file
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/Shaper.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/Shaper.kt
View file @
f794e4bb
...
@@ -3,12 +3,10 @@ package org.jetbrains.skia.shaper
...
@@ -3,12 +3,10 @@ package org.jetbrains.skia.shaper
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.impl.Library.Companion.staticLoad
import
org.jetbrains.skia.*
import
org.jetbrains.skia.*
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Managed
import
org.jetbrains.skia.impl.Native
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.Stats
import
java.lang.UnsupportedOperationException
import
org.jetbrains.skia.impl.reachabilityBarrier
import
java.lang.ref.Reference
import
org.jetbrains.skia.impl.use
import
java.text.Bidi
import
kotlin.jvm.JvmStatic
import
java.util.*
/**
/**
* Shapes text using HarfBuzz and places the shaped text into a
* Shapes text using HarfBuzz and places the shaped text into a
...
@@ -28,9 +26,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -28,9 +26,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
fun
makeShaperDrivenWrapper
(
fontMgr
:
FontMgr
?):
Shaper
{
fun
makeShaperDrivenWrapper
(
fontMgr
:
FontMgr
?):
Shaper
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shaper
(
_nMakeShaperDrivenWrapper
(
Native
.
Companion
.
getPtr
(
fontMgr
)))
Shaper
(
_nMakeShaperDrivenWrapper
(
getPtr
(
fontMgr
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
fontMgr
)
reachabilityBarrier
(
fontMgr
)
}
}
}
}
...
@@ -41,9 +39,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -41,9 +39,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
fun
makeShapeThenWrap
(
fontMgr
:
FontMgr
?):
Shaper
{
fun
makeShapeThenWrap
(
fontMgr
:
FontMgr
?):
Shaper
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shaper
(
_nMakeShapeThenWrap
(
Native
.
Companion
.
getPtr
(
fontMgr
)))
Shaper
(
_nMakeShapeThenWrap
(
getPtr
(
fontMgr
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
fontMgr
)
reachabilityBarrier
(
fontMgr
)
}
}
}
}
...
@@ -54,9 +52,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -54,9 +52,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
fun
makeShapeDontWrapOrReorder
(
fontMgr
:
FontMgr
?):
Shaper
{
fun
makeShapeDontWrapOrReorder
(
fontMgr
:
FontMgr
?):
Shaper
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shaper
(
_nMakeShapeDontWrapOrReorder
(
Native
.
Companion
.
getPtr
(
fontMgr
)))
Shaper
(
_nMakeShapeDontWrapOrReorder
(
getPtr
(
fontMgr
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
fontMgr
)
reachabilityBarrier
(
fontMgr
)
}
}
}
}
...
@@ -83,9 +81,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -83,9 +81,9 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
fun
make
(
fontMgr
:
FontMgr
?):
Shaper
{
fun
make
(
fontMgr
:
FontMgr
?):
Shaper
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
Shaper
(
_nMake
(
Native
.
Companion
.
getPtr
(
fontMgr
)))
Shaper
(
_nMake
(
getPtr
(
fontMgr
)))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
fontMgr
)
reachabilityBarrier
(
fontMgr
)
}
}
}
}
...
@@ -148,12 +146,11 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -148,12 +146,11 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
fun
shape
(
text
:
String
?,
font
:
Font
?,
opts
:
ShapingOptions
,
width
:
Float
,
offset
:
Point
):
TextBlob
?
{
fun
shape
(
text
:
String
?,
font
:
Font
?,
opts
:
ShapingOptions
,
width
:
Float
,
offset
:
Point
):
TextBlob
?
{
return
try
{
return
try
{
assert
(
opts
!=
null
)
{
"Can’t Shaper::shape with opts == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nShapeBlob
(
val
ptr
=
_nShapeBlob
(
_ptr
,
_ptr
,
text
,
text
,
Native
.
Companion
.
getPtr
(
font
),
getPtr
(
font
),
opts
,
opts
,
width
,
width
,
offset
.
x
,
offset
.
x
,
...
@@ -161,8 +158,8 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -161,8 +158,8 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
)
)
if
(
0L
==
ptr
)
null
else
TextBlob
(
ptr
)
if
(
0L
==
ptr
)
null
else
TextBlob
(
ptr
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
}
}
}
}
...
@@ -178,11 +175,11 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -178,11 +175,11 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
IcuBidiRunIterator
(
IcuBidiRunIterator
(
textUtf8
,
textUtf8
,
false
,
false
,
if
(
opts
.
isLeftToRight
)
Bidi
.
DIRECTION_LEFT_TO_RIGHT
else
Bidi
.
DIRECTION_RIGHT_TO_LEFT
if
(
opts
.
isLeftToRight
)
-
2
/* Bidi.DIRECTION_LEFT_TO_RIGHT */
else
-
1
/* Bidi.DIRECTION_RIGHT_TO_LEFT */
).
use
{
bidiIter
->
).
use
{
bidiIter
->
HbIcuScriptRunIterator
(
textUtf8
,
false
).
use
{
scriptIter
->
HbIcuScriptRunIterator
(
textUtf8
,
false
).
use
{
scriptIter
->
val
langIter
=
val
langIter
=
TrivialLanguageRunIterator
(
text
,
Locale
.
getDefault
().
to
LanguageTag
())
TrivialLanguageRunIterator
(
text
,
default
LanguageTag
())
return
shape
(
textUtf8
,
fontIter
,
bidiIter
,
scriptIter
,
langIter
,
opts
,
width
,
runHandler
)
return
shape
(
textUtf8
,
fontIter
,
bidiIter
,
scriptIter
,
langIter
,
opts
,
width
,
runHandler
)
}
}
}
}
...
@@ -224,15 +221,10 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -224,15 +221,10 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
width
:
Float
,
width
:
Float
,
runHandler
:
RunHandler
runHandler
:
RunHandler
):
Shaper
{
):
Shaper
{
assert
(
fontIter
!=
null
)
{
"FontRunIterator == null"
}
assert
(
bidiIter
!=
null
)
{
"BidiRunIterator == null"
}
assert
(
scriptIter
!=
null
)
{
"ScriptRunIterator == null"
}
assert
(
langIter
!=
null
)
{
"LanguageRunIterator == null"
}
assert
(
opts
!=
null
)
{
"Can’t Shaper::shape with opts == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
_nShape
(
_nShape
(
_ptr
,
_ptr
,
Native
.
Companion
.
getPtr
(
textUtf8
),
getPtr
(
textUtf8
),
fontIter
,
fontIter
,
bidiIter
,
bidiIter
,
scriptIter
,
scriptIter
,
...
@@ -246,19 +238,18 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
...
@@ -246,19 +238,18 @@ class Shaper internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR
fun
shapeLine
(
text
:
String
?,
font
:
Font
?,
opts
:
ShapingOptions
):
TextLine
{
fun
shapeLine
(
text
:
String
?,
font
:
Font
?,
opts
:
ShapingOptions
):
TextLine
{
return
try
{
return
try
{
assert
(
opts
!=
null
)
{
"Can’t Shaper::shapeLine with opts == null"
}
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
TextLine
(
TextLine
(
_nShapeLine
(
_nShapeLine
(
_ptr
,
_ptr
,
text
,
text
,
Native
.
Companion
.
getPtr
(
font
),
getPtr
(
font
),
opts
opts
)
)
)
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
reachabilityBarrier
(
this
)
Reference
.
reachabilityFence
(
font
)
reachabilityBarrier
(
font
)
}
}
}
}
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/ShapingOptions.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/ShapingOptions.kt
View file @
f794e4bb
...
@@ -2,7 +2,6 @@ package org.jetbrains.skia.shaper
...
@@ -2,7 +2,6 @@ package org.jetbrains.skia.shaper
import
org.jetbrains.skia.FontFeature
import
org.jetbrains.skia.FontFeature
import
org.jetbrains.skia.FontMgr
import
org.jetbrains.skia.FontMgr
import
java.util.*
class
ShapingOptions
(
class
ShapingOptions
(
internal
val
fontMgr
:
FontMgr
?,
internal
val
fontMgr
:
FontMgr
?,
...
@@ -47,7 +46,7 @@ class ShapingOptions(
...
@@ -47,7 +46,7 @@ class ShapingOptions(
val
`
this
$
_fontMgr
`
:
Any
?
=
fontMgr
val
`
this
$
_fontMgr
`
:
Any
?
=
fontMgr
val
`
other
$
_fontMgr
`
:
Any
?
=
other
.
fontMgr
val
`
other
$
_fontMgr
`
:
Any
?
=
other
.
fontMgr
if
(
if
(
`
this
$
_fontMgr
`
==
null
)
`
other
$
_fontMgr
`
!=
null
else
`
this
$
_fontMgr
`
!=
`
other
$
_fontMgr
`
)
return
false
if
(
if
(
`
this
$
_fontMgr
`
==
null
)
`
other
$
_fontMgr
`
!=
null
else
`
this
$
_fontMgr
`
!=
`
other
$
_fontMgr
`
)
return
false
return
if
(!
Arrays
.
deepEquals
(
features
,
other
.
features
))
false
else
true
return
features
.
contentDeepEquals
(
other
.
features
)
}
}
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
protected
fun
canEqual
(
other
:
Any
?):
Boolean
{
...
@@ -62,12 +61,12 @@ class ShapingOptions(
...
@@ -62,12 +61,12 @@ class ShapingOptions(
result
=
result
*
PRIME
+
if
(
isApproximatePunctuation
)
79
else
97
result
=
result
*
PRIME
+
if
(
isApproximatePunctuation
)
79
else
97
val
`$
_fontMgr
`
:
Any
?
=
fontMgr
val
`$
_fontMgr
`
:
Any
?
=
fontMgr
result
=
result
*
PRIME
+
(
`$
_fontMgr
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
(
`$
_fontMgr
`
?.
hashCode
()
?:
43
)
result
=
result
*
PRIME
+
Arrays
.
deepHashCode
(
features
)
result
=
result
*
PRIME
+
features
.
contentDeepHashCode
(
)
return
result
return
result
}
}
override
fun
toString
():
String
{
override
fun
toString
():
String
{
return
"ShapingOptions(_fontMgr="
+
fontMgr
+
", _features="
+
Arrays
.
deepToString
(
features
)
+
", _leftToRight="
+
isLeftToRight
+
", _approximateSpaces="
+
isApproximateSpaces
+
", _approximatePunctuation="
+
isApproximatePunctuation
+
")"
return
"ShapingOptions(_fontMgr="
+
fontMgr
+
", _features="
+
features
.
contentDeepToString
(
)
+
", _leftToRight="
+
isLeftToRight
+
", _approximateSpaces="
+
isApproximateSpaces
+
", _approximatePunctuation="
+
isApproximatePunctuation
+
")"
}
}
fun
withFontMgr
(
_fontMgr
:
FontMgr
?):
ShapingOptions
{
fun
withFontMgr
(
_fontMgr
:
FontMgr
?):
ShapingOptions
{
...
...
skiko/src/
jvm
Main/kotlin/org/jetbrains/skia/shaper/TrivialLanguageRunIterator.kt
→
skiko/src/
common
Main/kotlin/org/jetbrains/skia/shaper/TrivialLanguageRunIterator.kt
View file @
f794e4bb
File moved
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Actuals.jvm.kt
0 → 100644
View file @
f794e4bb
package
org.jetbrains.skia
import
java.util.*
actual
typealias
ByteBuffer
=
java
.
nio
.
ByteBuffer
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
synchronized
(
lock
,
block
)
}
actual
fun
String
.
intCodePoints
():
IntArray
=
this
.
codePoints
().
toArray
()
actual
typealias
Pattern
=
java
.
util
.
regex
.
Pattern
actual
typealias
Matcher
=
java
.
util
.
regex
.
Matcher
actual
fun
defaultLanguageTag
():
String
=
Locale
.
getDefault
().
toLanguageTag
()
actual
fun
compilePattern
(
regex
:
String
):
Pattern
=
Pattern
.
compile
(
regex
)
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Codec.kt
View file @
f794e4bb
...
@@ -99,7 +99,7 @@ class Codec internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
...
@@ -99,7 +99,7 @@ class Codec internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.PTR)
* @return decoded bitmap
* @return decoded bitmap
*/
*/
fun
readPixels
():
Bitmap
{
fun
readPixels
():
Bitmap
{
val
bitmap
=
org
.
jetbrains
.
skia
.
Bitmap
()
val
bitmap
=
Bitmap
()
bitmap
.
allocPixels
(
imageInfo
)
bitmap
.
allocPixels
(
imageInfo
)
readPixels
(
bitmap
)
readPixels
(
bitmap
)
return
bitmap
return
bitmap
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/PaintFilterCanvas.kt
View file @
f794e4bb
...
@@ -29,7 +29,7 @@ abstract class PaintFilterCanvas(canvas: Canvas, unrollDrawable: Boolean) :
...
@@ -29,7 +29,7 @@ abstract class PaintFilterCanvas(canvas: Canvas, unrollDrawable: Boolean) :
*/
*/
abstract
fun
onFilter
(
paint
:
Paint
):
Boolean
abstract
fun
onFilter
(
paint
:
Paint
):
Boolean
fun
onFilter
(
paintPtr
:
Long
):
Boolean
{
fun
onFilter
(
paintPtr
:
Long
):
Boolean
{
val
paint
=
org
.
jetbrains
.
skia
.
Paint
(
paintPtr
,
false
)
val
paint
=
Paint
(
paintPtr
,
false
)
return
onFilter
(
paint
)
return
onFilter
(
paint
)
}
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/PictureRecorder.kt
View file @
f794e4bb
...
@@ -62,7 +62,7 @@ class PictureRecorder internal constructor(ptr: Long) : Managed(ptr, _FinalizerH
...
@@ -62,7 +62,7 @@ class PictureRecorder internal constructor(ptr: Long) : Managed(ptr, _FinalizerH
fun
beginRecording
(
bounds
:
Rect
):
Canvas
{
fun
beginRecording
(
bounds
:
Rect
):
Canvas
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
Canvas
(
Canvas
(
_nBeginRecording
(
_nBeginRecording
(
_ptr
,
_ptr
,
bounds
.
left
,
bounds
.
left
,
...
@@ -83,7 +83,7 @@ class PictureRecorder internal constructor(ptr: Long) : Managed(ptr, _FinalizerH
...
@@ -83,7 +83,7 @@ class PictureRecorder internal constructor(ptr: Long) : Managed(ptr, _FinalizerH
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nGetRecordingCanvas
(
_ptr
)
val
ptr
=
_nGetRecordingCanvas
(
_ptr
)
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Canvas
(
ptr
,
false
,
this
)
if
(
ptr
==
0L
)
null
else
Canvas
(
ptr
,
false
,
this
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
}
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/RuntimeEffect.kt
View file @
f794e4bb
...
@@ -39,6 +39,6 @@ class RuntimeEffect internal constructor(ptr: Long) : RefCnt(ptr) {
...
@@ -39,6 +39,6 @@ class RuntimeEffect internal constructor(ptr: Long) : RefCnt(ptr) {
val
childrenPtrs
=
LongArray
(
childCount
)
val
childrenPtrs
=
LongArray
(
childCount
)
for
(
i
in
0
until
childCount
)
childrenPtrs
[
i
]
=
Native
.
Companion
.
getPtr
(
children
!!
[
i
])
for
(
i
in
0
until
childCount
)
childrenPtrs
[
i
]
=
Native
.
Companion
.
getPtr
(
children
!!
[
i
])
val
matrix
=
localMatrix
?.
mat
val
matrix
=
localMatrix
?.
mat
return
Shader
(
_nMakeShader
(
_ptr
,
Native
.
Companion
.
getPtr
(
uniforms
),
childrenPtrs
,
matrix
,
isOpaque
))
return
Shader
(
_nMakeShader
(
_ptr
,
getPtr
(
uniforms
),
childrenPtrs
,
matrix
,
isOpaque
))
}
}
}
}
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skia/Surface.kt
View file @
f794e4bb
...
@@ -860,7 +860,7 @@ class Surface : RefCnt {
...
@@ -860,7 +860,7 @@ class Surface : RefCnt {
fun
makeImageSnapshot
():
Image
{
fun
makeImageSnapshot
():
Image
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
Image
(
_nMakeImageSnapshot
(
_ptr
))
Image
(
_nMakeImageSnapshot
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
}
}
...
@@ -886,7 +886,7 @@ class Surface : RefCnt {
...
@@ -886,7 +886,7 @@ class Surface : RefCnt {
fun
makeImageSnapshot
(
area
:
IRect
):
Image
?
{
fun
makeImageSnapshot
(
area
:
IRect
):
Image
?
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
Image
(
Image
(
_nMakeImageSnapshotR
(
_nMakeImageSnapshotR
(
_ptr
,
_ptr
,
area
.
left
,
area
.
left
,
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/impl/Native.jvm.kt
View file @
f794e4bb
...
@@ -21,7 +21,7 @@ actual abstract class Native actual constructor(ptr: Long) {
...
@@ -21,7 +21,7 @@ actual abstract class Native actual constructor(ptr: Long) {
}
}
}
}
open
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
actual
open
fun
_nativeEquals
(
other
:
Native
?):
Boolean
{
return
false
return
false
}
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/paragraph/StrutStyle.kt
View file @
f794e4bb
...
@@ -65,7 +65,7 @@ class StrutStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder
...
@@ -65,7 +65,7 @@ class StrutStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder
val
fontStyle
:
FontStyle
val
fontStyle
:
FontStyle
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
FontStyle
(
_nGetFontStyle
(
_ptr
))
FontStyle
(
_nGetFontStyle
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
}
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skia/paragraph/TextStyle.kt
View file @
f794e4bb
...
@@ -113,7 +113,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
...
@@ -113,7 +113,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nGetForeground
(
_ptr
)
val
ptr
=
_nGetForeground
(
_ptr
)
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Paint
(
ptr
,
true
)
if
(
ptr
==
0L
)
null
else
Paint
(
ptr
,
true
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
}
}
...
@@ -135,7 +135,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
...
@@ -135,7 +135,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
ptr
=
_nGetBackground
(
_ptr
)
val
ptr
=
_nGetBackground
(
_ptr
)
if
(
ptr
==
0L
)
null
else
org
.
jetbrains
.
skia
.
Paint
(
ptr
,
true
)
if
(
ptr
==
0L
)
null
else
Paint
(
ptr
,
true
)
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
}
}
...
@@ -179,7 +179,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
...
@@ -179,7 +179,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
val
fontStyle
:
FontStyle
val
fontStyle
:
FontStyle
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
org
.
jetbrains
.
skia
.
FontStyle
(
_nGetFontStyle
(
_ptr
))
FontStyle
(
_nGetFontStyle
(
_ptr
))
}
finally
{
}
finally
{
Reference
.
reachabilityFence
(
this
)
Reference
.
reachabilityFence
(
this
)
}
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
View file @
f794e4bb
package
org.jetbrains.skiko
package
org.jetbrains.skiko
import
org.jetbrains.skia.Bitmap
import
java.io.BufferedReader
import
java.io.BufferedReader
import
java.io.File
import
java.io.File
import
java.io.InputStreamReader
import
java.io.InputStreamReader
...
@@ -102,7 +103,7 @@ object Library {
...
@@ -102,7 +103,7 @@ object Library {
// We have to keep this tiny class in Skiko for testing purposes.
// We have to keep this tiny class in Skiko for testing purposes.
internal
class
LibraryTestImpl
()
{
internal
class
LibraryTestImpl
()
{
fun
run
():
Long
{
fun
run
():
Long
{
val
bitmap
=
org
.
jetbrains
.
skia
.
Bitmap
()
val
bitmap
=
Bitmap
()
return
bitmap
.
_ptr
return
bitmap
.
_ptr
}
}
}
}
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/Actuals.native.kt
0 → 100644
View file @
f794e4bb
package
org.jetbrains.skia
actual
abstract
class
ByteBuffer
actual
fun
<
R
>
commonSynchronized
(
lock
:
Any
,
block
:
()
->
R
)
{
block
()
}
actual
fun
String
.
intCodePoints
():
IntArray
=
TODO
()
actual
class
Pattern
{
actual
fun
split
(
input
:
CharSequence
):
Array
<
String
?
>?
=
TODO
()
actual
fun
matcher
(
input
:
CharSequence
):
Matcher
=
TODO
()
}
actual
class
Matcher
{
actual
fun
group
(
name
:
String
):
String
?
=
TODO
()
actual
fun
matches
():
Boolean
=
TODO
()
}
actual
fun
defaultLanguageTag
():
String
=
TODO
()
actual
fun
compilePattern
(
regex
:
String
):
Pattern
=
TODO
()
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/Managed.native.kt
View file @
f794e4bb
package
org.jetbrains.skia.impl
package
org.jetbrains.skia.impl
actual
abstract
class
Managed
actual
constructor
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
)
:
Native
(
ptr
)
{
actual
abstract
class
Managed
actual
constructor
(
ptr
:
Long
,
finalizer
:
Long
,
managed
:
Boolean
)
:
Native
(
ptr
)
{
actual
open
fun
close
()
{
actual
open
fun
close
():
Unit
=
TODO
()
TODO
()
}
}
}
\ No newline at end of file
skiko/src/macosX64Main/kotlin/org/jetbrains/skia/impl/Native.native.kt
View file @
f794e4bb
...
@@ -3,6 +3,8 @@ package org.jetbrains.skia.impl
...
@@ -3,6 +3,8 @@ package org.jetbrains.skia.impl
actual
abstract
class
Native
actual
constructor
(
ptr
:
Long
)
{
actual
abstract
class
Native
actual
constructor
(
ptr
:
Long
)
{
actual
var
_ptr
:
Long
actual
var
_ptr
:
Long
actual
open
fun
_nativeEquals
(
other
:
Native
?):
Boolean
=
TODO
()
actual
companion
object
{
actual
companion
object
{
actual
fun
getPtr
(
n
:
Native
?):
Long
{
actual
fun
getPtr
(
n
:
Native
?):
Long
{
return
n
?.
_ptr
?:
0
return
n
?.
_ptr
?:
0
...
...
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