Commit Graph

91 Commits

Author SHA1 Message Date
Nathaniel Nifong
6e659e9609 Add a gm for ManagedAnimation.setColor
Change-Id: Id55784913e850bc319f49cbf40ba656fcd5e2ac3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294458
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-06-08 13:12:49 +00:00
Kevin Lubick
e7b329e1ee [canvaskit] Fix freeing of memory in computeTonalColors
Change-Id: I82317cf762362a4fb74933d7d7145555d397c850
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294700
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-06-05 20:23:29 +00:00
Nathaniel Nifong
cd75b17943 Unit test of drawAtlas and fixes for bugs uncovered by it
Change-Id: I3583a5b3930aba03ae843daade50223e87c4ac6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294338
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-05 16:02:29 +00:00
Nathaniel Nifong
ed827bcf91 Make shadow in drawShadow test much more prominent
Change-Id: Iea50f4fb6cdd611ceeb77e5ab1dfe6e703ca201d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293681
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-06-04 20:05:24 +00:00
Kevin Lubick
9adc1d4f7d [canvaskit] Fix JS representation of Color
Change-Id: I4f7a54a758eb7a3c28970dde58c847a27a9c3f25
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/294256
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-04 12:43:32 +00:00
Kevin Lubick
b42660f584 [canvaskit] Speculative fix for flaky dommatrix test
There's some flakes on the _dommatrix test. This adds an extra assertion
to maybe shed some light on that flake.

Change-Id: I548d3294c8f3c620a9702e4d4889da745a2d91fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293764
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-03 15:04:31 +00:00
Kevin Lubick
93f1a38fb5 [canvaskit] Add flexibility to setColor API
Change-Id: Ib0946bb05bc5cbf485a6687e46c7e61312bcd24c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293344
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-06-03 11:38:54 +00:00
Kevin Lubick
462a860f63 [canvaskit] Change Malloc to return object instead of TypedArray
This works around https://github.com/emscripten-core/emscripten/issues/6747

Change-Id: I03a08bc172f03f57588f94cbfd3eda9a5ef1333e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293158
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-06-03 11:38:54 +00:00
Nathaniel Nifong
3392ebe974 Additional tests covering parts of path interface
Change-Id: I28fa842a56c3ff6464b6f4175baee1e6f1d99994
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292970
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-01 18:37:03 +00:00
Kevin Lubick
6aa3869f76 [canvaskit] Use scratch arrays for colors and matrices
At startup, we allocate a few scratch arrays and then use those
instead of having to malloc and free a bunch of arrays during
runtime.

The benchmark that was added is a bit noisy (probably because
of the garbage collection going on from the created Float32Arrays),
but a few percent faster.

We also don't set the paragraph background/foreground colors to
transparent because we check them being falsey before sending them
over the wire. I noticed that if foreground was transparent black,
no text shows up at all, which was unexpected.

Change-Id: I9f3a590a122d7de222cb5f58ea40e86b2d261c96
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292685
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-06-01 15:47:07 +00:00
Bryce Thomas
9331ca0704 CanvasKit: implement client-supplied dirty rect support for software surface.
Surface clients can now specify a dirty rect that will constrain HTML canvas
repaints to a particular region.

Bug: NONE
Change-Id: Ia77d6e864c061297bfc82cfa09030523052ee0e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/293056
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-01 12:05:08 +00:00
Nathaniel Nifong
59d299ba3f Record code coverage in canvaskit tests, increase coverage
Fix a bug with paragraph text direction that an incorrect unit test wasn't detecting.

Change-Id: I73418ea8a90da097078d93ddf8692a55488f672f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292366
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-29 15:53:35 +00:00
Kevin Lubick
cf11892ab2 [canvaskit] Do not automatically free things provided by Malloc.
If ever CanvasKit accepts an array as a parameter, if the array
provided was produced by Malloc, CanvasKit will use the pointer
of that array and not free it after.

Change-Id: I4806a48e5e030edd787944f652984ea3516b3022
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292561
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-05-28 19:45:52 +00:00
Nathaniel Nifong
b1ebbb19bc Wide color gamut support and working example.
Fixes release-cpu build issue, un-revert cl 289733

Color space arguments accepted at surface creation, paint, gradient, and other call sites.
Works correctly only when chrome happens to be rendering itself in the same color space
the canvaskit user has chosen, there's not yet end to end color management of
canvases supported in browsers.

