-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22d02e6
commit 574e3ee
Showing
6 changed files
with
83 additions
and
8 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
skiko/src/commonMain/kotlin/org/jetbrains/skia/BBHFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jetbrains.skia | ||
|
||
import org.jetbrains.skia.impl.Managed | ||
import org.jetbrains.skia.impl.NativePointer | ||
import org.jetbrains.skia.impl.Stats | ||
|
||
// TODO class BBoxHierarchy internal constructor(ptr: NativePointer) : RefCnt(ptr) | ||
|
||
abstract class BBHFactory internal constructor(ptr: NativePointer) : Managed(ptr, _FinalizerHolder.PTR) { | ||
private object _FinalizerHolder { | ||
val PTR = BBHFactory_nGetFinalizer() | ||
} | ||
} | ||
|
||
class RTreeFactory : BBHFactory { | ||
@Suppress("ConvertSecondaryConstructorToPrimary") | ||
constructor() : super(RTreeFactory_nMake()) { | ||
Stats.onNativeCall() | ||
} | ||
} | ||
|
||
@ExternalSymbolName("org_jetbrains_skia_RTreeFactory__1nMake") | ||
@ModuleImport("./skiko.mjs", "org_jetbrains_skia_RTreeFactory__1nMake") | ||
private external fun RTreeFactory_nMake(): NativePointer | ||
|
||
@ExternalSymbolName("org_jetbrains_skia_BBHFactory__1nGetFinalizer") | ||
@ModuleImport("./skiko.mjs", "org_jetbrains_skia_BBHFactory_1nGetFinalizer") | ||
private external fun BBHFactory_nGetFinalizer(): NativePointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <jni.h> | ||
#include "interop.hh" | ||
#include "SkBBHFactory.h" | ||
|
||
static void deleteSkBBHFactory(SkBBHFactory* bbh) { | ||
delete bbh; | ||
} | ||
|
||
extern "C" JNIEXPORT jlong JNICALL Java_org_jetbrains_skia_BBHFactoryKt_RTreeFactory_1nMake | ||
(JNIEnv* env, jclass jclass) { | ||
SkRTreeFactory* instance = new SkRTreeFactory(); | ||
return reinterpret_cast<jlong>(instance); | ||
} | ||
|
||
extern "C" JNIEXPORT jlong JNICALL Java_org_jetbrains_skia_BBHFactoryKt_BBHFactory_1nGetFinalizer | ||
(JNIEnv* env, jclass jclass) { | ||
return static_cast<jlong>(reinterpret_cast<uintptr_t>(&deleteSkBBHFactory)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "common.h" | ||
#include "SkBBHFactory.h" | ||
|
||
static void deleteSkBBHFactory(SkBBHFactory* bbh) { | ||
delete bbh; | ||
} | ||
|
||
SKIKO_EXPORT KNativePointer org_jetbrains_skia_RTreeFactory__1nMake | ||
() { | ||
SkRTreeFactory* instance = new SkRTreeFactory(); | ||
return reinterpret_cast<KNativePointer>(instance); | ||
} | ||
|
||
SKIKO_EXPORT KNativePointer org_jetbrains_skia_BBHFactory__1nGetFinalizer | ||
() { | ||
return reinterpret_cast<KNativePointer>((&deleteSkBBHFactory)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters