Unverified Commit 18eacd56 authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Simple MPP conversion. (#151)

parent 228274af
......@@ -48,20 +48,6 @@ val skiaZip = run {
}.map { zipFile }
}
fun String.insertAfterFirst(substring: String, stringToInsert: String): String =
let { orig ->
buildString {
var i = orig.indexOf(substring)
if (i < 0) return orig
i += substring.length
append(orig.substring(0, i))
append(stringToInsert)
append(orig.substring(i))
}
}
fun AbstractCopyTask.configureSkiaCopy(targetDir: File) {
into(targetDir)
}
......@@ -145,7 +131,6 @@ kotlin {
}
if (supportNative) {
val macosX64Main by getting {
}
}
}
......
......@@ -10,10 +10,10 @@ object Color {
}
fun makeARGB(a: Int, r: Int, g: Int, b: Int): Int {
assert(0 <= a && a <= 255) { "Alpha is out of 0..255 range: $a" }
assert(0 <= r && r <= 255) { "Red is out of 0..255 range: $r" }
assert(0 <= g && g <= 255) { "Green is out of 0..255 range: $g" }
assert(0 <= b && b <= 255) { "Blue is out of 0..255 range: $b" }
require(0 <= a && a <= 255) { "Alpha is out of 0..255 range: $a" }
require(0 <= r && r <= 255) { "Red is out of 0..255 range: $r" }
require(0 <= g && g <= 255) { "Green is out of 0..255 range: $g" }
require(0 <= b && b <= 255) { "Blue is out of 0..255 range: $b" }
return (a and 0xFF shl 24
or (r and 0xFF shl 16)
or (g and 0xFF shl 8)
......@@ -41,22 +41,22 @@ object Color {
}
fun withA(color: Int, a: Int): Int {
assert(0 <= a && a <= 255) { "Alpha is out of 0..255 range: $a" }
require(0 <= a && a <= 255) { "Alpha is out of 0..255 range: $a" }
return a and 0xFF shl 24 or (color and 0x00FFFFFF)
}
fun withR(color: Int, r: Int): Int {
assert(0 <= r && r <= 255) { "Red is out of 0..255 range: $r" }
require(0 <= r && r <= 255) { "Red is out of 0..255 range: $r" }
return r and 0xFF shl 16 or (color and -0xff0001)
}
fun withG(color: Int, g: Int): Int {
assert(0 <= g && g <= 255) { "Green is out of 0..255 range: $g" }
require(0 <= g && g <= 255) { "Green is out of 0..255 range: $g" }
return g and 0xFF shl 8 or (color and -0xff01)
}
fun withB(color: Int, b: Int): Int {
assert(0 <= b && b <= 255) { "Blue is out of 0..255 range: $b" }
require(0 <= b && b <= 255) { "Blue is out of 0..255 range: $b" }
return b and 0xFF or (color and -0x100)
}
}
\ No newline at end of file
package org.jetbrains.skija
class Color4f @JvmOverloads constructor(val r: Float, val g: Float, val b: Float, val a: Float = 1.0f) {
import kotlin.math.round
class Color4f constructor(val r: Float, val g: Float, val b: Float, val a: Float = 1.0f) {
constructor(rgba: FloatArray) : this(rgba[0], rgba[1], rgba[2], rgba[3]) {}
constructor(c: Int) : this(
......@@ -12,9 +14,9 @@ class Color4f @JvmOverloads constructor(val r: Float, val g: Float, val b: Float
}
fun toColor(): Int {
return Math.round(a * 255.0f) shl 24 or (Math.round(r * 255.0f) shl 16) or (Math.round(
return round(a * 255.0f).toInt() shl 24 or (round(r * 255.0f).toInt() shl 16) or (round(
g * 255.0f
) shl 8) or Math.round(b * 255.0f)
).toInt() shl 8) or round(b * 255.0f).toInt()
}
fun flatten(): FloatArray {
......@@ -36,10 +38,10 @@ class Color4f @JvmOverloads constructor(val r: Float, val g: Float, val b: Float
if (o !is Color4f) return false
val other = o
if (!other.canEqual(this as Any)) return false
if (java.lang.Float.compare(r, other.r) != 0) return false
if (java.lang.Float.compare(g, other.g) != 0) return false
if (java.lang.Float.compare(b, other.b) != 0) return false
return if (java.lang.Float.compare(a, other.a) != 0) false else true
if (r.compareTo(other.r) != 0) return false
if (g.compareTo(other.g) != 0) return false
if (b.compareTo(other.b) != 0) return false
return a.compareTo(other.a) == 0
}
protected fun canEqual(other: Any?): Boolean {
......@@ -49,15 +51,15 @@ class Color4f @JvmOverloads constructor(val r: Float, val g: Float, val b: Float
override fun hashCode(): Int {
val PRIME = 59
var result = 1
result = result * PRIME + java.lang.Float.floatToIntBits(r)
result = result * PRIME + java.lang.Float.floatToIntBits(g)
result = result * PRIME + java.lang.Float.floatToIntBits(b)
result = result * PRIME + java.lang.Float.floatToIntBits(a)
result = result * PRIME + r.toBits()
result = result * PRIME + g.toBits()
result = result * PRIME + b.toBits()
result = result * PRIME + a.toBits()
return result
}
override fun toString(): String {
return "Color4f(_r=" + r + ", _g=" + g + ", _b=" + b + ", _a=" + a + ")"
return "Color4f(_r=$r, _g=$g, _b=$b, _a=$a)"
}
fun withR(_r: Float): Color4f {
......
package org.jetbrains.skija
import org.jetbrains.skija.impl.Stats
import java.lang.IllegalArgumentException
import java.lang.RuntimeException
/**
* Describes how pixel bits encode color. A pixel may be an alpha mask, a
* grayscale, RGB, or ARGB.
......@@ -172,20 +168,8 @@ enum class ColorType {
R16G16_FLOAT -> 2
R16G16B16A16_UNORM -> 3
}
throw RuntimeException("Unreachable")
}
/**
* Returns true if ColorType always decodes alpha to 1.0, making the pixel
* fully opaque. If true, ColorType does not reserve bits to encode alpha.
*
* @return true if alpha is always set to 1.0
*/
val isAlwaysOpaque: Boolean
get() {
Stats.onNativeCall()
return _nIsAlwaysOpaque(ordinal)
}
/**
*
......@@ -219,7 +203,7 @@ enum class ColorType {
fun getR(color: Byte): Float {
return when (this) {
GRAY_8 -> java.lang.Byte.toUnsignedInt(color) / 255f
GRAY_8 -> (color.toInt() and 0xff) / 255f
else -> throw IllegalArgumentException("getR(byte) is not supported on ColorType.$this")
}
}
......@@ -247,7 +231,7 @@ enum class ColorType {
fun getG(color: Byte): Float {
return when (this) {
GRAY_8 -> java.lang.Byte.toUnsignedInt(color) / 255f
GRAY_8 -> (color.toInt() and 0xff) / 255f
else -> throw IllegalArgumentException("getG(byte) is not supported on ColorType.$this")
}
}
......@@ -275,7 +259,7 @@ enum class ColorType {
fun getB(color: Byte): Float {
return when (this) {
GRAY_8 -> java.lang.Byte.toUnsignedInt(color) / 255f
GRAY_8 -> (color.toInt() and 0xff).toFloat() / 255f
else -> throw IllegalArgumentException("getB(byte) is not supported on ColorType.$this")
}
}
......@@ -303,7 +287,7 @@ enum class ColorType {
fun getA(color: Byte): Float {
return when (this) {
ALPHA_8 -> java.lang.Byte.toUnsignedInt(color) / 255f
ALPHA_8 -> (color.toInt() and 0xff) / 255f
else -> throw IllegalArgumentException("getA(byte) is not supported on ColorType.$this")
}
}
......@@ -330,6 +314,5 @@ enum class ColorType {
* Native ARGB 32-bit encoding
*/
var N32 = BGRA_8888
@JvmStatic external fun _nIsAlwaysOpaque(value: Int): Boolean
}
}
\ No newline at end of file
......@@ -24,8 +24,7 @@ package org.jetbrains.skija
class CubicResampler(internal val b: Float, internal val c: Float) : SamplingMode {
override fun _pack(): Long {
return ((java.lang.Float.floatToIntBits(b).toULong() shl 32) or
java.lang.Float.floatToIntBits(c).toULong()).toLong()
return ((b.toBits().toULong() shl 32) or c.toBits().toULong()).toLong()
}
override fun equals(o: Any?): Boolean {
......@@ -33,8 +32,8 @@ class CubicResampler(internal val b: Float, internal val c: Float) : SamplingMod
if (o !is CubicResampler) return false
val other = o
if (!other.canEqual(this as Any)) return false
if (java.lang.Float.compare(b, other.b) != 0) return false
return if (java.lang.Float.compare(c, other.c) != 0) false else true
if (b.compareTo(other.b) != 0) return false
return c.compareTo(other.c) == 0
}
protected fun canEqual(other: Any?): Boolean {
......@@ -44,12 +43,12 @@ class CubicResampler(internal val b: Float, internal val c: Float) : SamplingMod
override fun hashCode(): Int {
val PRIME = 59
var result = 1
result = result * PRIME + java.lang.Float.floatToIntBits(b)
result = result * PRIME + java.lang.Float.floatToIntBits(c)
result = result * PRIME + b.toBits()
result = result * PRIME + c.toBits()
return result
}
override fun toString(): String {
return "CubicResampler(_B=" + b + ", _C=" + c + ")"
return "CubicResampler(_B=$b, _C=$c)"
}
}
\ No newline at end of file
package org.jetbrains.skija
import java.lang.IllegalArgumentException
enum class EncodedOrigin {
_UNUSED,
......
package org.jetbrains.skija
class FilterMipmap @JvmOverloads constructor(
class FilterMipmap constructor(
internal val filterMode: FilterMode,
internal val mipmapMode: MipmapMode = MipmapMode.NONE
) : SamplingMode {
......@@ -16,10 +16,10 @@ class FilterMipmap @JvmOverloads constructor(
if (!other.canEqual(this as Any)) return false
val `this$_filterMode`: Any = filterMode
val `other$_filterMode`: Any = other.filterMode
if (if (`this$_filterMode` == null) `other$_filterMode` != null else `this$_filterMode` != `other$_filterMode`) return false
if (`this$_filterMode` != `other$_filterMode`) return false
val `this$_mipmapMode`: Any = mipmapMode
val `other$_mipmapMode`: Any = other.mipmapMode
return if (if (`this$_mipmapMode` == null) `other$_mipmapMode` != null else `this$_mipmapMode` != `other$_mipmapMode`) false else true
return `this$_mipmapMode` == `other$_mipmapMode`
}
protected fun canEqual(other: Any?): Boolean {
......@@ -30,13 +30,13 @@ class FilterMipmap @JvmOverloads constructor(
val PRIME = 59
var result = 1
val `$_filterMode`: Any = filterMode
result = result * PRIME + (`$_filterMode`?.hashCode() ?: 43)
result = result * PRIME + (`$_filterMode`.hashCode())
val `$_mipmapMode`: Any = mipmapMode
result = result * PRIME + (`$_mipmapMode`?.hashCode() ?: 43)
result = result * PRIME + (`$_mipmapMode`.hashCode())
return result
}
override fun toString(): String {
return "FilterMipmap(_filterMode=" + filterMode + ", _mipmapMode=" + mipmapMode + ")"
return "FilterMipmap(_filterMode=$filterMode, _mipmapMode=$mipmapMode)"
}
}
\ No newline at end of file
......@@ -3,21 +3,19 @@ package org.jetbrains.skija
interface FourByteTag {
companion object {
fun fromString(name: String): Int {
assert(name.length == 4) { "Name must be exactly 4 symbols, got: '$name'" }
require(name.length == 4) { "Name must be exactly 4 symbols, got: '$name'" }
return name[0].code and 0xFF shl 24 or (name[1].code and 0xFF shl 16
) or (name[2].code and 0xFF shl 8
) or (name[3].code and 0xFF)
}
fun toString(tag: Int): String {
return String(
byteArrayOf(
(tag shr 24 and 0xFF).toByte(),
(tag shr 16 and 0xFF).toByte(),
(tag shr 8 and 0xFF).toByte(),
(tag and 0xFF).toByte()
)
)
return charArrayOf(
(tag shr 24 and 0xFF).toChar(),
(tag shr 16 and 0xFF).toChar(),
(tag shr 8 and 0xFF).toChar(),
(tag and 0xFF).toChar()
).concatToString()
}
}
}
\ No newline at end of file
package org.jetbrains.skija
class IPoint(val x: Int, val y: Int) {
fun offset(dx: Int, dy: Int): IPoint {
......@@ -8,7 +7,6 @@ class IPoint(val x: Int, val y: Int) {
}
fun offset(vec: IPoint): IPoint {
assert(vec != null) { "IPoint::offset expected other != null" }
return offset(vec.x, vec.y)
}
......@@ -37,7 +35,7 @@ class IPoint(val x: Int, val y: Int) {
}
override fun toString(): String {
return "IPoint(_x=" + x + ", _y=" + y + ")"
return "IPoint(_x=$x, _y=$y)"
}
companion object {
......
......@@ -2,8 +2,4 @@ package org.jetbrains.skija
enum class InversionMode {
NO, BRIGHTNESS, LIGHTNESS;
companion object {
internal val _values = values()
}
}
\ No newline at end of file
package org.jetbrains.skija
import java.util.*
import kotlin.math.PI
import kotlin.math.abs
import kotlin.math.cos
import kotlin.math.sin
internal fun Float.toRadians(): Double = this.toDouble() / 180 * PI
/**
*
......@@ -114,7 +119,7 @@ class Matrix33(vararg mat: Float) {
if (o !is Matrix33) return false
val other = o
if (!other.canEqual(this as Any)) return false
return if (!Arrays.equals(mat, other.mat)) false else true
return mat.contentEquals(other.mat)
}
protected fun canEqual(other: Any?): Boolean {
......@@ -124,12 +129,12 @@ class Matrix33(vararg mat: Float) {
override fun hashCode(): Int {
val PRIME = 59
var result = 1
result = result * PRIME + Arrays.hashCode(mat)
result = result * PRIME + mat.contentHashCode()
return result
}
override fun toString(): String {
return "Matrix33(_mat=" + Arrays.toString(mat) + ")"
return "Matrix33(_mat=$mat)"
}
companion object {
......@@ -204,12 +209,12 @@ class Matrix33(vararg mat: Float) {
* @return Matrix33 with rotation
*/
fun makeRotate(deg: Float): Matrix33 {
val rad = Math.toRadians(deg.toDouble())
var sin = Math.sin(rad)
var cos = Math.cos(rad)
val rad = deg.toRadians()
var sin = sin(rad)
var cos = cos(rad)
val tolerance = (1.0f / (1 shl 12)).toDouble()
if (Math.abs(sin) <= tolerance) sin = 0.0
if (Math.abs(cos) <= tolerance) cos = 0.0
if (abs(sin) <= tolerance) sin = 0.0
if (abs(cos) <= tolerance) cos = 0.0
return Matrix33(
*floatArrayOf(
cos.toFloat(),
......@@ -245,12 +250,12 @@ class Matrix33(vararg mat: Float) {
* @return Matrix33 with rotation
*/
fun makeRotate(deg: Float, pivotx: Float, pivoty: Float): Matrix33 {
val rad = Math.toRadians(deg.toDouble())
var sin = Math.sin(rad)
var cos = Math.cos(rad)
val rad = deg.toRadians()
var sin = sin(rad)
var cos = cos(rad)
val tolerance = (1.0f / (1 shl 12)).toDouble()
if (Math.abs(sin) <= tolerance) sin = 0.0
if (Math.abs(cos) <= tolerance) cos = 0.0
if (abs(sin) <= tolerance) sin = 0.0
if (abs(cos) <= tolerance) cos = 0.0
return Matrix33(
*floatArrayOf(
cos.toFloat(),
......@@ -286,7 +291,7 @@ class Matrix33(vararg mat: Float) {
}
init {
assert(mat.size == 9) { (if ("Expected 9 elements, got $mat" == null) null else mat.size)!! }
require(mat.size == 9) { (if ("Expected 9 elements, got $mat" == null) null else mat.size)!! }
this.mat = mat
}
}
\ No newline at end of file
package org.jetbrains.skija
import java.util.*
/**
*
* 4x4 matrix used by SkCanvas and other parts of Skia.
......@@ -41,7 +39,7 @@ class Matrix44(vararg mat: Float) {
if (o !is Matrix44) return false
val other = o
if (!other.canEqual(this as Any)) return false
return if (!Arrays.equals(mat, other.mat)) false else true
return mat.contentEquals(other.mat)
}
protected fun canEqual(other: Any?): Boolean {
......@@ -51,12 +49,12 @@ class Matrix44(vararg mat: Float) {
override fun hashCode(): Int {
val PRIME = 59
var result = 1
result = result * PRIME + Arrays.hashCode(mat)
result = result * PRIME + mat.contentHashCode()
return result
}
override fun toString(): String {
return "Matrix44(_mat=" + Arrays.toString(mat) + ")"
return "Matrix44(_mat=$mat)"
}
companion object {
......@@ -67,7 +65,7 @@ class Matrix44(vararg mat: Float) {
* The constructor parameters are in row-major order.
*/
init {
assert(mat.size == 16) { (if ("Expected 16 elements, got $mat" == null) null else mat.size)!! }
require(mat.size == 16) { (if ("Expected 16 elements, got $mat" == null) null else mat.size)!! }
this.mat = mat
}
}
\ No newline at end of file
package org.jetbrains.skija
import java.lang.RuntimeException
enum class PathFillMode {
/** Specifies that "inside" is computed by a non-zero sum of signed edge crossings. */
WINDING,
......
......@@ -7,7 +7,6 @@ class Point(val x: Float, val y: Float) {
}
fun offset(vec: Point): Point {
assert(vec != null) { "Point::offset expected other != null" }
return offset(vec.x, vec.y)
}
......@@ -27,8 +26,8 @@ class Point(val x: Float, val y: Float) {
if (o !is Point) return false
val other = o
if (!other.canEqual(this as Any)) return false
if (java.lang.Float.compare(x, other.x) != 0) return false
return if (java.lang.Float.compare(y, other.y) != 0) false else true
if (x.compareTo(other.x) != 0) return false
return if (y.compareTo(other.y) != 0) false else true
}
protected fun canEqual(other: Any?): Boolean {
......@@ -38,13 +37,13 @@ class Point(val x: Float, val y: Float) {
override fun hashCode(): Int {
val PRIME = 59
var result = 1
result = result * PRIME + java.lang.Float.floatToIntBits(x)
result = result * PRIME + java.lang.Float.floatToIntBits(y)
result = result * PRIME + x.toBits()
result = result * PRIME + y.toBits()
return result
}
override fun toString(): String {
return "Point(_x=" + x + ", _y=" + y + ")"
return "Point(_x=$x, _y=$y)"
}
companion object {
......@@ -61,7 +60,7 @@ class Point(val x: Float, val y: Float) {
fun fromArray(pts: FloatArray?): Array<Point?>? {
if (pts == null) return null
assert(pts.size % 2 == 0) { "Expected " + pts.size + " % 2 == 0" }
require(pts.size % 2 == 0) { "Expected " + pts.size + " % 2 == 0" }
val arr = arrayOfNulls<Point>(pts.size / 2)
for (i in 0 until pts.size / 2) arr[i] = Point(pts[i * 2], pts[i * 2 + 1])
return arr
......
......@@ -6,9 +6,9 @@ class Point3(val x: Float, val y: Float, val z: Float) {
if (o !is Point3) return false
val other = o
if (!other.canEqual(this as Any)) return false
if (java.lang.Float.compare(x, other.x) != 0) return false
if (java.lang.Float.compare(y, other.y) != 0) return false
return if (java.lang.Float.compare(z, other.z) != 0) false else true
if (x.compareTo(other.x) != 0) return false
if (y.compareTo(other.y) != 0) return false
return z.compareTo(other.z) == 0
}
protected fun canEqual(other: Any?): Boolean {
......@@ -18,13 +18,13 @@ class Point3(val x: Float, val y: Float, val z: Float) {
override fun hashCode(): Int {
val PRIME = 59
var result = 1
result = result * PRIME + java.lang.Float.floatToIntBits(x)
result = result * PRIME + java.lang.Float.floatToIntBits(y)
result = result * PRIME + java.lang.Float.floatToIntBits(z)
result = result * PRIME + x.toBits()
result = result * PRIME + y.toBits()
result = result * PRIME + z.toBits()
return result
}
override fun toString(): String {
return "Point3(_x=" + x + ", _y=" + y + ", _z=" + z + ")"
return "Point3(_x=$x, _y=$y, _z=$z)"
}
}
\ No newline at end of file
......@@ -22,9 +22,4 @@ enum class SurfaceColorFormat {
A16_UNORM, //<! pixel with a little endian uint16_t for alpha
R16G16_UNORM, //<! pixel with a little endian uint16_t for red and green
R16G16B16A16_UNORM;
companion object {
//<! pixel with a little endian uint16_t for red, green, blue, and alpha
internal val _values = values()
}
}
\ No newline at end of file
......@@ -2,8 +2,4 @@ package org.jetbrains.skija.paragraph
enum class Affinity {
UPSTREAM, DOWNSTREAM;
companion object {
internal val _values = values()
}
}
\ No newline at end of file
......@@ -2,8 +2,4 @@ package org.jetbrains.skija.paragraph
enum class Alignment {
LEFT, RIGHT, CENTER, JUSTIFY, START, END;
companion object {
internal val _values = values()
}
}
\ No newline at end of file
......@@ -2,8 +2,4 @@ package org.jetbrains.skija.svg
enum class SVGLengthUnit {
UNKNOWN, NUMBER, PERCENTAGE, EMS, EXS, PX, CM, MM, IN, PT, PC;
companion object {
internal val _values = values()
}
}
\ No newline at end of file
package org.jetbrains.skija
import org.jetbrains.skija.impl.Library.Companion.staticLoad
import org.jetbrains.annotations.Contract
import org.jetbrains.skija.ImageFilter.Companion.makeDropShadowOnly
import org.jetbrains.skija.impl.Managed
import org.jetbrains.skija.impl.Native
......@@ -1235,7 +1234,6 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
/**
* Returns the total transformation matrix for the canvas.
*/
@get:Contract("-> new")
val localToDevice: Matrix44
get() = try {
Stats.onNativeCall()
......@@ -1245,7 +1243,6 @@ open class Canvas internal constructor(ptr: Long, managed: Boolean, internal val
Reference.reachabilityFence(this)
}
@get:Contract("-> new")
val localToDeviceAsMatrix33: Matrix33
get() = localToDevice.asMatrix33()
......
......@@ -2,7 +2,6 @@ package org.jetbrains.skija
import org.jetbrains.skija.impl.Library.Companion.staticLoad
import org.jetbrains.skija.impl.Managed
import org.jetbrains.skija.impl.Native
import org.jetbrains.skija.impl.Stats
import java.lang.ref.Reference
......@@ -33,7 +32,7 @@ class ColorSpace : Managed {
Color4f(
_nConvert(
_ptr,
Native.Companion.getPtr(to),
getPtr(to),
color.r,
color.g,
color.b,
......
package org.jetbrains.skija
class Extensions {
companion object {
@JvmStatic
external fun _nIsAlwaysOpaque(value: Int): Boolean
}
}
/**
* Returns true if ColorType always decodes alpha to 1.0, making the pixel
* fully opaque. If true, ColorType does not reserve bits to encode alpha.
*
* @return true if alpha is always set to 1.0
*/
val ColorType.isAlwaysOpaque: Boolean
get() {
return Extensions._nIsAlwaysOpaque(ordinal)
}
......@@ -47,7 +47,7 @@ class DecorationStyle(
return _gaps
}
val lineStyle: org.jetbrains.skija.paragraph.DecorationLineStyle
val lineStyle: DecorationLineStyle
get() = _lineStyle
override fun equals(o: Any?): Boolean {
......
......@@ -82,10 +82,10 @@ class ParagraphStyle : Managed(_nMake(), _FinalizerHolder.PTR) {
}
}
val direction: org.jetbrains.skija.paragraph.Direction
val direction: Direction
get() = try {
Stats.onNativeCall()
Direction.values().get(_nGetDirection(_ptr))
Direction.values()[_nGetDirection(_ptr)]
} finally {
Reference.reachabilityFence(this)
}
......@@ -96,10 +96,10 @@ class ParagraphStyle : Managed(_nMake(), _FinalizerHolder.PTR) {
return this
}
val alignment: org.jetbrains.skija.paragraph.Alignment
val alignment: Alignment
get() = try {
Stats.onNativeCall()
Alignment._values.get(_nGetAlignment(_ptr))
Alignment.values()[_nGetAlignment(_ptr)]
} finally {
Reference.reachabilityFence(this)
}
......@@ -152,10 +152,10 @@ class ParagraphStyle : Managed(_nMake(), _FinalizerHolder.PTR) {
return this
}
val heightMode: org.jetbrains.skija.paragraph.HeightMode
val heightMode: HeightMode
get() = try {
Stats.onNativeCall()
HeightMode.values().get(_nGetHeightMode(_ptr))
HeightMode.values()[_nGetHeightMode(_ptr)]
} finally {
Reference.reachabilityFence(this)
}
......@@ -166,10 +166,10 @@ class ParagraphStyle : Managed(_nMake(), _FinalizerHolder.PTR) {
return this
}
val effectiveAlignment: org.jetbrains.skija.paragraph.Alignment
val effectiveAlignment: Alignment
get() = try {
Stats.onNativeCall()
Alignment._values.get(_nGetEffectiveAlignment(_ptr))
Alignment.values()[_nGetEffectiveAlignment(_ptr)]
} finally {
Reference.reachabilityFence(this)
}
......
......@@ -34,9 +34,9 @@ class PlaceholderStyle(
* the alphabetic baseline.
*/
val baseline: Float
val alignment: org.jetbrains.skija.paragraph.PlaceholderAlignment
val alignment: PlaceholderAlignment
get() = _alignment
val baselineMode: org.jetbrains.skija.paragraph.BaselineMode
val baselineMode: BaselineMode
get() = _baselineMode
override fun equals(o: Any?): Boolean {
......
......@@ -10,7 +10,7 @@ class TextBox(val rect: Rect, direction: Direction) {
Direction.values().get(direction)
)
val direction: org.jetbrains.skija.paragraph.Direction
val direction: Direction
get() = _direction
override fun equals(o: Any?): Boolean {
......
......@@ -350,7 +350,7 @@ class TextStyle internal constructor(ptr: Long) : Managed(ptr, _FinalizerHolder.
return this
}
val baselineMode: org.jetbrains.skija.paragraph.BaselineMode
val baselineMode: BaselineMode
get() = try {
Stats.onNativeCall()
BaselineMode.values().get(_nGetBaselineMode(_ptr))
......
......@@ -4,11 +4,11 @@ class SVGLength(internal val value: Float, unit: SVGLengthUnit) {
internal val _unit: SVGLengthUnit
internal constructor(value: Float, unit: Int) : this(value, SVGLengthUnit._values.get(unit))
internal constructor(value: Float, unit: Int) : this(value, SVGLengthUnit.values()[unit])
constructor(value: Float) : this(value, SVGLengthUnit.NUMBER) {}
val unit: org.jetbrains.skija.svg.SVGLengthUnit
val unit: SVGLengthUnit
get() = _unit
override fun equals(o: Any?): Boolean {
......@@ -16,10 +16,10 @@ class SVGLength(internal val value: Float, unit: SVGLengthUnit) {
if (o !is SVGLength) return false
val other = o
if (!other.canEqual(this as Any)) return false
if (java.lang.Float.compare(value, other.value) != 0) return false
if (value.compareTo(other.value) != 0) return false
val `this$_unit`: Any = unit
val `other$_unit`: Any = other.unit
return if (if (`this$_unit` == null) `other$_unit` != null else `this$_unit` != `other$_unit`) false else true
return `this$_unit` == `other$_unit`
}
protected fun canEqual(other: Any?): Boolean {
......@@ -36,7 +36,7 @@ class SVGLength(internal val value: Float, unit: SVGLengthUnit) {
}
override fun toString(): String {
return "SVGLength(_value=" + value + ", _unit=" + unit + ")"
return "SVGLength(_value=$value, _unit=$unit)"
}
fun withValue(_value: Float): SVGLength {
......
package org.jetbrains.skiko.context
import org.jetbrains.skija.ColorSpace
import org.jetbrains.skija.Surface
import org.jetbrains.skija.SurfaceColorFormat
import org.jetbrains.skija.SurfaceOrigin
import org.jetbrains.skija.impl.Native
import org.jetbrains.skiko.SkiaLayer
import org.jetbrains.skiko.redrawer.Direct3DRedrawer
......
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