readPixels not yet working due to possible chrome bug.

Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289733
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Change-Id: I65ce1c643dac57e14b8476f598c96b12b7e040ce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291896
2020-05-26 20:13:33 +00:00
Elliot
42ee37f1a0 [canvaskit] add a gm for testing all blendmodes
Bug: skia:10264
Change-Id: I0b903798e5ebbd379df69268f2c78f381262c856
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291176
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-26 16:52:22 +00:00
Elliot
06266f79ed [canvaskit] add a gm for testing particles
Bug: skia:10264
Change-Id: If005e49e9ea28936764346a126b7216f4e5289f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291199
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-26 13:40:41 +00:00
Nathaniel Nifong
67e21a1925 Revert "Wide color gamut support and working example."
breaks CPU-backed canvaskit build

This reverts commit 3d52abc846.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Wide color gamut support and working example.
> 
> Color space arguments accepted at surface creation, paint, gradient, and other call sites.
> Works correctly only when chrome happens to be rendering itself in the same color space
> the canvaskit user has chosen, there's not yet end to end color management of
> canvases supported in browsers.
> 
> readPixels not yet working due to possible chrome bug.
> 
> Change-Id: I3dea5b16c60a3871cd2a54f86716f4a438a90135
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289733
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

TBR=kjlubick@google.com,brianosman@google.com,nifong@google.com

Change-Id: I2e03155c2512eec6730ecccda19df78174146008
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291339
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-05-21 20:22:08 +00:00
Nathaniel Nifong
3d52abc846 Wide color gamut support and working example.
Color space arguments accepted at surface creation, paint, gradient, and other call sites.
Works correctly only when chrome happens to be rendering itself in the same color space
the canvaskit user has chosen, there's not yet end to end color management of
canvases supported in browsers.

readPixels not yet working due to possible chrome bug.

Change-Id: I3dea5b16c60a3871cd2a54f86716f4a438a90135
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289733
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-21 19:26:11 +00:00
Kevin Lubick
d1285b131b Upgrade CanvasKit emscripten to version 1.39.16.
Changes are largely mechanical.  Non-mechanical changes to support newer
versions of emscripten are enumerated below, in format ${EMSCRIPTEN_VERSION}:
${RELEVANT_CHANGE}.

- 1.39.9: TOTAL_MEMORY has been renamed INITIAL_MEMORY.
- 1.39.12: passing of linker flags to wasm-ld has changed in a way that requires
  supplying `--no-entry` to avoid error message "wasm-ld: error: entry symbol
  not defined (pass --no-entry to suppress): main".
- 1.39.16: The factory function created by using `MODULARIZE` build option now
  returns a Promise instead of the module instance.  As such, the ready.js
  workaround is removed.  Note this is a breaking API change for CanvasKit,
  which now uses just `then()` and not `ready().then()`.
- 1.38.33: `emsdk install` hasn't required the `-64bit` suffix on version names
  since `1.38.33`, so we remove them.  E.g. `emsdk install sdk-1.39.6-64bit`
  simply becomes `emsdk install sdk-1.39.16`.

cf. https://github.com/emscripten-core/emscripten/blob/master/ChangeLog.md

Bug: NONE
Change-Id: Iabec4bd5ad7db2e0715ad42c2e4cf7d67b192b4c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291182
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-21 14:18:48 +00:00
Brian Osman
28590d54f5 Add 'shader' as an alias for 'fragmentProcessor'
Change-Id: I2d95c63de18125e6258709b48b03abd7904b7537
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278596
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-05-15 13:52:15 +00:00
Kevin Lubick
0c8884b6b4 [canvaskit] Fix memory leak in paragraph bindings
This also renames some variables to be consistent.

See https://github.com/flutter/flutter/issues/56938

Change-Id: I0db66fa334d5f5efc1f94fff1a367a32e03611ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289778
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-05-14 14:48:21 +00:00
Kevin Lubick
2887d35ca9 [canvaskit] Enable font edging
Adding in the mono rasterizer on freetype adds 12k of code size
(6k compressed), so we make it opt out and don't ship to npm with it.

Bug: skia:10192
Change-Id: I8352adbeaec288800ae1ca4709144860e9a1e84c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/288546
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-05-08 13:22:18 +00:00
Nathaniel Nifong
00de91c591 Add markCTM to canvaskit API, use in 3D cube example
Change-Id: Id0eafdf0fd69f080e26e2bee5c7b38eb55b6a5c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/287897
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-05-06 21:10:34 +00:00
Mike Reed
7fe6ee30c4 Add markCTM(id) api, to replace functionality of saveCamera.
Will need followups on Vertices and SkSL to use these handles.

Change-Id: If775cb01168f601541e889bfa2421129e505b4a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/282416
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-04-09 17:07:36 +00:00
Kevin Lubick
c1d0898d0a [canvaskit] Handle 4x4 matrix passing ourselves.
This reduces the skm44_concat benchmark from 2us to .35us, a 5x
speedup.

