Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(monorepo): Bring in reason-skia (round 2) (#880)
* Build reason-skia and examples * Hook up Skia tests * Add SkiaSdl example * Bring over benchmarks * Fix doc generation * Formatting * Update lockfiles * Fix warnings * Install skia dll too
- Loading branch information
Showing
59 changed files
with
4,080 additions
and
190 deletions.
There are no files selected for viewing
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
ReveryBench.BenchFramework.cli(); | ||
Skia_Bench.BenchFramework.cli(); |
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,3 @@ | ||
include Reperf.Make({ | ||
let config = Reperf.Config.create(~snapshotDir="bench/__snapshots__", ()); | ||
}); |
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 @@ | ||
open BenchFramework; | ||
|
||
open Skia; | ||
|
||
let options = Reperf.Options.create(~iterations=100000, ()); | ||
|
||
module Data = { | ||
let makeSurface = (width, height) => { | ||
let imageInfo = ImageInfo.make(width, height, Rgba8888, Premul, None); | ||
Surface.makeRaster(imageInfo, 0, None); | ||
}; | ||
|
||
let surface = makeSurface(800l, 600l); | ||
let canvas = Surface.getCanvas(surface); | ||
let paint = Paint.make(); | ||
}; | ||
|
||
let drawRectLtwh = () => { | ||
Skia.Canvas.drawRectLtwh(Data.canvas, 1.0, 2.0, 100., 200., Data.paint); | ||
}; | ||
|
||
bench( | ||
~name="Canvas: drawRectLtwh", | ||
~options, | ||
~setup=() => (), | ||
~f=drawRectLtwh, | ||
(), | ||
); |
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,44 @@ | ||
open BenchFramework; | ||
|
||
let options = Reperf.Options.create(~iterations=100000, ()); | ||
|
||
module Data = { | ||
let initialColor = Skia.Color.makeArgb(0xFFl, 0xFFl, 0xFFl, 0xFFl); | ||
}; | ||
|
||
let makeArgb = () => { | ||
let _: Skia.Color.t = Skia.Color.makeArgb(0xFFl, 0xFFl, 0xFFl, 0xFFl); | ||
(); | ||
}; | ||
|
||
let makeArgbFloat = () => { | ||
let _: Skia.Color.t = Skia.Color.Float.makeArgb(0.1, 0.2, 0.3, 0.4); | ||
(); | ||
}; | ||
|
||
let getA = () => { | ||
let _: int32 = Skia.Color.getA(Data.initialColor); | ||
(); | ||
}; | ||
|
||
let getAFloat = () => { | ||
let _: float = Skia.Color.Float.getA(Data.initialColor); | ||
(); | ||
}; | ||
|
||
bench( | ||
~name="Color: makeArgb (float)", | ||
~options, | ||
~setup=() => (), | ||
~f=makeArgbFloat, | ||
(), | ||
); | ||
bench( | ||
~name="Color: getA (float)", | ||
~options, | ||
~setup=() => (), | ||
~f=getAFloat, | ||
(), | ||
); | ||
bench(~name="Color: makeArgb", ~options, ~setup=() => (), ~f=makeArgb, ()); | ||
bench(~name="Color: getA", ~options, ~setup=() => (), ~f=makeArgb, ()); |
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,77 @@ | ||
open BenchFramework; | ||
|
||
let options = Reperf.Options.create(~iterations=100000, ()); | ||
|
||
module Data = { | ||
let initialMatrix = Skia.Matrix.make(); | ||
|
||
let scale = { | ||
let mat = Skia.Matrix.make(); | ||
Skia.Matrix.setScale(mat, 1.0, 2.0, 3.0, 4.0); | ||
mat; | ||
}; | ||
|
||
let translate = { | ||
let mat = Skia.Matrix.make(); | ||
Skia.Matrix.setTranslate(mat, 1.0, 2.0); | ||
mat; | ||
}; | ||
|
||
let out = Skia.Matrix.make(); | ||
|
||
let rect = Skia.Rect.makeLtrb(1., 1., 100., 200.); | ||
let outRect = Skia.Rect.makeLtrb(0., 0., 0., 0.); | ||
}; | ||
|
||
let setScale = () => { | ||
let () = Skia.Matrix.setScale(Data.initialMatrix, 1.0, 2.0, 1.0, 1.0); | ||
(); | ||
}; | ||
|
||
let setTranslate = () => { | ||
let () = Skia.Matrix.setTranslate(Data.initialMatrix, 1.0, 2.0); | ||
(); | ||
}; | ||
|
||
let concat = () => { | ||
let () = Skia.Matrix.concat(Data.out, Data.scale, Data.translate); | ||
(); | ||
}; | ||
|
||
let preConcat = () => { | ||
let () = Skia.Matrix.preConcat(Data.out, Data.scale); | ||
(); | ||
}; | ||
|
||
let postConcat = () => { | ||
let () = Skia.Matrix.postConcat(Data.out, Data.translate); | ||
(); | ||
}; | ||
|
||
let mapRect = () => { | ||
let () = Skia.Matrix.mapRect(Data.scale, Data.rect, Data.outRect); | ||
(); | ||
}; | ||
|
||
bench(~name="Matrix: mapRect", ~options, ~setup=() => (), ~f=mapRect, ()); | ||
|
||
bench(~name="Matrix: preConcat", ~options, ~setup=() => (), ~f=preConcat, ()); | ||
|
||
bench( | ||
~name="Matrix: postConcat", | ||
~options, | ||
~setup=() => (), | ||
~f=postConcat, | ||
(), | ||
); | ||
|
||
bench(~name="Matrix: concat", ~options, ~setup=() => (), ~f=concat, ()); | ||
|
||
bench( | ||
~name="Matrix: setTranslate", | ||
~options, | ||
~setup=() => (), | ||
~f=setTranslate, | ||
(), | ||
); | ||
bench(~name="Matrix: setScale", ~options, ~setup=() => (), ~f=setScale, ()); |
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,29 @@ | ||
open BenchFramework; | ||
|
||
let options = Reperf.Options.create(~iterations=100000, ()); | ||
|
||
module Data = { | ||
let initialRect = Skia.Rect.makeLtrb(0., 0., 0., 0.); | ||
}; | ||
|
||
let setLtrb = () => { | ||
let () = | ||
Skia.Rect.Mutable.setLtrb(~out=Data.initialRect, 1.0, 2.0, 3.0, 4.0); | ||
(); | ||
}; | ||
|
||
let makeLtrb = () => { | ||
let _: Skia.Rect.t = Skia.Rect.makeLtrb(1.0, 2.0, 3.0, 4.0); | ||
(); | ||
}; | ||
|
||
let getLeft = () => { | ||
let _: float = Skia.Rect.getLeft(Data.initialRect); | ||
(); | ||
}; | ||
|
||
bench(~name="Rect: makeLtrb", ~options, ~setup=() => (), ~f=makeLtrb, ()); | ||
|
||
bench(~name="Rect: setLtrb", ~options, ~setup=() => (), ~f=setLtrb, ()); | ||
|
||
bench(~name="Rect: getLeft", ~options, ~setup=() => (), ~f=getLeft, ()); |
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,24 @@ | ||
open BenchFramework; | ||
|
||
open Skia; | ||
|
||
let options = Reperf.Options.create(~iterations=100000, ()); | ||
|
||
module Data = { | ||
let initialPaint = Paint.make(); | ||
let initialColor = Color.makeArgb(0xFFl, 0xFFl, 0xFFl, 0xFFl); | ||
}; | ||
|
||
let make = () => { | ||
let _: Paint.t = Paint.make(); | ||
(); | ||
}; | ||
|
||
let setColor = () => { | ||
let () = Paint.setColor(Data.initialPaint, Data.initialColor); | ||
(); | ||
}; | ||
|
||
bench(~name="Paint: make", ~options, ~setup=() => (), ~f=make, ()); | ||
|
||
bench(~name="Paint: setColor", ~options, ~setup=() => (), ~f=setColor, ()); |
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,9 @@ | ||
(library | ||
(name Skia_Bench) | ||
(ocamlopt_flags -linkall) | ||
(libraries | ||
skia | ||
skia.wrapped | ||
skia.wrapped.bindings | ||
reperf.lib | ||
)) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,3 @@ | ||
(lang dune 2.0) | ||
(context (default | ||
(disable_dynamically_linked_foreign_archives true))) |
Oops, something went wrong.