Commit Graph

254 Commits

Author SHA1 Message Date
Kevin Lubick
102dbf9c43 [canvaskit] Disable dynamic execution
This required an update to emscripten, due to there being
a few bug fixes regarding the non-dynamic code and the
Closure compiler/minifier.

Change-Id: Icc922bd98cdd52a6923a9367da3747dac2b897b3
Bug: skia:12795
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/492916
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-02-01 13:15:22 +00:00
Kevin Lubick
994c946bd3 [canvaskit] Add API to re-use Image textures and reduce flickering
This creates a new SkImage with the same texture and changes it
out without the user noticing (or needing to delete the old Image).

Change-Id: I3a1ce6d4a335873f2b7670d56dadfccdc7881c38
Bug: skia:12723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495556
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-01-31 14:00:48 +00:00
Kevin Lubick
c4b2fb39b1 [canvaskit] Use proper texture tracking method
The emscripten generated GL texture tracking code uses an
integer, not the length of the textures array.
a8e7d3b8f2/src/library_webgl.js (L242)
I believe this is to make sure a texture and buffer do
not share the same handle.

Therefore, we must use this method when making our own
additions to the textures array, otherwise Skia-created
textures will overlap with supplied textures, causing
mis-drawings and feedback loops.

Change-Id: I4e1be5ff2b0c3d1ba5f5984232980724cb492313
Bug: skia:12797
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495416
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2022-01-26 19:53:05 +00:00
Brian Osman
1ba283e6b4 In GPU CanvasKit, default to sRGB surfaces
Change-Id: I1931b09e6a4a52fb7d91a0d3f013e1d0519919dd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/487977
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-22 18:13:49 +00:00
Kevin Lubick
16a06174df [canvaskit] Release 0.32.0
Change-Id: Ic9f345a37f409108c4c4252b3d2d0c8b6255a78a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485156
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-12-15 18:05:58 +00:00
Kevin Lubick
68a364c9bc [canvaskit] Reset GrContext after lazy-loading image from texture
The issue was Skia would be in the middle of drawing when it
needed to lazy-load the image's texture. This would mess up the
bound texture in WebGL, but Skia didn't know that. As a result,
it would not realize that some of the work had been undone.

Calling resetContext() makes Skia aware of this fact, so it can
adjust its behavior.

Change-Id: I5e62987546be8d63d13c906dfab3bc92cf3120cd
Bug: skia:12740
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485016
Reviewed-by: Brian Osman <brianosman@google.com>
2021-12-15 15:11:41 +00:00
Kevin Lubick
44c81d1492 [canvaskit] Add frame duration and docs
Also clean up some more findMarkedCTM references.

Change-Id: I29a52e1157691c86992e70a3774b984e5383e3ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/482005
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2021-12-09 18:53:23 +00:00
Kevin Lubick
5d1d92c505 [canvaskit] Add rough measureText to Canvas2D emulation layer
I wanted to use SkParagraph myself, but the API is a little
awkward right now in that I cannot just pass in a SkFont object
(which I have) - I would have to make a FontCollection, which
we lack the ability to do so.

Change-Id: I1488fb9c1a42af020a245a792b8e266c809b599a
Bug: skia:12705
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481238
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-12-09 13:07:24 +00:00
Kevin Lubick
37a489c3a4 [canvaskit] Fix examples and tests of drawPatch and drawVertices
Change-Id: Iab8c085fad220930b838a281834a402f8d96c2af
Bug: skia:12662
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/477437
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-29 18:54:52 +00:00
Kevin Lubick
350d46daac [canvaskit] Deploy 0.31.0
Change-Id: I93c9bafae99b116a8efb012e3a82c000843d8eb9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/472380
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-11-16 18:44:05 +00:00
Kevin Lubick
ef3d6af042 [infra] Add POC Bazel rules for CanvasKit
Many things are not enabled currently (e.g. Skottie, Paragraph),
but we can render many APIs using WebGL.

To turn on Paragraph, etc, we'll need to tackle fonts, which
is a separate effort.

This also changes where the build artifacts go. ./build/ is
easier to deal with than the old way of sticking them in
./npm_build/bin

Change-Id: Ia377360af580a887d03630670438fea2e3157e90
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470682
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-11-12 21:38:46 +00:00
Kevin Lubick
799abb7bb8 [canvaskit] Set unsupported WebGL caps to false
The defaults were true for these, but if there was no
support, they should be set to false.

This was causing some warnings from the console, like:
WebGL: INVALID_ENUM: enable: invalid capability

Change-Id: I53b6120c969174a9ecd6d47df001870c71231352
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470737
Reviewed-by: Greg Daniel <egdaniel@google.com>
2021-11-12 18:04:03 +00:00
Kevin Lubick
e393e72484 [canvaskit] Add ImageInfo to Texture APIs
Change-Id: Ib030c1ab47a1d1338518815915a5f59e7f9d606c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/470736
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-12 18:03:38 +00:00
Kevin Lubick
cb94b57ad2 [canvaskit] Add ability to make texture image across surfaces.
Change-Id: Ie82e8257c9f0990d3be99a2429e034ac400b9580
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469759
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-11 17:32:30 +00:00
Kevin Lubick
0c23120abd [canvaskit] Switch to appropriate WebGL Context for Surface methods
Change-Id: Id829603bafb73d2256e44a9101b4b1669b735e12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469534
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-11-10 13:49:24 +00:00
Kevin Lubick
7ce380e967 [canvaskit] Remove deprecated MakeTypefaceFromData and RefDefault
Change-Id: I0072fa5c11834a6250f2f5b9290ecea0d30f2128
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462177
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-10-21 16:45:42 +00:00
Kevin Lubick
2d13fab55c [canvaskit] Define requestAnimationFrame and other definition fixes.
Change-Id: I28a908fb680d704bf730a5968691f54d4a9e0a68
Bug: skia:12555 skia:12550
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/462056
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-10-21 16:45:42 +00:00
Kevin Lubick
0c5b05c3ab [canvaskit] Roll 0.30.0
Change-Id: Ia990c0537d79256b895348c75ff118253a5af926
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/449056
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-09-15 13:21:25 +00:00
Kevin Lubick
f611404816 [canvaskit] Remove the need for users to keep track of contexts.
We'll switch to the correct context when necessary (e.g. before
calls that talk to the GPU). This is achieved by adding in
calls at the JS layer to switch the context before making a call
that is known to talk to the GPU (e.g. draw calls on SkCanvas).

Another implementation that was considered was to add a C++
shim in GrGLInterface that would switch the context before
every call in the GPU - however, that seemed too difficult
and would add extra overhead if a single draw* call talks
to the GPU multiple times.

Bug: skia:12255
Change-Id: I96e4c6b41a5bfcc9913aeaca7ccb125358048ad3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/432136
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-08-25 18:23:06 +00:00
Kevin Lubick
eb76f3d0dd [canvaskit] Deploy 0.29.0
Change-Id: Ie74c04cf7a0d635d3f716947b0e771d78b06d775
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437396
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-08-06 19:17:28 +00:00
Kevin Lubick
363c6e298f [canvaskit] Update object types
The object type is treated like "any", which is not good.
We can be more descriptive of those types.

Change-Id: I39f3dba635c196ea06163deb358a56c9e4f82f6d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/437316
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-08-06 14:42:28 +00:00
Kevin Lubick
391429f78b [canvaskit] Expose AsWinding
Bug: skia:11858
Change-Id: Iedbc2333779f2fac5029779bae44da48d8dd7b8f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/430956
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-07-22 16:36:33 +00:00
Mike Reed
5caab8eea6 FilterQuality is now removed from CanvasKit
(it had already been abandoned by Skia)

MakeMatrixTransform now takes FilterOptions | CubicResampler
(just like drawAtlas) so that it can have a single entry-point
that picks either variant of SamplingOptions.