SkCanvas.concat now takes a 3x2, 3x3, or 4x4 matrix and upscales
them all to 4x4. This makes concat44 redundant.

Removes redundant null checks for matrices, since freeing(0)
in WASM is fine like it is in C++.

Change-Id: I44a776ffd0babb81d8a34f9d94ae4d7831d02b55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281721
Reviewed-by: Mike Reed <reed@google.com>
2020-04-06 19:21:58 +00:00
Kevin Lubick
9b56cea5fa [canvaskit] Add test and gm for 4x4 matrix
Would be nice to eventually follow up with test involving camera.

Change-Id: I264d0a0dc3467a971103264df21701c094323b80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281719
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-04-06 13:28:15 +00:00
Kevin Lubick
cc8a76f3c7 [canvaskit] Add gm helper functions to tests.
Note to the reviewer: Look at tests/util.js first and then
look at the others. Gerrit lets you ignore whitespace changes,
which I would recommend for this.

This emulates tests on the C++ side and dramatically reduces
boilerplate on the test code.

This also uses the beforeEach(async () => {}) trick to save
a lot of promise resolutions before each tests.

I try to clean up the style a bit as I go, seriously thinking
about adding eslint for at least the tests.

Change-Id: Iced4abb57f66572035ab5d1a54b374055e8aaa58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281439
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2020-04-03 19:12:02 +00:00
Kevin Lubick
6bffe39c98 [canvaskit] Handle passing matrix values into CK ourselves.
This means we take DOMMatrix everywhere now.

This reduced the *_makeShader benchmark by ~25% (4 us -> 3 us)
and cleaned up several callsites.

Trimming this down saves ~3kb in uncompressed code size.

Change-Id: Ie677c7ebb7bc97ed8cd4d4851a039b78b6f8079d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281018
Reviewed-by: Mike Reed <reed@google.com>
2020-04-02 20:42:30 +00:00
Kevin Lubick
37d8c64530 [canvaskit] Add tests for RTShader
Change-Id: I43e4d9b173a7ee09da1e8457c86ea129b89637a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/281163
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-04-02 13:59:51 +00:00
Kevin Lubick
9e2d384559 [canvaskit] Add support for DOMMatrix to some APIs
This does a head to head comparison for our JS-implemented
SkMatrix (DOMMatrix is tens of times slower) and adds support.

There are a few APIs (e.g. on Canvas) that don't yet support this.
This is because I want to experiment with the speed difference
between SimpleMatrix and emscripten's bindings and us just allocating
an array for the user on the WASM heap.

Change-Id: I47086dd6b40cbd522c6b85e5f9b1a7e819f54f9d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/280957
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-04-01 18:15:29 +00:00
Nathaniel Nifong
e5d3254ece Reland "Switch to using a Float32Array (bound as value array) for color."
This is a reland of 4e79b6730d

Original change's description:
> Switch to using a Float32Array (bound as value array) for color.
> 
> Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

Change-Id: If6b9097b2fcd6b9dbf75c6dd22138e0b2531e70d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278780
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-26 14:41:29 +00:00
Robert Phillips
cb77eab343 Revert "Switch to using a Float32Array (bound as value array) for color."
This reverts commit 4e79b6730d.

Reason for revert: Bad canvaskit GM images

Original change's description:
> Switch to using a Float32Array (bound as value array) for color.
> 
> Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

TBR=kjlubick@google.com,nifong@google.com

Change-Id: I2f5e995ccee415a49f813b5ba61c095acbc445b5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278766
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-24 14:20:04 +00:00
Nathaniel Nifong
4e79b6730d Switch to using a Float32Array (bound as value array) for color.
Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-24 13:32:55 +00:00
Kevin Lubick
d3b92b910c [canvaskit] Add tests for gradients
Change-Id: I28a001f281d9dc0c64c37ad1f22a6387eadca843
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277607
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-03-18 20:03:16 +00:00
Kevin Lubick
f279c63a60 [canvaskit] Add tests for patheffects
Also move around internal Dash PathEffect api.

