Unverified Commit 239f685e authored by Nikolay Igotti's avatar Nikolay Igotti Committed by GitHub

Move to Skia m99-51988d0bc1 (#457)

Co-authored-by: 's avatarAleksandr Veselov <aleksandr.veselov@jetbrains.com>
parent 83394aa1
......@@ -3,15 +3,15 @@ deploy.version=0.0.0
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
dependencies.skia.windows-x64=m97-0b898c4b8e
dependencies.skia.linux-x64=m97-0b898c4b8e
dependencies.skia.macos-x64=m97-0b898c4b8e
dependencies.skia.linux-arm64=m97-0b898c4b8e
dependencies.skia.macos-arm64=m97-0b898c4b8e
dependencies.skia.wasm-wasm=m97-0b898c4b8e
dependencies.skia.ios-x64=m97-0b898c4b8e
dependencies.skia.ios-arm64=m97-0b898c4b8e
dependencies.skia.android-x64=m97-0b898c4b8e
dependencies.skia.android-arm64=m97-0b898c4b8e
dependencies.skia.windows-x64=m99-51988d0bc1
dependencies.skia.linux-x64=m99-51988d0bc1
dependencies.skia.macos-x64=m99-51988d0bc1
dependencies.skia.linux-arm64=m99-51988d0bc1
dependencies.skia.macos-arm64=m99-51988d0bc1
dependencies.skia.wasm-wasm=m99-51988d0bc1
dependencies.skia.ios-x64=m99-51988d0bc1
dependencies.skia.ios-arm64=m99-51988d0bc1
dependencies.skia.android-x64=m99-51988d0bc1
dependencies.skia.android-arm64=m99-51988d0bc1
org.gradle.jvmargs=-Xmx3G
......@@ -488,11 +488,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
fun drawPicture(picture: Picture): Canvas {
return drawPicture(picture, null, null)
}
fun drawPicture(picture: Picture, matrix: Matrix33?, paint: Paint?): Canvas {
fun drawPicture(picture: Picture, matrix: Matrix33? = null, paint: Paint? = null): Canvas {
Stats.onNativeCall()
interopScope {
_nDrawPicture(_ptr, getPtr(picture), toInterop(matrix?.mat), getPtr(paint))
......@@ -502,61 +498,6 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
/**
*
* Draws a triangle mesh, using clip and Matrix.
*
*
* If paint contains an Shader, the shader is mapped using the vertices' positions.
*
*
* If vertices colors are defined in vertices, and Paint paint contains Shader,
* BlendMode mode combines vertices colors with Shader.
*
* @param positions triangle mesh to draw
* @param colors color array, one for each corner; may be null
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices_2](https://fiddle.skia.org/c/@Canvas_drawVertices_2)
*/
fun drawTriangles(positions: Array<Point>, colors: IntArray?, paint: Paint): Canvas {
return drawTriangles(positions, colors, null, null, BlendMode.MODULATE, paint)
}
/**
*
* Draws a triangle mesh, using clip and Matrix.
*
*
* If paint contains an Shader and vertices does not contain texCoords, the shader
* is mapped using the vertices' positions.
*
*
* If vertices colors are defined in vertices, and Paint paint contains Shader,
* BlendMode mode combines vertices colors with Shader.
*
* @param positions triangle mesh to draw
* @param colors color array, one for each corner; may be null
* @param texCoords Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices_2](https://fiddle.skia.org/c/@Canvas_drawVertices_2)
*/
fun drawTriangles(
positions: Array<Point>,
colors: IntArray?,
texCoords: Array<Point>?,
indices: ShortArray?,
paint: Paint
): Canvas {
return drawTriangles(positions, colors, texCoords, indices, BlendMode.MODULATE, paint)
}
/**
*
* Draws a triangle mesh, using clip and Matrix.
......@@ -573,7 +514,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
* @param colors color array, one for each corner; may be null
* @param texCoords Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param mode combines vertices colors with Shader, if both are present
* @param blendMode combines vertices colors with Shader, if both are present
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
......@@ -582,10 +523,10 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
*/
fun drawTriangles(
positions: Array<Point>,
colors: IntArray?,
texCoords: Array<Point>?,
indices: ShortArray?,
mode: BlendMode,
colors: IntArray? = null,
texCoords: Array<Point>? = null,
indices: ShortArray? = null,
blendMode: BlendMode,
paint: Paint
): Canvas {
require(positions.size % 3 == 0) { "Expected positions.length % 3 == 0, got: " + positions.size }
......@@ -602,7 +543,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
toInterop(Point.flattenArray(texCoords)),
indices?.size ?: 0,
toInterop(indices),
mode.ordinal,
blendMode.ordinal,
getPtr(paint)
)
}
......@@ -610,29 +551,6 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
/**
*
* Draws a triangle strip mesh, using clip and Matrix.
*
*
* If paint contains an Shader, the shader is mapped using the vertices' positions.
*
*
* If vertices colors are defined in vertices, and Paint paint contains Shader,
* BlendMode mode combines vertices colors with Shader.
*
* @param positions triangle mesh to draw
* @param colors color array, one for each corner; may be null
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices_2](https://fiddle.skia.org/c/@Canvas_drawVertices_2)
*/
fun drawTriangleStrip(positions: Array<Point>, colors: IntArray?, paint: Paint): Canvas {
return drawTriangleStrip(positions, colors, null, null, BlendMode.MODULATE, paint)
}
/**
*
* Draws a triangle strip mesh, using clip and Matrix.
......@@ -649,6 +567,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
* @param colors color array, one for each corner; may be null
* @param texCoords Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param blendMode combines vertices colors with Shader, if both are present
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
......@@ -657,43 +576,10 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
*/
fun drawTriangleStrip(
positions: Array<Point>,
colors: IntArray?,
texCoords: Array<Point>?,
indices: ShortArray?,
paint: Paint
): Canvas {
return drawTriangleStrip(positions, colors, texCoords, indices, BlendMode.MODULATE, paint)
}
/**
*
* Draws a triangle strip mesh, using clip and Matrix.
*
*
* If paint contains an Shader and vertices does not contain texCoords, the shader
* is mapped using the vertices' positions.
*
*
* If vertices colors are defined in vertices, and Paint paint contains Shader,
* BlendMode mode combines vertices colors with Shader.
*
* @param positions triangle mesh to draw
* @param colors color array, one for each corner; may be null
* @param texCoords Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param mode combines vertices colors with Shader, if both are present
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices_2](https://fiddle.skia.org/c/@Canvas_drawVertices_2)
*/
fun drawTriangleStrip(
positions: Array<Point>,
colors: IntArray?,
texCoords: Array<Point>?,
indices: ShortArray?,
mode: BlendMode,
colors: IntArray? = null,
texCoords: Array<Point>? = null,
indices: ShortArray? = null,
blendMode: BlendMode,
paint: Paint
): Canvas {
require(colors == null || colors.size == positions.size) { "Expected colors.length == positions.length, got: " + colors!!.size + " != " + positions.size }
......@@ -709,7 +595,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
toInterop(Point.flattenArray(texCoords)),
indices?.size ?: 0,
toInterop(indices),
mode.ordinal,
blendMode.ordinal,
getPtr(paint)
)
}
......@@ -717,61 +603,6 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
/**
*
* Draws a triangle fan mesh, using clip and Matrix.
*
*
* If paint contains an Shader, the shader is mapped using the vertices' positions.
*
*
* If vertices colors are defined in vertices, and Paint paint contains Shader,
* BlendMode mode combines vertices colors with Shader.
*
* @param positions triangle mesh to draw
* @param colors color array, one for each corner; may be null
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices_2](https://fiddle.skia.org/c/@Canvas_drawVertices_2)
*/
fun drawTriangleFan(positions: Array<Point>, colors: IntArray?, paint: Paint): Canvas {
return drawTriangleFan(positions, colors, null, null, BlendMode.MODULATE, paint)
}
/**
*
* Draws a triangle fan mesh, using clip and Matrix.
*
*
* If paint contains an Shader and vertices does not contain texCoords, the shader
* is mapped using the vertices' positions.
*
*
* If vertices colors are defined in vertices, and Paint paint contains Shader,
* BlendMode mode combines vertices colors with Shader.
*
* @param positions triangle mesh to draw
* @param colors color array, one for each corner; may be null
* @param texCoords Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices_2](https://fiddle.skia.org/c/@Canvas_drawVertices_2)
*/
fun drawTriangleFan(
positions: Array<Point>,
colors: IntArray?,
texCoords: Array<Point>?,
indices: ShortArray?,
paint: Paint
): Canvas {
return drawTriangleFan(positions, colors, texCoords, indices, BlendMode.MODULATE, paint)
}
/**
*
* Draws a triangle fan mesh, using clip and Matrix.
......@@ -788,7 +619,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
* @param colors color array, one for each corner; may be null
* @param texCoords Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param mode combines vertices colors with Shader, if both are present
* @param blendMode combines vertices colors with Shader, if both are present
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
......@@ -797,10 +628,10 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
*/
fun drawTriangleFan(
positions: Array<Point>,
colors: IntArray?,
texCoords: Array<Point>?,
indices: ShortArray?,
mode: BlendMode,
colors: IntArray? = null,
texCoords: Array<Point>? = null,
indices: ShortArray? = null,
blendMode: BlendMode,
paint: Paint
): Canvas {
require(colors == null || colors.size == positions.size) { "Expected colors.length == positions.length, got: " + colors!!.size + " != " + positions.size }
......@@ -816,7 +647,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
toInterop(Point.flattenArray(texCoords)),
indices?.size ?: 0,
toInterop(indices),
mode.ordinal,
blendMode.ordinal,
getPtr(paint)
)
}
......@@ -841,7 +672,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
* @param colors color array, one for each corner; may be null
* @param texCoords flattened Point array of texture coordinates, mapping Shader to corners; may be null
* @param indices with which indices points should be drawn; may be null
* @param mode combines vertices colors with Shader, if both are present
* @param blendMode combines vertices colors with Shader, if both are present
* @param paint specifies the Shader, used as Vertices texture
*
* @see [https://fiddle.skia.org/c/@Canvas_drawVertices](https://fiddle.skia.org/c/@Canvas_drawVertices)
......@@ -852,10 +683,10 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
fun drawVertices(
vertexMode: VertexMode,
positions: FloatArray,
colors: IntArray?,
texCoords: FloatArray?,
indices: ShortArray?,
mode: BlendMode,
colors: IntArray? = null,
texCoords: FloatArray? = null,
indices: ShortArray? = null,
blendMode: BlendMode,
paint: Paint
): Canvas {
require(positions.size % 2 == 0) {
......@@ -879,7 +710,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
toInterop(texCoords),
indices?.size ?: 0,
toInterop(indices),
mode.ordinal,
blendMode.ordinal,
getPtr(paint)
)
}
......@@ -887,74 +718,6 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
return this
}
/**
*
* Draws a Coons patch: the interpolation of four cubics with shared corners,
* associating a color, and optionally a texture SkPoint, with each corner.
*
*
* Coons patch uses clip and Matrix, paint Shader, ColorFilter,
* alpha, ImageFilter, and BlendMode. If Shader is provided it is treated
* as Coons patch texture.
*
*
* Point array cubics specifies four Path cubic starting at the top-left corner,
* in clockwise order, sharing every fourth point. The last Path cubic ends at the
* first point.
*
*
* Color array color associates colors with corners in top-left, top-right,
* bottom-right, bottom-left order.
*
*
* @param cubics Path cubic array, sharing common points
* @param colors color array, one for each corner
* @param paint Shader, ColorFilter, BlendMode, used to draw
* @return this
*
* @see [https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445](https://fiddle.skia.org/c/4cf70f8d194867d053d7e177e5088445)
*/
fun drawPatch(cubics: Array<Point>, colors: IntArray, paint: Paint): Canvas {
return drawPatch(cubics, colors, null, paint)
}
/**
*
* Draws a Coons patch: the interpolation of four cubics with shared corners,
* associating a color, and optionally a texture SkPoint, with each corner.
*
*
* Coons patch uses clip and Matrix, paint Shader, ColorFilter,
* alpha, ImageFilter, and BlendMode. If Shader is provided it is treated
* as Coons patch texture.
*
*
* Point array cubics specifies four Path cubic starting at the top-left corner,
* in clockwise order, sharing every fourth point. The last Path cubic ends at the
* first point.
*
*
* Color array color associates colors with corners in top-left, top-right,
* bottom-right, bottom-left order.
*
*
* If paint contains Shader, Point array texCoords maps Shader as texture to
* corners in top-left, top-right, bottom-right, bottom-left order. If texCoords is
* nullptr, Shader is mapped using positions (derived from cubics).
*
* @param cubics Path cubic array, sharing common points
* @param colors color array, one for each corner
* @param texCoords Point array of texture coordinates, mapping Shader to corners;
* may be null
* @param paint Shader, ColorFilter, BlendMode, used to draw
* @return this
*
* @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 {
return drawPatch(cubics, colors, texCoords, BlendMode.MODULATE, paint)
}
/**
*
* Draws a Coons patch: the interpolation of four cubics with shared corners,
......@@ -984,7 +747,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
* @param colors color array, one for each corner
* @param texCoords Point array of texture coordinates, mapping Shader to corners;
* may be null
* @param mode BlendMode for colors, and for Shader if paint has one
* @param blendMode BlendMode for colors, and for Shader if paint has one
* @param paint Shader, ColorFilter, BlendMode, used to draw
* @return this
*
......@@ -993,8 +756,8 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
fun drawPatch(
cubics: Array<Point>,
colors: IntArray,
texCoords: Array<Point>?,
mode: BlendMode,
texCoords: Array<Point>? = null,
blendMode: BlendMode,
paint: Paint
): Canvas {
require(cubics.size == 12) { "Expected cubics.length == 12, got: " + cubics.size }
......@@ -1007,7 +770,7 @@ open class Canvas internal constructor(ptr: NativePointer, managed: Boolean, int
toInterop(Point.flattenArray(cubics)),
toInterop(colors),
toInterop(Point.flattenArray(texCoords)),
mode.ordinal,
blendMode.ordinal,
getPtr(paint)
)
}
......
......@@ -36,9 +36,9 @@ class CanvasTest {
VertexMode.TRIANGLES,
positions,
colors,
positions,
null,
indices,
BlendMode.SRC_OVER,
BlendMode.DST_OVER,
Paint()
)
......@@ -170,6 +170,7 @@ class CanvasTest {
cubics = points.toTypedArray(),
colors = intArrayOf(Color.RED, Color.BLUE, Color.YELLOW, Color.CYAN),
texCoords = null,
blendMode = BlendMode.DST_OVER,
paint = Paint()
)
......
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