Commit Graph

507 Commits

Author SHA1 Message Date
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
61b0a88357 [canvaskit] Update testing dependencies
Other devs should run `npm ci` to install these locally.

Change-Id: I4581e8afe2401b10edae86b8bfd6fe398546cd0f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412836
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-05-27 12:31:20 +00:00
Kevin Lubick
dc5530e5b3 [canvaskit] Retry loading assets for tests
This cuts down on some flakiness I saw locally.

Change-Id: I8659b2cabacb99f3839a4b44daec852061184d55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/412663
Reviewed-by: Leandro Lovisolo <lovisolo@google.com>
2021-05-27 12:31:06 +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
Mike Reed
0e4477e713 Switch to malloc/free to be compatible with CanvasKit.Malloc
Inspired by https://skia-review.googlesource.com/c/skia/+/410876

Change-Id: Iaf64f379e74d46b46c795dd5f04db32406b976b4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411576
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-24 12:22:13 +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
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
Yegor Jbanov
3c429d05f9 make jline a JS object
Change-Id: Ib0e48868c77270f091c2d6ad857cd47278aff8a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/410036
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Yegor Jbanov <yjbanov@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-05-18 19:25:54 +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
e8cd0a5404 Don't need/want to pay attention to non-shaping attributes
Change-Id: I16d75c9d8fb3c61a4993fe216142e80884bc2ad1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409576
Reviewed-by: Mike Reed <reed@google.com>
2021-05-18 01:06:08 +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
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
Mike Reed
7d093d8828 Quick out-of-range fix for selections
Change-Id: I6373f9a70c6e341a39114f0bdce50a92ee745dcb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406036
Reviewed-by: Mike Reed <reed@google.com>
2021-05-09 17:28:45 +00:00
Mike Reed
511c327de6 Sync styles when inserting/deleting text
Change-Id: I263ae85b0b229d359b865d8b8c9f4aed736b0654
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405880
Reviewed-by: Mike Reed <reed@google.com>
2021-05-09 17:00:14 +00:00
Mike Reed
686dd910dd Track non-shaping style runs
We only break runs (from the shaper's perspective) on typeface/size
changes. All others we just track locally, and then 'chop up' our draws
accordingly.

Change-Id: I81695772f71175cd5116ed34981ecf16b52123c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405876
Reviewed-by: Mike Reed <reed@google.com>
2021-05-08 20:18:36 +00:00
Mike Reed
72de83df3a Manage styles in editor
Change-Id: Ifde8853a780b8406ef6b794cd458904ee0663771
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405694
Reviewed-by: Mike Reed <reed@google.com>
2021-05-07 21:17:42 +00:00
Mike Reed
cced68e42c fakeBold is gone, scaleX is in (sort of)
Change-Id: I5db9e935d0c43de92a9688baf8cb1e1f9e74e7c9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405684
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-05-07 17:26:25 +00:00
Mike Reed
c48c3e5d57 Try new factory for ShapedLines
Known hacks for now:
- only default typeface
- only ascii support

Fonts have several limitations for now.

SkParagraph (our temporary backend) wants a fontmgr up front,
rather than just relying on the typefaces in its styles. This makes it
hard to inter-op with our JS api. Not a long-term problem, as this
backend is short-term. The hacky work-around is just to pass NULL for
the typeface for now.

Related but different, I haven't yet figured out how to "return" a
JS Typeface object. Something about bare-pointers and sk_sp. I'll figure
it out eventually, but for now I just set the output slot to null
as well. (there's a TODO in the .cpp)

Ascii support

JS strings are UTF16 (afaik). However, our current backend thinks in
terms of UTF8 offsets. Plus, (at the moment) when I try to access the
JS string for C++, it coerces to utf8 (std::string).

We can fix both of these eventually, but for now I'll just test with
ascii input characters, and the API can still work.


Change-Id: I62ca71b0b45d017ac8e3881c06720776dc2d75a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/405400
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-05-06 23:01:47 +00:00
Kevin Lubick
3232a6625b [canvaskit] Small example fixes
Change-Id: If7a05b34975f2fee8f057e649bfe3a7b0fc541b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404778
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-05-05 17:20:26 +00:00
Robert Phillips
3b97aa2cc9 Add NGA compilation stubs
Change-Id: I5309005146b8121528ad23589fa64cc6bf286aee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402578
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2021-05-05 16:48:01 +00:00
Mike Reed
c1a5a48159 Move editor into utils
Change-Id: I2dd8877317cc751ec4380f1d88c1ef79dad96442
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404238
Reviewed-by: Mike Reed <reed@google.com>
2021-05-04 19:32:34 +00:00
Mike Reed
2a5eacb0f9 Split some helpers into separate js file
Also handle ctrl and meta better.

Change-Id: I2149f1dfaa4b0af58cae8d16ead5432d17e05916
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404157
Reviewed-by: Mike Reed <reed@google.com>
2021-05-04 15:18:28 +00:00
Mike Reed
faf7bf5966 Edit text
Change-Id: I57282da8f9d2bf1334bc8246c843dfdf475e338c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/404016
Reviewed-by: Mike Reed <reed@google.com>
2021-05-04 14:34:09 +00:00
Mike Reed
bf688645ac Support arrow-keys
Change-Id: I4cfd99001ea99888c8781e018f67c644d1d6e3d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403597
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-05-03 20:33:33 +00:00
Mike Reed
ca2ad539f2 Remove getShapedRuns, add some dox
Change-Id: I7e226622475f7ee7173e7d2ec6fc388bd1792253
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403598
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-05-03 17:54:50 +00:00
Mike Reed
a46fe7d587 Return shapedlines for text api
Change-Id: I8f9aa6e0cffb3441706bd0efeb0886209cac012a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403256
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-05-03 14:21:11 +00:00
Mike Reed
097263bb50 Track mouse for cursor and hilites
Change-Id: Icfc8a28fa0c9e3118ef4ddc5ae12162aab3fb484
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398556
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2021-04-30 20:49:40 +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
e2c14b5e88 [canvaskit] Make local-example explicitly use Python2
The script doesn't work with Python3.

Change-Id: I9ea6397506500f76570540f78aa736873769f92b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403016
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-30 15:14:28 +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
9eaae183ab An attempt to fix the last glyph position problem
Change-Id: I5d3eed412df024b93457a0f4e0ca0d13bc250e46
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/401919
Reviewed-by: Mike Reed <reed@google.com>
2021-04-28 00:48:45 +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
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
John Stiles
abde8fc182 Enable DSL FP tests.
These new tests rely on compiled shaders that live in the
`tests/sksl/dslfp/` directory; this CL updates the Bazel and
emscripten build scripts to include these shaders.

Change-Id: Ib670682af8bf451a4473504dd4cc76a0e9222129
Bug: skia:11854
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/400097
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-04-22 21:03:43 +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
Mike Klein
dd8f8ed384 clean up defines that do nothing
These are leftovers.  Should be a noop.

Change-Id: I9897841e63b417a63d6f2d681a8ac4ae50ebb485
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/399797
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2021-04-22 18:02:59 +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
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
e058608626 [canvaskit] Fix transform() call in test
This started to fail in Chrome 90.

Change-Id: I77e96f155b6ab83d206b3d258b971fef2f7d3a62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398677
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-20 18:12:13 +00:00
Kevin Lubick
4eaa3925ba [canvaskit] Split paragraph_bindings into two files for generation POC
Generating the enum code should be a good first step for
automatically generating the C++ binding code using some type
of annotation.

Change-Id: I3a2af66204cf48a1efb4f24b7a4af59626100227
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398676
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2021-04-20 18:11:45 +00:00
Brian Osman
8f1dff6a9e Remove layout(marker) from runtime effect SkSL
This is another strange, experimental feature that clutters the
implementation and isn't used by anyone (to my knowledge).

Change-Id: I538b7eca0cd28aab32f4739b23459731ade9105e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/398226
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-04-19 18:48:45 +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
66aed2136b Expose proposed Shaper API to JS
Requires: https://skia-review.googlesource.com/c/skia/+/392837

Change-Id: I3b779b699fbcade7702049a83b98db8dfe86433d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397436
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-04-17 15:16:23 +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
be834bfa2c Fix up quotes and prototype decl from prev CL
Change-Id: I9546bef4d0bd1232aa1995b59e9a188198fcb75a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396819
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2021-04-15 12:38:29 +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
Mike Reed
e0f3d612b0 Change GlyphIDArray to 16bit
pre-cl to prepare for more Glyph methods
e.g. https://skia-review.googlesource.com/c/skia/+/396496

Change-Id: I334f9d93ea2183a69f2d9087a783ad7d7277248b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396498
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-04-14 13:44:48 +00:00