Proposal : migrate this pattern (one name, 2 parameter types)
to methods like drawImage, drawImageRect, etc.

Change-Id: I309fbd8be94e642a57ab3016dad7252537ded7d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/429496
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-20 14:19:46 +00:00
Mike Reed
bccbec3147 Remove drawImageAtCurrentFrame
Unused by flutter
Would need variants for sampling options
Easy for clients to achieve this with other APIs

Change-Id: Ia8b29f5183f5b729b62ef35e87897d5312b38da5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/427197
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-12 20:08:40 +00:00
Mike Reed
c98dbc6410 Hide deprecated SkPaint::getBlendMode
Callers should use asBlendMode or getBlendMode_or

Bug: skia:12173
Change-Id: I8b62527a2ae11c9bf0c1473c4fffa53b38aa7017
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425756
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2021-07-11 17:14:21 +00:00
Kevin Lubick
9f39daff8f [canvaskit] Deploy 0.28.1
Change-Id: I001eae691e9167d67eab82a5eeb3650dc6f0118f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/422516
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-06-28 15:28:26 +00:00
Kevin Lubick
83fd9695c5 [canvaskit] Add getGlyphIDs to Typeface API
Bug: skia:12113
Change-Id: Ice0986370a76b7051de50deb6c6ace644eb4e6f4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/422016
Reviewed-by: Ben Wagner <bungeman@google.com>
2021-06-25 18:52:06 +00:00
Kevin Lubick
7027be602b [canvaskit] Add Typeface.MakeFreeTypeFaceFromData
This will replace needing to call FontMgr.RefDefault()
just to call MakeTypefaceFromData().

Change-Id: I72a8c3be62267f6c54c48a5309ef9351acb16768
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421916
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-06-25 18:52:06 +00:00
Brian Osman
f62632c7c3 Remove SkShaders::Lerp
It's entirely unused, and trivial for clients to create with SkSL.

Change-Id: I197986232d3706f5af3a197f0fb8e744e1009e5f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419796
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2021-06-18 16:40:08 +00:00
Kevin Lubick
fba8a742cb [canvaskit] Deploy 0.28.0 to npm
Change-Id: Ia1f97a476816b7e9d5a7d994b41676fb21979783
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419356
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-06-17 14:02:23 +00:00
Kevin Lubick
c5f8433d47 [canvaskit] Add known swiftshader bug to Changelog
b/188239650

Change-Id: I371b24bc7210decd3cba22e6adc2432a688f0059
Bug: skia:11965
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/419156
Reviewed-by: Chris Dalton <csmartdalton@google.com>
2021-06-17 13:49:04 +00:00
Kevin Lubick
78297af33a [canvaskit] Remove *Builders in favor of Malloc.
Change-Id: Ie785281d0759575ff4f7ece379dceeb065765405
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414521
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-06-03 17:43:58 +00:00
Kevin Lubick
82186e944e [canvaskit] Remove 2d arrays from path commands
Change-Id: I6fbd91f4073ab5eca319bd6b44c72bb9904375bc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414238
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-06-03 17:43:42 +00:00
Kevin Lubick
7b6a92818d [canvaskit] Add Surface.makeFromTexture
This includes a helper Surface.makeFromTextureSource that will
make the gl calls with some sensible defaults.