Change-Id: I445626462f4e76523474b027555da45a58d54632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277599
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-03-18 19:33:50 +00:00
Kevin Lubick
beefcb9d38 Reland saveLayer can omit the rectangle argument.
For API simplicity, if the rectangle is to be omitted, the client
should only provide the paint. (emscripten already does parameter
count checking, so let's use that instead of doing it ourselves).

This also adds tests to help verify the new behavior.

Revert "Revert "Allow null rect for saveLayer""

This reverts commit 7957d53c80.

Bug: skia:10043
Change-Id: I9ed8caabbfc77deab1ca3d9b1a415489e012528f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277399
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Dan Field <dnfield@google.com>
2020-03-17 17:38:54 +00:00
Dan Field
3d44f73b64 Sweep gradient support for CanvasKit
Change-Id: I04af9ea7aa6c6f95de6ff1eaf5ee41d59df7f09e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277059
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-16 16:57:03 +00:00
Nathaniel Nifong
a3aa601ea6 Add a canvas test to make and draw SkVertices
Change-Id: I54647b84e0ee0e13cf3041e9340120a6aca89d08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275997
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-09 20:28:48 +00:00
Kevin Lubick
a093cffed2 [canvaskit] Fix shadow bugs
This also adds a helper option to writing canvas2d spec tests
to see the CanvasKit option side by side with the real canvas
version.

Bug: skia:9940, skia:9947
Change-Id: Ia8fc4e1332d3896933b86291181bc3ba890d26ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275618
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-03-06 16:14:20 +00:00
Nathaniel Nifong
23b0ed9480 Name name changes suggested in API review
Bug: skia:9843
Change-Id: Ib7e30a129dff17ecde81daa1ff665304908face3
Docs-Preview: https://skia.org/?cl=275048
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275048
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-05 15:13:41 +00:00
Kevin Lubick
bde9fcce15 [canvaskit] Precise font measuring
Bug: skia:9864
Change-Id: I097ca54b55e0864a7659fa1c3a05ea7f02811aed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273297
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-02-28 13:36:34 +00:00
Nathaniel Nifong
77798b4585 Expose 4x4 matrices on canvas in a way similar to SimpleMatrix, add example.
Bug: skia:9866
Change-Id: I718455743e482e4f60a462027b629dc19b1dbad3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270201
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-22 00:12:13 +00:00
Kevin Lubick
392846665c [canvaskit] Expose parseColorString
This is handy for interacting with <input type=color>

Change-Id: I7946c08ef10a2481016885d58cc52f76f5cd40e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272344
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-21 12:43:15 +00:00
Kevin Lubick
6e1320da6b [canvaskit] Fix flaky test
We accidentally were not waiting until all font files were loaded before
trying to process them.

Bug: skia:9858
Change-Id: I10decd5fbf0aa46e300d2ce5255f24f1ac1c12d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268626
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-02-04 17:50:35 +00:00
Kevin Lubick
dc49b0ca98 [canvaskit] Fix support for fonts with CFF
Adds a test to load different font types. Currently supported:
 - .ttf
 - .otf
 - .ttc

Not supported:
 - .woff
 - .woff2

This only increases code size by ~4kb, so that big glyph table
has still been successfully removed.

Bug: skia:9829
Change-Id: I0231578b2abf4f36df57ff8073b7697d16606373
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267180
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-01-29 12:39:55 +00:00
Kevin Lubick
52379335eb [canvaskit] Fix test for drawOnce
I belatedly realized that drawOnce's test would always be blank now
that drawOnce is async.

Change-Id: If30bbdd895039bd8de050a59dd348ba6849c5835
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266631
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-27 15:11:34 +00:00
Bryce Thomas
2c5b856a7f Add drawOnce() API to SkSurface.
The existing |SkSurface.requestAnimationFrame| API provides a convenient way of
drawing Skia animations using the same idiom as the well known
|Window.requestAnimationFrame|.  It gracefully handles providing the caller with
access to the right canvas, as well as flushing after the user-supplied
callback.

The new |SkSurface.drawOnce| API added in this change provides the same
conveniences around access to the right canvas and flushing, but for the
use-case where the user wishes to draw a single frame only.  Importantly, this
new API disposes of the SkSurface upon completion, i.e. frees the memory
associated with the underlying pixel storage an surface.  This avoids memory
leaks that occur when |SkSurface.requestAnimationFrame| is used for single-frame
purposes.

Bug: NONE
Change-Id: Ic4e48e65dffc4809513ceaf72260ac0432b98952
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265604
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-01-27 13:45:47 +00:00
Kevin Lubick
a538e46d5f [canvaskit] Fix color opaqueness
Bug: skia:9800
Change-Id: I61d50df47467dbcee6d90fd636749a4d19c4da8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265957
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-22 20:35:54 +00:00
Kevin Lubick
319524ba72 [canvaskit] Fix colorType bug
Bug: skia:9788
Change-Id: I1c7eeefb0e2883edc9095599ff2f10e8419f54c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265956
Reviewed-by: Brian Osman <brianosman@google.com>
2020-01-22 20:35:54 +00:00
Kevin Lubick
486aecf130 [canvaskit] Make font names programmatically accessible
Change-Id: I384e4f37fa274665438b523f0636bfc1856ec0ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264574
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-01-17 14:18:09 +00:00