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
c7e5032c
Unverified
Commit
c7e5032c
authored
Nov 02, 2021
by
Aleksandr Veselov
Committed by
GitHub
Nov 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement native methods of SVGSVG and SVGDOM (#334)
parent
36c350d8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
144 additions
and
158 deletions
+144
-158
SVGDOM.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGDOM.kt
+3
-7
SVGLength.kt
...src/commonMain/kotlin/org/jetbrains/skia/svg/SVGLength.kt
+9
-0
SVGPreserveAspectRatio.kt
...n/kotlin/org/jetbrains/skia/svg/SVGPreserveAspectRatio.kt
+10
-0
SVGSVG.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGSVG.kt
+12
-18
SvgTest.kt
skiko/src/commonTest/kotlin/org/jetbrains/skia/SvgTest.kt
+15
-16
SVGDOM.cc
skiko/src/jvmMain/cpp/common/svg/SVGDOM.cc
+3
-3
SVGSVG.cc
skiko/src/jvmMain/cpp/common/svg/SVGSVG.cc
+22
-21
interop.cc
skiko/src/jvmMain/cpp/common/svg/interop.cc
+11
-0
interop.hh
skiko/src/jvmMain/cpp/common/svg/interop.hh
+2
-0
common.h
skiko/src/nativeJsMain/cpp/common.h
+11
-0
common_interop.cc
skiko/src/nativeJsMain/cpp/common_interop.cc
+18
-0
SVGDOM.cc
skiko/src/nativeJsMain/cpp/svg/SVGDOM.cc
+3
-12
SVGSVG.cc
skiko/src/nativeJsMain/cpp/svg/SVGSVG.cc
+25
-81
No files found.
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGDOM.kt
View file @
c7e5032c
package
org.jetbrains.skia.svg
package
org.jetbrains.skia.svg
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.*
import
org.jetbrains.skia.*
import
org.jetbrains.skia.impl.Stats
import
org.jetbrains.skia.impl.reachabilityBarrier
import
org.jetbrains.skia.ExternalSymbolName
import
org.jetbrains.skia.ExternalSymbolName
import
org.jetbrains.skia.impl.NativePointer
import
org.jetbrains.skia.impl.*
import
org.jetbrains.skia.impl.getPtr
class
SVGDOM
internal
constructor
(
ptr
:
NativePointer
)
:
RefCnt
(
ptr
)
{
class
SVGDOM
internal
constructor
(
ptr
:
NativePointer
)
:
RefCnt
(
ptr
)
{
companion
object
{
companion
object
{
...
@@ -36,7 +32,7 @@ class SVGDOM internal constructor(ptr: NativePointer) : RefCnt(ptr) {
...
@@ -36,7 +32,7 @@ class SVGDOM internal constructor(ptr: NativePointer) : RefCnt(ptr) {
@get
:
Deprecated
(
""
)
@get
:
Deprecated
(
""
)
val
containerSize
:
Point
val
containerSize
:
Point
get
()
=
try
{
get
()
=
try
{
SVGDOM_nGetContainerSize
(
_ptr
)
Point
.
fromInteropPointer
{
SVGDOM_nGetContainerSize
(
_ptr
,
it
)
}
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -70,7 +66,7 @@ private external fun SVGDOM_nMakeFromData(dataPtr: NativePointer): NativePointer
...
@@ -70,7 +66,7 @@ private external fun SVGDOM_nMakeFromData(dataPtr: NativePointer): NativePointer
private
external
fun
SVGDOM_nGetRoot
(
ptr
:
NativePointer
):
NativePointer
private
external
fun
SVGDOM_nGetRoot
(
ptr
:
NativePointer
):
NativePointer
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGDOM__1nGetContainerSize"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGDOM__1nGetContainerSize"
)
private
external
fun
SVGDOM_nGetContainerSize
(
ptr
:
NativePointer
):
Point
private
external
fun
SVGDOM_nGetContainerSize
(
ptr
:
NativePointer
,
dst
:
InteropPointer
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGDOM__1nSetContainerSize"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGDOM__1nSetContainerSize"
)
private
external
fun
SVGDOM_nSetContainerSize
(
ptr
:
NativePointer
,
width
:
Float
,
height
:
Float
)
private
external
fun
SVGDOM_nSetContainerSize
(
ptr
:
NativePointer
,
width
:
Float
,
height
:
Float
)
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGLength.kt
View file @
c7e5032c
package
org.jetbrains.skia.svg
package
org.jetbrains.skia.svg
import
org.jetbrains.skia.impl.InteropPointer
import
org.jetbrains.skia.impl.withResult
class
SVGLength
(
val
value
:
Float
,
val
unit
:
SVGLengthUnit
)
{
class
SVGLength
(
val
value
:
Float
,
val
unit
:
SVGLengthUnit
)
{
companion
object
{
internal
fun
fromInterop
(
block
:
(
InteropPointer
)
->
Unit
)
=
withResult
(
IntArray
(
2
),
block
).
let
{
SVGLength
(
Float
.
fromBits
(
it
[
0
]),
it
[
1
])
}
}
internal
constructor
(
value
:
Float
,
unit
:
Int
)
:
this
(
value
,
SVGLengthUnit
.
values
()[
unit
])
internal
constructor
(
value
:
Float
,
unit
:
Int
)
:
this
(
value
,
SVGLengthUnit
.
values
()[
unit
])
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGPreserveAspectRatio.kt
View file @
c7e5032c
package
org.jetbrains.skia.svg
package
org.jetbrains.skia.svg
import
org.jetbrains.skia.impl.InteropPointer
import
org.jetbrains.skia.impl.withResult
class
SVGPreserveAspectRatio
(
align
:
SVGPreserveAspectRatioAlign
,
scale
:
SVGPreserveAspectRatioScale
)
{
class
SVGPreserveAspectRatio
(
align
:
SVGPreserveAspectRatioAlign
,
scale
:
SVGPreserveAspectRatioScale
)
{
internal
val
_align
:
SVGPreserveAspectRatioAlign
internal
val
_align
:
SVGPreserveAspectRatioAlign
internal
val
_scale
:
SVGPreserveAspectRatioScale
internal
val
_scale
:
SVGPreserveAspectRatioScale
companion
object
{
internal
fun
fromInterop
(
block
:
(
InteropPointer
)
->
Unit
)
=
withResult
(
IntArray
(
2
),
block
).
let
{
SVGPreserveAspectRatio
(
it
[
0
],
it
[
1
])
}
}
internal
constructor
(
align
:
Int
,
scale
:
Int
)
:
this
(
internal
constructor
(
align
:
Int
,
scale
:
Int
)
:
this
(
SVGPreserveAspectRatioAlign
.
valueOf
(
align
),
SVGPreserveAspectRatioAlign
.
valueOf
(
align
),
SVGPreserveAspectRatioScale
.
values
()[
scale
]
SVGPreserveAspectRatioScale
.
values
()[
scale
]
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/svg/SVGSVG.kt
View file @
c7e5032c
...
@@ -15,10 +15,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -15,10 +15,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
var
x
:
SVGLength
var
x
:
SVGLength
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
result
=
withResult
(
IntArray
(
2
))
{
SVGLength
.
fromInterop
{
SVGSVG_nGetX
(
_ptr
,
it
)
}
SVGSVG_nGetX
(
_ptr
,
it
)
}
SVGLength
(
Float
.
fromBits
(
result
[
0
]),
result
[
1
])
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -32,10 +29,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -32,10 +29,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
var
y
:
SVGLength
var
y
:
SVGLength
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
val
result
=
withResult
(
IntArray
(
2
))
{
SVGLength
.
fromInterop
{
SVGSVG_nGetY
(
_ptr
,
it
)
}
SVGSVG_nGetY
(
_ptr
,
it
)
}
SVGLength
(
Float
.
fromBits
(
result
[
0
]),
result
[
1
])
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -56,7 +50,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -56,7 +50,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
var
width
:
SVGLength
var
width
:
SVGLength
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
SVG
SVG_nGetWidth
(
_ptr
)
SVG
Length
.
fromInterop
{
SVGSVG_nGetWidth
(
_ptr
,
it
)
}
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -70,7 +64,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -70,7 +64,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
var
height
:
SVGLength
var
height
:
SVGLength
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
SVG
SVG_nGetHeight
(
_ptr
)
SVG
Length
.
fromInterop
{
SVGSVG_nGetHeight
(
_ptr
,
it
)
}
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -85,7 +79,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -85,7 +79,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
var
preserveAspectRatio
:
SVGPreserveAspectRatio
var
preserveAspectRatio
:
SVGPreserveAspectRatio
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
SVG
SVG_nGetPreserveAspectRatio
(
_ptr
)
SVG
PreserveAspectRatio
.
fromInterop
{
SVGSVG_nGetPreserveAspectRatio
(
_ptr
,
it
)
}
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -99,7 +93,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -99,7 +93,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
var
viewBox
:
Rect
?
var
viewBox
:
Rect
?
get
()
=
try
{
get
()
=
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
SVGSVG_nGetViewBox
(
_ptr
)
Rect
.
fromInteropPointerNullable
{
SVGSVG_nGetViewBox
(
_ptr
,
it
)
}
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -113,7 +107,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
...
@@ -113,7 +107,7 @@ class SVGSVG internal constructor(ptr: NativePointer) : SVGContainer(ptr) {
fun
getIntrinsicSize
(
lc
:
SVGLengthContext
):
Point
{
fun
getIntrinsicSize
(
lc
:
SVGLengthContext
):
Point
{
return
try
{
return
try
{
Stats
.
onNativeCall
()
Stats
.
onNativeCall
()
SVGSVG_nGetIntrinsicSize
(
_ptr
,
lc
.
width
,
lc
.
height
,
lc
.
dpi
)
Point
.
fromInteropPointer
{
SVGSVG_nGetIntrinsicSize
(
_ptr
,
lc
.
width
,
lc
.
height
,
lc
.
dpi
,
it
)
}
}
finally
{
}
finally
{
reachabilityBarrier
(
this
)
reachabilityBarrier
(
this
)
}
}
...
@@ -127,19 +121,19 @@ private external fun SVGSVG_nGetX(ptr: NativePointer, result: InteropPointer)
...
@@ -127,19 +121,19 @@ private external fun SVGSVG_nGetX(ptr: NativePointer, result: InteropPointer)
private
external
fun
SVGSVG_nGetY
(
ptr
:
NativePointer
,
result
:
InteropPointer
)
private
external
fun
SVGSVG_nGetY
(
ptr
:
NativePointer
,
result
:
InteropPointer
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetWidth"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetWidth"
)
private
external
fun
SVGSVG_nGetWidth
(
ptr
:
NativePointer
):
SVGLength
private
external
fun
SVGSVG_nGetWidth
(
ptr
:
NativePointer
,
result
:
InteropPointer
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetHeight"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetHeight"
)
private
external
fun
SVGSVG_nGetHeight
(
ptr
:
NativePointer
):
SVGLength
private
external
fun
SVGSVG_nGetHeight
(
ptr
:
NativePointer
,
result
:
InteropPointer
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetPreserveAspectRatio"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetPreserveAspectRatio"
)
private
external
fun
SVGSVG_nGetPreserveAspectRatio
(
ptr
:
NativePointer
):
SVGPreserveAspectRatio
private
external
fun
SVGSVG_nGetPreserveAspectRatio
(
ptr
:
NativePointer
,
result
:
InteropPointer
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetViewBox"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetViewBox"
)
private
external
fun
SVGSVG_nGetViewBox
(
ptr
:
NativePointer
):
Rect
?
private
external
fun
SVGSVG_nGetViewBox
(
ptr
:
NativePointer
,
result
:
InteropPointer
):
Boolean
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetIntrinsicSize"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nGetIntrinsicSize"
)
private
external
fun
SVGSVG_nGetIntrinsicSize
(
ptr
:
NativePointer
,
width
:
Float
,
height
:
Float
,
dpi
:
Float
):
Point
private
external
fun
SVGSVG_nGetIntrinsicSize
(
ptr
:
NativePointer
,
width
:
Float
,
height
:
Float
,
dpi
:
Float
,
result
:
InteropPointer
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nSetX"
)
@ExternalSymbolName
(
"org_jetbrains_skia_svg_SVGSVG__1nSetX"
)
private
external
fun
SVGSVG_nSetX
(
ptr
:
NativePointer
,
value
:
Float
,
unit
:
Int
)
private
external
fun
SVGSVG_nSetX
(
ptr
:
NativePointer
,
value
:
Float
,
unit
:
Int
)
...
...
skiko/src/commonTest/kotlin/org/jetbrains/skia/SvgTest.kt
View file @
c7e5032c
package
org.jetbrains.skia
package
org.jetbrains.skia
import
org.jetbrains.skia.svg.SVGDOM
import
org.jetbrains.skia.svg.*
import
org.jetbrains.skia.svg.SVGLengthContext
import
org.jetbrains.skia.tests.assertCloseEnough
import
org.jetbrains.skia.svg.SVGLengthUnit
import
org.jetbrains.skia.svg.SVGTag
import
org.jetbrains.skiko.KotlinBackend
import
org.jetbrains.skiko.KotlinBackend
import
org.jetbrains.skiko.kotlinBackend
import
org.jetbrains.skiko.kotlinBackend
import
kotlin.test.Test
import
kotlin.test.Test
import
kotlin.test.assertEquals
class
SvgTest
{
class
SvgTest
{
@Test
@Test
...
@@ -33,17 +32,17 @@ class SvgTest {
...
@@ -33,17 +32,17 @@ class SvgTest {
val
e
=
dom
.
root
!!
val
e
=
dom
.
root
!!
require
(
e
.
x
.
unit
==
SVGLengthUnit
.
NUMBER
)
require
(
e
.
x
.
unit
==
SVGLengthUnit
.
NUMBER
)
require
(
e
.
y
.
unit
==
SVGLengthUnit
.
NUMBER
)
require
(
e
.
y
.
unit
==
SVGLengthUnit
.
NUMBER
)
if
(
kotlinBackend
==
KotlinBackend
.
JVM
)
{
require
(
e
.
width
.
unit
==
SVGLengthUnit
.
NUMBER
)
// TODO: disabled for other platforms until all methods implemented in JS/Native.
require
(
e
.
height
.
unit
==
SVGLengthUnit
.
NUMBER
)
require
(
e
.
width
.
unit
==
SVGLengthUnit
.
NUMBER
)
require
(
e
.
viewBox
==
null
)
require
(
e
.
height
.
unit
==
SVGLengthUnit
.
NUMBER
)
require
(
e
.
tag
==
SVGTag
.
SVG
)
require
(
e
.
viewBox
==
null
)
e
.
viewBox
=
Rect
(
0f
,
1f
,
100f
,
200f
)
require
(
e
.
tag
==
SVGTag
.
SVG
)
assertCloseEnough
(
Rect
(
0f
,
1f
,
100f
,
200f
),
e
.
viewBox
)
// e.viewBox = Rect(0f, 1f, 100f, 200f
)
val
aspectRatio
=
SVGPreserveAspectRatio
(
SVGPreserveAspectRatioAlign
.
XMIN_YMIN
,
SVGPreserveAspectRatioScale
.
MEET
)
// assert(e.viewBox!!.top == 1f)
e
.
preserveAspectRatio
=
aspectRatio
require
(
e
.
getIntrinsicSize
(
SVGLengthContext
(
100f
,
100f
)).
x
==
300f
)
assertEquals
(
aspectRatio
,
e
.
preserveAspectRatio
)
e
.
viewBox
=
Rect
.
makeXYWH
(
0f
,
1f
,
2f
,
3
f
)
require
(
e
.
getIntrinsicSize
(
SVGLengthContext
(
100f
,
100f
)).
x
==
300
f
)
require
(
e
.
viewBox
==
Rect
.
makeXYWH
(
0f
,
1f
,
2f
,
3f
)
)
e
.
viewBox
=
Rect
.
makeXYWH
(
0f
,
1f
,
2f
,
3f
)
}
require
(
e
.
viewBox
==
Rect
.
makeXYWH
(
0f
,
1f
,
2f
,
3f
))
}
}
}
}
skiko/src/jvmMain/cpp/common/svg/SVGDOM.cc
View file @
c7e5032c
...
@@ -22,11 +22,11 @@ extern "C" JNIEXPORT jlong JNICALL Java_org_jetbrains_skia_svg_SVGDOMKt_SVGDOM_1
...
@@ -22,11 +22,11 @@ extern "C" JNIEXPORT jlong JNICALL Java_org_jetbrains_skia_svg_SVGDOMKt_SVGDOM_1
return
reinterpret_cast
<
jlong
>
(
root
);
return
reinterpret_cast
<
jlong
>
(
root
);
}
}
extern
"C"
JNIEXPORT
jobject
JNICALL
Java_org_jetbrains_skia_svg_SVGDOMKt_SVGDOM_1nGetContainerSize
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGDOMKt_SVGDOM_1nGetContainerSize
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jfloatArray
dst
)
{
SkSVGDOM
*
instance
=
reinterpret_cast
<
SkSVGDOM
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGDOM
*
instance
=
reinterpret_cast
<
SkSVGDOM
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
const
SkSize
&
size
=
instance
->
containerSize
();
const
SkSize
&
size
=
instance
->
containerSize
();
return
skija
::
Point
::
make
(
env
,
size
.
fWidth
,
size
.
fHeigh
t
);
skija
::
Point
::
copyToInterop
(
env
,
{
size
.
fWidth
,
size
.
fHeight
},
ds
t
);
}
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGDOMKt_SVGDOM_1nSetContainerSize
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGDOMKt_SVGDOM_1nSetContainerSize
...
...
skiko/src/jvmMain/cpp/common/svg/SVGSVG.cc
View file @
c7e5032c
...
@@ -7,50 +7,51 @@
...
@@ -7,50 +7,51 @@
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetX
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetX
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
auto
x
=
instance
->
getX
();
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
env
,
instance
->
getX
(),
jresult
);
jint
result
[
2
]
=
{
rawBits
(
x
.
value
()),
(
jint
)
x
.
unit
()
};
env
->
SetIntArrayRegion
(
jresult
,
0
,
2
,
result
);
}
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetY
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetY
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
auto
y
=
instance
->
getY
();
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
env
,
instance
->
getY
(),
jresult
);
jint
result
[
2
]
=
{
rawBits
(
y
.
value
()),
(
jint
)
y
.
unit
()
};
env
->
SetIntArrayRegion
(
jresult
,
0
,
2
,
result
);
}
}
extern
"C"
JNIEXPORT
jobject
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetWidth
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetWidth
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
return
skija
::
svg
::
SVGLength
::
toJava
(
env
,
instance
->
getWidth
()
);
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
env
,
instance
->
getWidth
(),
jresult
);
}
}
extern
"C"
JNIEXPORT
jobject
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetHeight
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetHeight
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
return
skija
::
svg
::
SVGLength
::
toJava
(
env
,
instance
->
getHeight
()
);
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
env
,
instance
->
getHeight
(),
jresult
);
}
}
extern
"C"
JNIEXPORT
jobject
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetPreserveAspectRatio
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetPreserveAspectRatio
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jintArray
jresult
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
return
skija
::
svg
::
SVGPreserveAspectRatio
::
toJava
(
env
,
instance
->
getPreserveAspectRatio
()
);
return
skija
::
svg
::
SVGPreserveAspectRatio
::
copyToInterop
(
env
,
instance
->
getPreserveAspectRatio
(),
jresult
);
}
}
extern
"C"
JNIEXPORT
j
object
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetViewBox
extern
"C"
JNIEXPORT
j
boolean
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetViewBox
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
jfloatArray
result
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkTLazy
<
SkSVGViewBoxType
>
viewBox
=
instance
->
getViewBox
();
SkTLazy
<
SkSVGViewBoxType
>
viewBox
=
instance
->
getViewBox
();
return
viewBox
.
isValid
()
?
skija
::
Rect
::
fromSkRect
(
env
,
*
viewBox
.
get
())
:
nullptr
;
if
(
viewBox
.
isValid
())
{
skija
::
Rect
::
copyToInterop
(
env
,
*
viewBox
.
get
(),
result
);
return
true
;
}
else
{
return
false
;
}
}
}
extern
"C"
JNIEXPORT
jobject
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetIntrinsicSize
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nGetIntrinsicSize
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
float
width
,
float
height
,
float
dpi
)
{
(
JNIEnv
*
env
,
jclass
jclass
,
jlong
ptr
,
float
width
,
float
height
,
float
dpi
,
jfloatArray
result
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
static_cast
<
uintptr_t
>
(
ptr
));
SkSVGLengthContext
lc
({
width
,
height
},
dpi
);
SkSVGLengthContext
lc
({
width
,
height
},
dpi
);
SkSize
size
=
instance
->
intrinsicSize
(
lc
);
SkSize
size
=
instance
->
intrinsicSize
(
lc
);
return
skija
::
Point
::
fromSkPoint
(
env
,
{
size
.
width
(),
size
.
height
()}
);
skija
::
Point
::
copyToInterop
(
env
,
{
size
.
width
(),
size
.
height
()},
result
);
}
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nSetX
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_svg_SVGSVGKt_SVGSVG_1nSetX
...
...
skiko/src/jvmMain/cpp/common/svg/interop.cc
View file @
c7e5032c
#include <jni.h>
#include <jni.h>
#include "../interop.hh"
#include "interop.hh"
#include "interop.hh"
namespace
skija
{
namespace
skija
{
...
@@ -20,6 +21,11 @@ namespace skija {
...
@@ -20,6 +21,11 @@ namespace skija {
jobject
toJava
(
JNIEnv
*
env
,
SkSVGLength
length
)
{
jobject
toJava
(
JNIEnv
*
env
,
SkSVGLength
length
)
{
return
env
->
NewObject
(
cls
,
ctor
,
length
.
value
(),
static_cast
<
jint
>
(
length
.
unit
()));
return
env
->
NewObject
(
cls
,
ctor
,
length
.
value
(),
static_cast
<
jint
>
(
length
.
unit
()));
}
}
void
copyToInterop
(
JNIEnv
*
env
,
const
SkSVGLength
&
length
,
jintArray
dst
)
{
jint
result
[
2
]
=
{
rawBits
(
length
.
value
()),
static_cast
<
jint
>
(
length
.
unit
())
};
env
->
SetIntArrayRegion
(
dst
,
0
,
2
,
result
);
}
}
}
namespace
SVGPreserveAspectRatio
{
namespace
SVGPreserveAspectRatio
{
...
@@ -39,6 +45,11 @@ namespace skija {
...
@@ -39,6 +45,11 @@ namespace skija {
jobject
toJava
(
JNIEnv
*
env
,
SkSVGPreserveAspectRatio
ratio
)
{
jobject
toJava
(
JNIEnv
*
env
,
SkSVGPreserveAspectRatio
ratio
)
{
return
env
->
NewObject
(
cls
,
ctor
,
static_cast
<
jint
>
(
ratio
.
fAlign
),
static_cast
<
jint
>
(
ratio
.
fScale
));
return
env
->
NewObject
(
cls
,
ctor
,
static_cast
<
jint
>
(
ratio
.
fAlign
),
static_cast
<
jint
>
(
ratio
.
fScale
));
}
}
void
copyToInterop
(
JNIEnv
*
env
,
const
SkSVGPreserveAspectRatio
&
aspectRatio
,
jintArray
dst
)
{
jint
data
[
2
]
{
static_cast
<
jint
>
(
aspectRatio
.
fAlign
),
static_cast
<
jint
>
(
aspectRatio
.
fScale
)
};
env
->
SetIntArrayRegion
(
dst
,
0
,
2
,
data
);
}
}
}
void
onLoad
(
JNIEnv
*
env
)
{
void
onLoad
(
JNIEnv
*
env
)
{
...
...
skiko/src/jvmMain/cpp/common/svg/interop.hh
View file @
c7e5032c
...
@@ -10,6 +10,7 @@ namespace skija {
...
@@ -10,6 +10,7 @@ namespace skija {
void
onLoad
(
JNIEnv
*
env
);
void
onLoad
(
JNIEnv
*
env
);
void
onUnload
(
JNIEnv
*
env
);
void
onUnload
(
JNIEnv
*
env
);
jobject
toJava
(
JNIEnv
*
env
,
SkSVGLength
length
);
jobject
toJava
(
JNIEnv
*
env
,
SkSVGLength
length
);
void
copyToInterop
(
JNIEnv
*
env
,
const
SkSVGLength
&
length
,
jintArray
dst
);
}
}
namespace
SVGPreserveAspectRatio
{
namespace
SVGPreserveAspectRatio
{
...
@@ -18,6 +19,7 @@ namespace skija {
...
@@ -18,6 +19,7 @@ namespace skija {
void
onLoad
(
JNIEnv
*
env
);
void
onLoad
(
JNIEnv
*
env
);
void
onUnload
(
JNIEnv
*
env
);
void
onUnload
(
JNIEnv
*
env
);
jobject
toJava
(
JNIEnv
*
env
,
SkSVGPreserveAspectRatio
ratio
);
jobject
toJava
(
JNIEnv
*
env
,
SkSVGPreserveAspectRatio
ratio
);
void
copyToInterop
(
JNIEnv
*
env
,
const
SkSVGPreserveAspectRatio
&
aspectRatio
,
jintArray
dst
);
}
}
void
onLoad
(
JNIEnv
*
env
);
void
onLoad
(
JNIEnv
*
env
);
...
...
skiko/src/nativeJsMain/cpp/common.h
View file @
c7e5032c
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "SkShaper.h"
#include "SkShaper.h"
#include "SkString.h"
#include "SkString.h"
#include "SkSurfaceProps.h"
#include "SkSurfaceProps.h"
#include "SkSVGTypes.h"
#include "TextStyle.h"
#include "TextStyle.h"
#include "types.h"
#include "types.h"
...
@@ -93,6 +94,16 @@ namespace skija {
...
@@ -93,6 +94,16 @@ namespace skija {
int
fromString
(
SkString
str
);
int
fromString
(
SkString
str
);
}
}
}
}
namespace
svg
{
namespace
SVGLength
{
void
copyToInterop
(
const
SkSVGLength
&
length
,
KInteropPointer
dst
);
}
namespace
SVGPreserveAspectRatio
{
void
copyToInterop
(
const
SkSVGPreserveAspectRatio
&
aspectRatio
,
KInteropPointer
dst
);
}
}
}
}
std
::
unique_ptr
<
SkMatrix
>
skMatrix
(
KFloat
*
matrixArray
);
std
::
unique_ptr
<
SkMatrix
>
skMatrix
(
KFloat
*
matrixArray
);
...
...
skiko/src/nativeJsMain/cpp/common_interop.cc
View file @
c7e5032c
...
@@ -285,4 +285,22 @@ namespace skija {
...
@@ -285,4 +285,22 @@ namespace skija {
}
}
}
}
}
}
namespace
svg
{
namespace
SVGLength
{
void
copyToInterop
(
const
SkSVGLength
&
length
,
KInteropPointer
dst
)
{
KInt
*
result
=
reinterpret_cast
<
KInt
*>
(
dst
);
result
[
0
]
=
rawBits
(
length
.
value
());
result
[
1
]
=
static_cast
<
KInt
>
(
length
.
unit
());
}
}
namespace
SVGPreserveAspectRatio
{
void
copyToInterop
(
const
SkSVGPreserveAspectRatio
&
aspectRatio
,
KInteropPointer
dst
)
{
KInt
*
result
=
reinterpret_cast
<
KInt
*>
(
dst
);
result
[
0
]
=
static_cast
<
KInt
>
(
aspectRatio
.
fAlign
);
result
[
1
]
=
static_cast
<
KInt
>
(
aspectRatio
.
fScale
);
}
}
}
}
}
skiko/src/nativeJsMain/cpp/svg/SVGDOM.cc
View file @
c7e5032c
...
@@ -24,21 +24,12 @@ SKIKO_EXPORT KNativePointer org_jetbrains_skia_svg_SVGDOM__1nGetRoot
...
@@ -24,21 +24,12 @@ SKIKO_EXPORT KNativePointer org_jetbrains_skia_svg_SVGDOM__1nGetRoot
return
reinterpret_cast
<
KNativePointer
>
(
root
);
return
reinterpret_cast
<
KNativePointer
>
(
root
);
}
}
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGDOM__1nGetContainerSize
SKIKO_EXPORT
KInteropPointer
org_jetbrains_skia_svg_SVGDOM__1nGetContainerSize
(
KNativePointer
ptr
,
KInteropPointer
dst
)
{
(
KNativePointer
ptr
)
{
TODO
(
"implement org_jetbrains_skia_svg_SVGDOM__1nGetContainerSize"
);
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGDOM__1nGetContainerSize
(KNativePointer ptr) {
SkSVGDOM
*
instance
=
reinterpret_cast
<
SkSVGDOM
*>
((
ptr
));
SkSVGDOM
*
instance
=
reinterpret_cast
<
SkSVGDOM
*>
((
ptr
));
const
SkSize
&
size
=
instance
->
containerSize
();
const
SkSize
&
size
=
instance
->
containerSize
();
return skija::Point::make(env, size.fWidth, size.fHeigh
t);
skija
::
Point
::
copyToInterop
({
size
.
fWidth
,
size
.
fHeight
},
ds
t
);
}
}
#endif
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGDOM__1nSetContainerSize
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGDOM__1nSetContainerSize
(
KNativePointer
ptr
,
KFloat
width
,
KFloat
height
)
{
(
KNativePointer
ptr
,
KFloat
width
,
KFloat
height
)
{
...
...
skiko/src/nativeJsMain/cpp/svg/SVGSVG.cc
View file @
c7e5032c
...
@@ -11,107 +11,51 @@ SKIKO_EXPORT KInt org_jetbrains_skia_svg_SVGSVG__1nGetTag
...
@@ -11,107 +11,51 @@ SKIKO_EXPORT KInt org_jetbrains_skia_svg_SVGSVG__1nGetTag
return
static_cast
<
KInt
>
(
instance
->
tag
());
return
static_cast
<
KInt
>
(
instance
->
tag
());
}
}
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetX
(
KNativePointer
ptr
,
KInteropPointer
result
)
{
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetX
(
KNativePointer
ptr
,
KInt
*
result
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
ptr
);
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
ptr
);
auto
x
=
instance
->
getX
();
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
instance
->
getX
(),
result
);
result
[
0
]
=
rawBits
(
x
.
value
());
result
[
1
]
=
static_cast
<
KInt
>
(
x
.
unit
());
}
}
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetY
(
KNativePointer
ptr
,
KInt
*
result
)
{
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetY
(
KNativePointer
ptr
,
KInteropPointer
result
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
ptr
);
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
ptr
);
auto
y
=
instance
->
getY
();
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
instance
->
getY
(),
result
);
result
[
0
]
=
rawBits
(
y
.
value
());
result
[
1
]
=
static_cast
<
KInt
>
(
y
.
unit
());
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGSVG__1nGetY
(KNativePointer ptr) {
SkSVGSVG* instance = reinterpret_cast<SkSVGSVG*>((ptr));
return skija::svg::SVGLength::toJava(env, instance->getY());
}
}
#endif
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetHeight
(
KNativePointer
ptr
,
KInteropPointer
result
)
{
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
ptr
);
SKIKO_EXPORT
KInteropPointer
org_jetbrains_skia_svg_SVGSVG__1nGetWidth
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
instance
->
getHeight
(),
result
);
(
KNativePointer
ptr
)
{
TODO
(
"implement org_jetbrains_skia_svg_SVGSVG__1nGetWidth"
);
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGSVG__1nGetWidth
(KNativePointer ptr) {
SkSVGSVG* instance = reinterpret_cast<SkSVGSVG*>((ptr));
return skija::svg::SVGLength::toJava(env, instance->getWidth());
}
}
#endif
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetWidth
(
KNativePointer
ptr
,
KInteropPointer
result
)
{
SKIKO_EXPORT
KInteropPointer
org_jetbrains_skia_svg_SVGSVG__1nGetHeight
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
(
ptr
);
(
KNativePointer
ptr
)
{
return
skija
::
svg
::
SVGLength
::
copyToInterop
(
instance
->
getWidth
(),
result
);
TODO
(
"implement org_jetbrains_skia_svg_SVGSVG__1nGetHeight"
);
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGSVG__1nGetHeight
(KNativePointer ptr) {
SkSVGSVG* instance = reinterpret_cast<SkSVGSVG*>((ptr));
return skija::svg::SVGLength::toJava(env, instance->getHeight());
}
}
#endif
SKIKO_EXPORT
KInteropPointer
org_jetbrains_skia_svg_SVGSVG__1nGetPreserveAspectRatio
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetPreserveAspectRatio
(
KNativePointer
ptr
)
{
(
KNativePointer
ptr
,
KInteropPointer
result
)
{
TODO
(
"implement org_jetbrains_skia_svg_SVGSVG__1nGetPreserveAspectRatio"
);
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGSVG__1nGetPreserveAspectRatio
(KNativePointer ptr) {
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
((
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
((
ptr
));
return skija::svg::SVGPreserveAspectRatio::
toJava(env, instance->getPreserveAspectRatio()
);
return
skija
::
svg
::
SVGPreserveAspectRatio
::
copyToInterop
(
instance
->
getPreserveAspectRatio
(),
result
);
}
}
#endif
SKIKO_EXPORT
KBoolean
org_jetbrains_skia_svg_SVGSVG__1nGetViewBox
SKIKO_EXPORT
KInteropPointer
org_jetbrains_skia_svg_SVGSVG__1nGetViewBox
(
KNativePointer
ptr
,
KInteropPointer
result
)
{
(
KNativePointer
ptr
)
{
TODO
(
"implement org_jetbrains_skia_svg_SVGSVG__1nGetViewBox"
);
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGSVG__1nGetViewBox
(KNativePointer ptr) {
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
((
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
((
ptr
));
SkTLazy
<
SkSVGViewBoxType
>
viewBox
=
instance
->
getViewBox
();
SkTLazy
<
SkSVGViewBoxType
>
viewBox
=
instance
->
getViewBox
();
return viewBox.isValid() ? skija::Rect::fromSkRect(env, *viewBox.get()) : nullptr;
if
(
viewBox
.
isValid
())
{
skija
::
Rect
::
copyToInterop
(
*
viewBox
.
get
(),
result
);
return
true
;
}
else
{
return
false
;
}
}
}
#endif
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nGetIntrinsicSize
(
KNativePointer
ptr
,
float
width
,
float
height
,
float
dpi
,
KInteropPointer
result
)
{
SKIKO_EXPORT
KInteropPointer
org_jetbrains_skia_svg_SVGSVG__1nGetIntrinsicSize
(
KNativePointer
ptr
,
float
width
,
float
height
,
float
dpi
)
{
TODO
(
"implement org_jetbrains_skia_svg_SVGSVG__1nGetIntrinsicSize"
);
}
#if 0
SKIKO_EXPORT KInteropPointer org_jetbrains_skia_svg_SVGSVG__1nGetIntrinsicSize
(KNativePointer ptr, float width, float height, float dpi) {
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
((
ptr
));
SkSVGSVG
*
instance
=
reinterpret_cast
<
SkSVGSVG
*>
((
ptr
));
SkSVGLengthContext
lc
({
width
,
height
},
dpi
);
SkSVGLengthContext
lc
({
width
,
height
},
dpi
);
SkSize
size
=
instance
->
intrinsicSize
(
lc
);
SkSize
size
=
instance
->
intrinsicSize
(
lc
);
return skija::Point::fromSkPoint(env, {size.width(), size.height()}
);
skija
::
Point
::
copyToInterop
({
size
.
width
(),
size
.
height
()},
result
);
}
}
#endif
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nSetX
SKIKO_EXPORT
void
org_jetbrains_skia_svg_SVGSVG__1nSetX
(
KNativePointer
ptr
,
float
value
,
int
unit
)
{
(
KNativePointer
ptr
,
float
value
,
int
unit
)
{
...
...
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