Unverified Commit 8e84e9e0 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Generate docs (#480)

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