Commit Graph

62 Commits

Author SHA1 Message Date
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
Kevin Lubick
4ca0dacbce [canvaskit] Roll to 0.12.0
Change-Id: I306f18b49574d264fa7091112a77dea158d8967a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265959
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2020-01-22 20:35:54 +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
Kevin Lubick
a4f218dd68 Add support for reading .skp files in CanvasKit.
Bug: skia:9760
Change-Id: Ifecd819a0e4b6b8f8818ce593afd546e10c36df3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262159
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-01-15 14:46:37 +00:00
Kevin Lubick
032aa72178 [canvaskit] Roll to 0.11.0
Built at f72e48dd2f

Change-Id: I4f8a37b7027621234547e159c3fdb173abdf083d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263574
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-01-10 17:22:39 +00:00
Kevin Lubick
f5bc8fba95 [canvaskit] Create an SkImage from a frame of an SkAnimatedImage
Flutter on the web wants to be able to extract arbitrary frames from
an animated image and pass those into functions like:
drawAtlas, drawImage, drawImageRect

This should allow that to happen w/o having to add lots of variants like
drawAnimatedImage. If this sticks, is drawAnimatedImage still useful?
(maybe it saves a copy?)

Change-Id: I99d7045c5dea61d0a1bd6d335c88e7517f2c4fc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263020
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2020-01-09 13:25:43 +00:00
Kevin Lubick
a4c4c3cd9f [canvaskit] Add webp support
I had thought this was in, but I guess not.

Oof, this adds 328kb of code size (131kb gzipped).

About 2/3 of the code added is due to encoding, which
we'd like to do away with.
(see https://bugs.chromium.org/p/skia/issues/detail?id=9756)

Change-Id: Ia2bd80c70ec9fb80cdc52052049fd4526ba7eeef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262928
Reviewed-by: Hal Canary <halcanary@google.com>
2020-01-08 18:10:16 +00:00
Kevin Lubick
08bf8f79f1 [canvaskit] Remove support for T1 fonts and reduce code size
We were previously building FreeType2 with the psnames module,
which included large tables of glyphnames [1]. These were only
used in code related to PDF (and only when outputting Type 1
fonts, which is very rare).

Even though the PDF backend isn't in CanvasKit, the compiler
couldn't throw away these massive tables (about 80k in all)
of strings. Since these tables were only used for T1 fonts,
it made sense to tell FreeType not to include the rest of the
T1 related code, which saved about 55k more.

If, one day, we add in support for the PDF backend to CanvasKit,
SK_PDF_DO_NOT_SUPPORT_TYPE_1_FONTS is likely something we'll
want to define.

The roll-freetype.sh is inspired by a script of the same name
in the Chromium repo and aids in the updating of freetype
and our forked config files.

[1] 0a3d2bb99b/src/psnames/pstables.h (629)

Bug: skia:9733
Change-Id: I359bab4184587cbe91400661fb012eac1a601a83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262232
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-01-06 18:49:41 +00:00
Kevin Lubick
933ea8c301 [canvaskit] Add build flag for pathops
This fixes up some other build flag options:
 - font-specific js code is correctly omitted when no_font is set
 - SKP serialization is only compiled in debug (or with flag).


Bug: skia:9733
Change-Id: Ifdbd2ddac278cfcefa842f6d4826d5429b6ed64b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262137
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-01-06 13:10:43 +00:00
Kevin Lubick
b6a3b7db70 [canvaskit] Update compile.sh with initial code size findings
make profile can be used with bloaty [1] and twiggy [2]

Some example commands for investigating code size:

    bloaty ./canvaskit/bin/canvaskit.wasm -d symbols
    bloaty ./canvaskit/bin/canvaskit.wasm -d sections

    twiggy top -n 50 --retained ./canvaskit/bin/canvaskit.wasm
    twiggy monos ./canvaskit/bin/canvaskit.wasm -g -m 40
    # Let's pretend we have a symbol called
    # AddIntersectTs(SkOpContour*, SkOpContour*, SkOpCoincidence*)
    # that we want to investigate further
    twiggy dominators --regex ./canvaskit/bin/canvaskit.wasm AddIntersectTs.+
    twiggy paths --regex ./canvaskit/bin/canvaskit.wasm AddIntersectTs.+


[1] https://github.com/google/bloaty
[2] https://rustwasm.github.io/book/reference/code-size.html#the-twiggy-code-size-profiler

Bug: skia:9733
Change-Id: I4a665fe2c750da552fee1dbf804ce0028a06c6c3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261903
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-01-02 14:05:45 +00:00
Brian Osman
77742c3503 Remove SkShader.Empty from CanvasKit
SkShaders::Empty may be easy to expose, but that doesn't mean we should.
It shouldn't even be public, but Chrome uses it in one place.

Change-Id: I398a5e6f782990a7baec0d9b1d0018f7456ff15f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260956
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-12-19 14:11:17 +00:00
Kevin Lubick
e6e39bcbe0 [canvaskit] Fix SaveLayer constants
Turns out constant doesn't like to take an enum, but needs explicit
coercion to be an int.

Change-Id: I29c761fd2dfd9eb3cde0db3c0c3f0e97dd6ff411
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260698
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-12-18 17:55:59 +00:00
Kevin Lubick
99e9532050 [canvaskit] roll to 0.10.0
Change-Id: Id06aad4db1a5c827d70ae28be38709167ab749b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258815
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-12-09 17:51:23 +00:00
Kevin Lubick
62836903bc [canvaskit] Expose SkShader combiners
Change-Id: I84652fcec828fea55e2aa35567c054e9678ecf80
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258797
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-12-09 14:19:24 +00:00
Kevin Lubick
eda0b436df [canvaskit] Add test and extern for MakeImage
This was originally exposed for use with specs/web-img-decode and has
seen some actual use.

Change-Id: I6cc4fdf431b45cbbc21b91881c688c5545ca44a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/257317
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-12-03 15:39:48 +00:00
Florin Malita
0d603d8add [CanvasKit] Add SkResourceCache helpers
Allows clients to tune their image decode cache.

Change-Id: I121db096fe6c79a64aa1d388d3bae29f29dd2993
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256359
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-25 19:10:06 +00:00
Kevin Lubick
e59c167b0f [canvaskit] Add SkContourMeasure
Change-Id: Ied060a4de792d6372b8410bf8c7628b5fd1dfefb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255528
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-22 12:17:55 +00:00
Kevin Lubick
4a5f4f26f6 [canvaskit] Include direction from getRects
Change-Id: Iab27d2c9fa602be0bb1f9125eef0e4271b9d5874
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255306
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-11-20 13:27:22 +00:00
Kevin Lubick
c9d263c121 [canvaskit] Roll to 0.9.0
Lots of bugfixes and trying out including a debug build (for Flutter).

Change-Id: Ie6b93386aa8dcce46ff62aaafe09c02384c50b6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255076
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-18 12:23:34 +00:00
Kevin Lubick
541f310b34 [canvaskit] Fix primitive_shaper build
The problem was we didn't have a way to not build with
SkParagraph, which we can't use when we are using the
primitive shaper.

Change-Id: Iafe070d6f5c01aaa7a42225793d5ad873f144798
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254968
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-15 21:10:22 +00:00
Kevin Lubick
0491267160 [canvaskit] Expose more SkParagraph methods
Bug: skia:9469

Change-Id: I922a877fc20d29b95e68f93842505df5dead6934
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254960
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-11-15 20:08:41 +00:00
Kevin Lubick
d267719e32 [canvaskit] Add MatrixTransform ImageFilter
Change-Id: Ifcb73c331846abb3ffa9ac2f41236de8da4fdccc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/254804
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-11-15 19:50:14 +00:00
Kevin Lubick
37ab53e7c7 [canvaskit] Expose a few more methods
More requests by flutter-web.
 - drawPoints
 - drawImageNine
 - getSegment
 - addPoly

Change-Id: Iad8f51bb7df5fe014931dc12c8d09d64c08c3a13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253740
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-14 19:00:33 +00:00
Kevin Lubick
47bd9f1b73 [canvaskit] Expand SkAnimatedImage
With these things exposed, I think Flutter will not need
CanvasKit to expose the very complex SkCodec API.

Change-Id: Iace1b496d1dcb8842181466e860e8f212aba7b48
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253542
Reviewed-by: Leon Scroggins <scroggo@google.com>
2019-11-08 14:58:14 +00:00
Kevin Lubick
f6a9d20e95 [canvaskit] Fix null dereference when GrContext cannot be made
This happens when validation fails, for example.

Change-Id: Idbd552fbce51c5cf1543fc7a0a34a87230264d6e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/253658
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-11-08 14:58:04 +00:00
Kevin Lubick
79b7134b5f [canvaskit] Add relative SkPath operators
Like with the non-relative forms, we want to be able to
chain these together, but not leak the SkPaths (which happens
if the C++ side returns this). Thus, we have to add in
the JS glue to return the "JS this".

Change-Id: Ic640b84f6c09c1d931ad44bc403b14bb0d0893a2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251960
Reviewed-by: Hal Canary <halcanary@google.com>
2019-11-01 20:08:27 +00:00
Kevin Lubick
77d9b5c58e [canvaskit] Add tentative support for savelayerrec
It was easier to just add a few saveLayer overrides rather
than try to expose the struct of pointers. SkRect*
was hard/impossible because we have it as a value_object,
which does not support pointers in enscriptem.

Change-Id: Iad702593cca19f80d6ef9a319f8c80a087135e38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250996
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2019-10-29 16:46:43 +00:00
Kevin Lubick
15b40236bd [canvaskit] Add various ImageFilters
We are pretty comfy exposing this set for the long-term.

CanvasKit will generally support chains of image filters,
not necessarily arbitrary DAGs, just to simplify the
points needed to expose.

Change the naming around MaskFilters also, I like having
the factories be a class function, just to keep things
a bit better organized and minimize the amount of things
we want to keep on the top level CanvasKit object.

Change-Id: If32c630efa2fd8bc4bac84d0c3461ac3c0d21263
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/250758
Reviewed-by: Robert Phillips <robertphillips@google.com>
2019-10-29 14:48:33 +00:00
Kevin Lubick
a1a4d82314 [canvaskit] Use skia's version of png and zlib
Change-Id: I730936cf91776451f7ba2657e5d07b20837e2dee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247297
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-28 16:27:53 +00:00
Kevin Lubick
2d6d34ec19 [canvaskit] Use newer freetype
This new freetype lets us have emojis and brings in years
worth of bug fixes from the ancient version shipped in
the emscripten-ports

Change-Id: I0b8779dba3341a3ef73c715fde2e5fb37e45126a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247296
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-10-28 15:15:39 +00:00
Kevin Lubick
6dbc4ed880 [canvaskit] Expose various canvas features
clipRRect and drawColor

Change-Id: I6e947b4a30646a96935c74e0cd334f1624c41065
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249892
Reviewed-by: Mike Reed <reed@google.com>
2019-10-22 16:09:27 +00:00
Kevin Lubick
e25df6cf78 [canvaskit] Expose Malloc to save copies in some places
By adding in the check to copy1dArray, some places get the benefit
for free.

Change-Id: I12e230465737dc6276feb02ddb37e3c417777055
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249878
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-22 13:41:28 +00:00
Kevin Lubick
56f569d9be [canvaskit] roll to v0.8.0
Biggest change here is to add initial support for WebGL 2.0 where possible.

Change-Id: I05657dbfeed25fc665205ceda6b35022f6a42053
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249815
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-21 19:17:46 +00:00
Hal Canary
e054d3cf3d CanvasKit: Switch to WebGL 2.0
CQ_INCLUDE_TRYBOTS=skia.primary:Test-Debian9-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit,Test-Debian9-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit

Bug: skia:9052
Change-Id: I444031276aea90d82f289b16ba6cd36de5192abd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/248927
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-16 18:45:46 +00:00
Kevin Lubick
fa5a138170 [canvaskit] Update to build with emscripten 1.38.47
Bug: skia:9052
Change-Id: Ic1aec2c9b8ace556f5b77862582894f59fd26b64
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/247302
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-10-09 15:08:10 +00:00
Kevin Lubick
369f6a5ea2 [canvaskit] Initial addition of SkParagraph
There are more parts of ParagraphStyle and TextStyle, but
this should be a bulk of the components.

Bug: skia:9469
Change-Id: I87fff6700f41cff49ecbee3a1339e84c36699c93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244837
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-10-03 18:04:55 +00:00
Kevin Lubick
61887c7b88 [canvaskit] Create SkFontMgr from passed in data
This repurposes much of our embedded SkFontMgr code
to take in data directly instead of from compiled-in
variables.

Also makes no_font and no_embedded_font work better.

Bug: skia:9469
Change-Id: Ibde49c9a448cfca79c5712aa9abbe15997a163d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244510
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-26 19:27:12 +00:00
Kevin Lubick
16d998f24b [canvaskit] fix null terminator on drawText
Bug: skia:9314
Change-Id: I09449276b687caf8397c901b391cb882537ef5d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/244498
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-09-26 17:26:03 +00:00
Kevin Lubick
6b921b7e4a [canvaskit] add support for SkAnimatedImage
Also adds tests for static png,jpg,gif

Was unable to simply expose drawDrawable because the JS
side of things does not understand inheritance (specifically,
it doesn't know what is a descendant from SkDrawable).

Change-Id: I6a833c93f22ef90ae12e901168ff428e20504209
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242562
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-09-20 18:34:01 +00:00
Kevin Lubick
dd0dff1c35 [canvaskit] roll to 0.7.0
Change-Id: I1854059b48b791c5408a1919fdc500772749c283
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242416
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-09-18 12:21:46 +00:00
Kevin Lubick
d372934c42 [canvaskit] expose SkColorFilter and add SkColorMatrix helpers
of note, this is kjlubick's 2^9 = 512'th commit into the Skia repo.

Change-Id: I635cb1db6812217358ab138cd833c0c61f676232
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/241037
Reviewed-by: Mike Reed <reed@google.com>
2019-09-13 14:09:03 +00:00
Kevin Lubick
50f377e275 [canvaskit] expose ComputeTonalColors
Change-Id: Ia4f0eec8e162ad273e856c04ca98c7e2cb48935e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/240693
Reviewed-by: Jim Van Verth <jvanverth@google.com>
2019-09-11 19:44:51 +00:00
Kevin Lubick
7d644e182e [canvaskit] expose all 8 radii for RRect
Change-Id: I537bda18a588c9db5b0f3ea17203bb1daab0feb5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/240689
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-09-11 19:02:33 +00:00
Kevin Lubick
2e5fe35044 [canvaskit] Add rrect support
Change-Id: Ic9f2c0224b95e277df93a1d46e59a1096d8005b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238896
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-09-03 18:00:16 +00:00
Kevin Lubick
e384df4f5e [canvaskit] Add sundry APIs and tests
To the reviewer: I've tried to make it so each PS adds one new API.

Change-Id: I81fc85c7a93a19ce4fd725a125e138d35471e693
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237155
Reviewed-by: Mike Reed <reed@google.com>
2019-08-27 12:35:49 +00:00
Kevin Lubick
d6ba725da3 [canvaskit] Save a copy by using SkVertices::Builder
Change-Id: I7a01f97d57c37b7198b7f4fbb966c785ab998861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217898
Reviewed-by: Mike Reed <reed@google.com>
2019-06-03 18:41:00 +00:00
Kevin Lubick
0921c10404 [canvaskit] 0.6.0
Change-Id: I4c408a8b711421856a14d67cee121512f7e06900
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212190
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-05-06 17:47:09 +00:00
Kevin Lubick
d6b32ed39d [img-decode] Start on proposed new spec
This adds readPixel and a partial stub of window.createImageData

Change-Id: Iee992312b9331b71852fe2198f844a7e4ae9e963
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211344
Reviewed-by: Mike Reed <reed@google.com>
2019-05-06 17:39:19 +00:00