Change-Id: I31bb2f3118b4749e77fb1fc2cb013d35ccb7cfce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413336
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-03 12:29:07 +00:00
Kevin Lubick
123e55968d [canvaskit] Build with emsdk 2.0.20
Change-Id: I4c3bdc8dd0d0dc8b12b2d430d5ea9a20d170b82b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412876
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-27 12:36:41 +00:00
Kevin Lubick
82c4a69b27 [canvaskit] Roll 0.27.0
Change-Id: I216d91caa48a8d596d303a5dfa8a403b56b2d11a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410857
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-20 18:57:24 +00:00
Kevin Lubick
6017b4833f [canvaskit] Remove two previously deprecated APIs
Change-Id: I952f688fe4292344d1d4a57a29179eaddb35360b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410856
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-20 18:44:50 +00:00
Kevin Lubick
5b38536d76 [canvaskit] Add tests for getGlyphIntercepts
Change-Id: I115dafccb74bdf5a61f7ed25bf97fc1cec682c1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409403
Reviewed-by: Mike Reed <reed@google.com>
2021-05-17 19:24:07 +00:00
Mike Reed
1f85dd9159 Expose embolden on Font
Change-Id: I92c3b86b8cfff1a77e2a27503ec0cdc8b0cab784
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406037
Reviewed-by: Mike Reed <reed@google.com>
2021-05-09 18:03:44 +00:00
Kevin Lubick
7978abafee [canvaskit] Deploy 0.26.0
Change-Id: I162e82824e1447409f5dbe7e32ec892f28e1cbf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400296
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-23 12:44:52 +00:00
Kevin Lubick
4755b0b525 [canvaskit] Add TextHeightBehavior
Bug: skia:11881
Change-Id: I220f5ad43de95324172ee5b6d3d5a975a3f8a166
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399836
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-04-22 18:21:44 +00:00
weiyuhuang
04c82165b1 [canvaskit] Add halfLeading to TextStyle and StrutStyle
- Add halfLeading (introduced in https://skia-review.googlesource.com/c/skia/+/394969) to canvaskit bindings

- Fix wrong initial value of fDescent

Change-Id: I01d522cd5a3761f32426038dce2ab82f24c9c529
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398276
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-04-20 20:21:56 +00:00
Kevin Lubick
6e927095e1 [canvaskit] Remove isNode and saveAsPicture
This should fix https://github.com/flutter/flutter/issues/80221

Change-Id: I25e0ad58bcaad95b43cc94476af0e241e17ac244
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397289
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-16 20:55:54 +00:00
Mike Reed
9983b1efd9 Expose drawGlyphs to CK
Precursor for https://skia-review.googlesource.com/c/skia/+/392837

Change-Id: I94cf555d3185e4e2689888a3ae2acf6f57a0fb65
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396496
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-04-14 19:15:50 +00:00
Brian Osman
9be7683222 Support integer uniforms in CanvasKit runtime effects
These were added to SkRuntimeEffects, but we need to do a bit of fixup
in the CK bindings. Note that 'getUniformFloatCount' is now poorly
named, but the idea still stands: it's how many total scalar values are
required.

Bug: skia:11803
Change-Id: If464156d8e6240736e324ef833e57ba7d53f55a0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/394476
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-09 12:42:17 +00:00
Kevin Lubick
4a84c34383 [canvaskit] Expose Strut RectHeightStyle
Bug: skia:11845
Change-Id: Ic0c0812a906bc9c71194ae8a118e04b22194dc69
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/393976
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-08 17:52:35 +00:00
Kevin Lubick
a40581f86d [canvaskit] Fix type definitions
Followup to https://skia-review.googlesource.com/c/skia/+/388837

There were several errors reported by
make typecheck

Change-Id: I4beb772056fff405c1cc5c4be21ef14a6901b188
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/392716
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-05 18:21:29 +00:00
Kevin Lubick
ca709aa82b [canvaskit] Update to 0.25.1
Built at revision 2ee4d7a7f5

Change-Id: Idfa16920b5262f75ac4db18705e8849c91f3c91d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/390407
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-03-30 18:14:07 +00:00
Mike Reed
5514431d0e Extend drawAtlas with optional sampling parameter
Change-Id: Id26f0d9ca5381da807b072c8b59745f2afd8df60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386860
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-25 18:04:32 +00:00
Florin Malita
baab5aff09 [skottie/wasm] Plumb text properties in WASM bindings
Only text string + size for now, we can surface more if needed.

Change-Id: I4b40c1bb5e27ea5fc4ed20a1214c4eeb04bf1ca8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382279
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-03-10 18:34:04 +00:00