Commit Graph

216 Commits

Author SHA1 Message Date
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
Brian Osman
ca916f705f Remove canvas marker stack, marked matrices, etc...
This entire API existed, but was unused (no longer connected to
drawVertices or runtime effects).

In theory, we could further simplify some of the matrix providers, but
more importantly - I have serious doubts about the correctness of
localToDeviceHitsPixelsCenters for most of them.

Change-Id: If5af182015dd96e5ed3353a117223e8dbbe17097
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/481683
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-12-09 16:22:16 +00:00
Kevin Lubick
6ba9f702ba [bazel] Try adding cc_binary rules that use generated rules
To make the atomic rules a bit easier to work with, in many
of the folders, this adds in cc_library rules to group
together the sources from that folder (and subfolders
where prudent). We only needs sources because those atoms
should have their headers as deps.

One issue that was pointed out is that there is currently
no way to restrict the inclusion of certain packages,
a la, `gn check`. For example, there is no mechanism from
stopping a dev from adding
#include "modules/canvaskit/WasmCommon.h"
to something in //src/core (except circular dependencies).
We can probably address that using Bazel's visibility
rules as needed:
https://docs.bazel.build/versions/main/visibility.html
https://docs.bazel.build/versions/main/be/functions.html#package_group

It is recommended to look at this CL patchset by patchset.
PS1: Update gazelle command to generate rules in more folders.
PS2: A few changes to make generation work better.
PS3: The result of running make generate in //bazel
PS4: Adding the rules to build sksllex, the simplest binary I
     could find in the Skia repo.
PS5: Adding the rules to build skdiff, a more complex binary.
     I tried a few approaches, but ended up gravitating back
     towards the layout where we have each folder/package
     group up the sources. I imagine at some point, we'll have
     skdiff depend on skia_core or something, which will
     have things like //src/core, //src/codecs, //src/pathops
     all bundled together.
PS7: Added in the groupings of sources, similar to what we had
     earlier. I liked these for readability. These helped fix
     up the //:skia_core build, and by extension, the CanvasKit
     build.

Change-Id: I3faa7c4e821c876b243617aacf0246efa524cbde
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/476219
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-30 18:18:53 +00:00
Kevin Lubick
888d4efa77 [canvaskit] Add Freetype/Fonts to Bazel Build
This re-works src/ports/BUILD.bazel to work like our other
BUILD files, i.e. one rule "srcs" that brings in the necessary
private filegroups.

To work around an abort with LLVM [1], we have to go back to an
earlier version of emscripten (temporarily?).

Future work should look at using transitions [2] to allow various
executables (e.g. CanvasKit, DM) to set their own set of Bazel
flags, w/o the build invokers having to specify them.

These transitions might be able to handle more complex cases
that we currently use if statements in GN to deal with.

The Freetype build rule was created by taking the BUILD.gn
rule, adding in all the sources listed there and then playing
compile-whack-a-mole to add in all the headers and included
.c files.

Suggested Review Order:
 - third_party/BUILD.bazel to see freetype build rules
 - bazel/common_config_settings/ to see treatment of fontmgr
   like codecs (many possible) and fontmgr_factory (only one).
 - src/ports/BUILD.bazel
 - BUILD.bazel
 - modules/canvaskit/BUILD.bazel. Take note of the gen_rule that
   calls tools/embed_resources.py to produce the .cpp file
   containing the embedded font data.
 - Everything else.

[1] https://github.com/emscripten-core/emscripten/issues/15528
[2] https://github.com/bazelbuild/examples/tree/main/rules/starlark_configurations/cc_binary_selectable_copts
Bug: skia:12541
Change-Id: I08dab82a901d80507007b354ca20cbfad2c2388f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/471636
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-11-17 13:06:35 +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
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
Brian Osman
a583a0fdcc In SkRuntimeEffect, replace ConstIterable with SkSpan
Change-Id: Ibeea56ebd5dce53af1252ca3ecf6cc6f010bd461
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/469902
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-11-10 21:09:58 +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
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
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
63ec43cf55 Hide deprecated filterquality
Change-Id: Ia320f07c3836a077d6feafb4a59a7c89325f9fcd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425057
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-07-13 00:45:12 +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
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
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
72fb3fcdf0 [canvaskit] Use copy1darray to send arrays to JSSpan
This approach is 5 to 20x faster than the existing version,
mostly by minimizing the number of back-and-forths, especially
in the vanilla JS Array case.

Change-Id: Icb4212f781b80ef743f3deb1c17ea6af80ea828b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414517
Reviewed-by: Mike Reed <reed@google.com>
2021-06-02 14:18:59 +00:00
Kevin Lubick
95d599c0a0 [canvaskit] Introduce self-documenting pointer types
Change-Id: I72dfe6098dae699d85cf87b6432e27cf845c832d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412659
Reviewed-by: Mike Reed <reed@google.com>
2021-05-27 12:30:54 +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
Mike Reed
0dfb1c93c1 Use template specialization to remove redundant parameter
Change-Id: I74762ff88ec0220ff023957668bdda9c4a487f1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409999
Reviewed-by: Herb Derby <herb@google.com>
2021-05-18 19:43:53 +00:00
Mike Reed
bdfd776161 Optimize reading from a JS array
Grants read-access to a JS array, either ...
- direct peek into the (malloc'd buffer)
- quick copy (the src was a typed_array)
- slow copy (had to perform a per-element lookup)

Change-Id: Id389f244039d35aefd84e0d95d598cbe15cd28c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409397
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Herb Derby <herb@google.com>
2021-05-18 15:25:37 +00:00
Mike Reed
bc7c754ce3 Expose glyphIntercepts to CK
bug: skia:12000
Change-Id: I40f130b0eab21ef4a53ee88eed8f62c4f3a577c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/408899
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2021-05-15 15:30:50 +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
5567862bda [canvaskit] Remove unnecessary imports
Change-Id: I16dff4eecb044edc49ba0dbee883feafb9fd820b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402997
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-04-30 19:54:49 +00:00
Kevin Lubick
995f2e6159 [canvaskit] Scope IsWhiteSpace to GlyphRunFlags
Change-Id: I66120e39d1ba6099ff9be1e37438c85a11c7794e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402998
Reviewed-by: Mike Reed <reed@google.com>
2021-04-30 15:29:32 +00:00
Kevin Lubick
d1c9e52144 [canvaskit] Fix whitespace constant definition.
Also some includes that I noticed along the way.

Change-Id: If48a3a9ff8bd5daea21065051c811e8b3e8a701f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402136
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-28 13:29:03 +00:00
Mike Reed
ae33954b49 Updates to GlyphRuns[]
1. Fold "origin" into the positions (simplification)
2. Extend positions and offset arrays by 1, to include 1-past last glyph
3. Add flags field to run (with just WS flag for now)

Change-Id: I93e38df808a5e9e4e5bcedbc62bc5a7aa433ef2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399876
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
2021-04-28 00:42:54 +00:00
Brian Osman
e37660b43c Use SkRuntimeEffect::MakeForShader in CanvasKit
The old factory is deprecated. The new factory does stricter checking on
the signature of main and calls to sample - verifying that the SkSL is
valid as an SkShader (vs SkColorFilter) at effect creation time.

Bug: skia:11813
Change-Id: I8d70f81b5c3fa78b05add1b591caf1d26dd70402
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399077
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-04-21 17:44:12 +00:00
Mike Reed
4c8c87e815 Show text hilites
Font was missing getMetrics()

However, seems like getShapedRuns() needs to return its
particular line spacing choices...

Change-Id: I574ebf789fb03b79c8e09198f1cb6e09dac3441b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397916
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-04-19 17:45:51 +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
Mike Reed
6e7d2b3b72 Add drawPatch to canvaskit
Change-Id: I66214398f020ab6e824c5509babe5107f6b46d7e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388837
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-31 15:28:21 +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
Ben Wagner
1546053269 SkFontMgr_New_Custom_Data to take SkData
Have the canvaskit bindings provide SkData since only the bindings know
the correct release procedure for the underlying data.

Bug: skia:11778
Change-Id: I0fac15287b014ea01dfc0d4b87dd2fe7987fe1d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/388496
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2021-03-24 15:02:03 +00:00
Kevin Lubick
3b760b6fa8 [canvaskit] Add full build to npm release.
Also rename //modules/canvaskit/canvaskit to //modules/canvaskit/npm_build
to make it more clear the purpose of that folder (what we ship to
npm and stage our builds for local testing).

Bug: skia:11203
Change-Id: I4299ded97d14f4155c36798d60e88a660ce6fe6a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372392
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-02-23 14:40:43 +00:00
Kevin Lubick
3dbca47568 [canvaskit] Remove Font.measureText and Font.getWidths
This had been previously deprecated.

Bug: skia:10717
Change-Id: Ic57ed835c13cfa7812099a3ef20ed7ff5aa62f7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371339
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-23 14:27:50 +00:00
Kevin Lubick
58605b0466 [canvaskit] Remove ShapedText API.
The Paragraph API is what should be used.

Bug: skia:10717
Change-Id: I135aff09bffae0718045b5c744f8e774e2ee1bce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371338
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-23 14:27:50 +00:00
Kevin Lubick
8172d16577 [canvaskit] Remove exposition of SkData
Change-Id: I5a7c2e30b2adc4b8947743ac82a800e96a7005b1
Bug: skia:10717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370879
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-17 15:47:06 +00:00
Brian Osman
f2f3d52ad5 Add CanvasKit bindings for SkRuntimeEffect's uniform data
Written to use the exact same names and semantics as particles.

Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit,Test-Debian10-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit
Change-Id: I4031efbce06527a519f1ce8c261f79231554e1ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365701
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-02-04 17:43:28 +00:00
Kevin Lubick
70b6729a05 [canvaskit] Add error callback for runtime effect constructor
It would otherwise be difficult/tedious/not-backwards-compatible
to return the RuntimeEffect AND the error message.

Change-Id: I9bdbafb653398ccbb72e6e762ec4b6af294f9110
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365483
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-02-03 17:35:23 +00:00
Kevin Lubick
e9e8e5d771 [canvaskit] Replace Postan value array with Float32Array.
Change-Id: Ie0e8a9271ef1b68551473fb9a1bcc9442f063efe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362477
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-02 15:22:07 +00:00
Kevin Lubick
d62738d094 [canvaskit] Remove deprecated PathMeasure
This will make cleaning up the PosTan value easier.

Change-Id: I13aa12f94c560bf8539aa2edb1f9e13779635692
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362458
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-02 15:22:07 +00:00
Kevin Lubick
f6040ef2a7 [canvaskit] Remove value_array for vector3
Also removes the size value_objects, which appear unused.

Change-Id: Iecfc05b6c285b981415121943b7b43e2216516cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362339
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-02 15:22:07 +00:00
Kevin Lubick
ed96264ad7 [canvaskit] Replace Point value_array with Float32Array
Using value_array (and value_object), while convenient,
adds a measurable overhead. This removes the Point value_object
and replaces it as a return value with Float32Array
(similar to rects). For inputs of a single point, I just
split it into x and y. For inputs with two points, I used
a _scratchFourFloats (formerly _scratchRect) bit of memory.

Two subtle decisions here:
 - Why not use scratch memory for a single point? The cost of
   having one extra param is a small/negligible price to pay
   for less complex code.
 - Why not accept Malloc objects? Again, simplicity. Accommodating
   Malloc would make the code harder to read and require more
   checks. I don't know if anyone wants to have malloced points;
   if they do, we can probably accommodate that.

Change-Id: I1b1c29f62e01c2f1c8c1218f58e3bad642214322
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362097
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-02 15:22:07 +00:00