Commit Graph

1359 Commits

Author SHA1 Message Date
Hal Canary
03c68091c1 Revert "experimental/minimal_ios_mtl_skia_app"
This reverts commit c2dc9c8648.

Reason for revert: Build-Mac-Clang-arm64-Debug-iOS_Metal Build-Mac-Clang-arm64-Release-iOS_Metal broken:

    ninja: error: '../../../../../../skia/experimental/minimal_ios_mtl_skia_app/main.mm', needed by 'obj/experimental/minimal_ios_mtl_skia_app/gen/experimental/minimal_ios_mtl_skia_app/minimal_ios_mtl_skia_app.main.o', missing and no known rule to make it


Original change's description:
> experimental/minimal_ios_mtl_skia_app
> 
> Change-Id: Iec5b9d9b930cb8b2b97ce92c828ccba0a9e2a94d
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238757
> Auto-Submit: Hal Canary <halcanary@google.com>
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>

TBR=jvanverth@google.com,halcanary@google.com

Change-Id: I6a3c16131072019ba541ad573c95a8de4d2b5eef
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/239120
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-09-04 15:52:08 +00:00
Hal Canary
c2dc9c8648 experimental/minimal_ios_mtl_skia_app
Change-Id: Iec5b9d9b930cb8b2b97ce92c828ccba0a9e2a94d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/238757
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
2019-09-04 14:44:02 +00:00
Hal Canary
a0b66fc79d SkPlainTextEditor: from experimental to modules
Change-Id: I8896283ee3a57af926a43f6647e27059d52dd7a8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237146
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-27 20:32:19 +00:00
Mike Klein
df54f37a5d remove SkPicture_none.cpp
I happened to notice that SkPicture_none.cpp no longer compiles.

    ...
    src/core/SkPicture_none.cpp:101:44: error: out-of-line definition of
    'CreateProc' does not match any declaration in 'SkPictureImageFilter'
    sk_sp<SkFlattenable> SkPictureImageFilter::CreateProc(SkReadBuffer& buffer) {
    ...

This leads me to conclude that it cannot be in active use.

Change-Id: I92a4daa3c7d5d7889c4f841b578c9c691525c1cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/235216
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-08-16 14:52:25 +00:00
Hal Canary
e73aa75732 experimental/editor: up,down preserves x-coordinate
Bug: skia:9020
Change-Id: I009dead2e47d4d7d27ea383697a28c7569ffeaac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234318
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-13 17:46:08 +00:00
Hal Canary
5fd38c0959 experimental/editor/application: pre-shape text before showing window
Also, make constructor do even less work.

Change-Id: Iced41488757d6d5d01c4e1d02eee03ab2bb109a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/234216
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-08-13 14:08:09 +00:00
Hal Canary
6e1b7bb2b5 experimental/editor: README.md multilingual example
No-Try: true
Change-Id: Idad1a4a624d3621a0a330ea4eb8361978ead9021
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233980
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-08-13 13:55:19 +00:00
Hal Canary
8d1b0bceed experimental/editor/README.md fix
No-Try: true
Change-Id: I893f110f609c30495d43ea86751839e3c2f78515
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233979
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-08-12 14:36:01 +00:00
Hal Canary
ded867f126 experimental/editor: shape.h to unify all shaping code
also simplify handling of implicit position at end of line.

also simplfy move() operation.

Change-Id: Ic242b5413c65295b1ac1bf7aa3a4948c3ed1c742
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233303
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-09 14:20:10 +00:00
Hal Canary
4acbab33bd experimental/editor: scroll on delete if necessary
Change-Id: Ib1c6ef3d257956c0876d5184423072226d70d973
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233257
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-08 16:08:15 +00:00
Hal Canary
bcfed55a8c experimental/editor: mouse drag select, modifierkeys cleanup.
Change-Id: I8c8de54ad6309424bdf18987ccf3eac6bdd41c19
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/233080
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-08 02:33:44 +00:00
Hal Canary
e45bf6a603 experimental/editor: interface no longer uses stringslice
Editor::copy() now writes into a buffer provided by the client.

    Editor::text() now returns a series of `pair<const char*, size_t>`
    instead of `const StringSlice&`

Change-Id: Iff298dd7a80aaad19f9326d10c5b67bea5ef8e22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232579
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-06 16:52:08 +00:00
Hal Canary
b55b362e60 experimental/editor: margins now handled by application layer
Change-Id: If67ded4a4073617f2e17de465b7f017cd65c20aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232580
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-05 21:29:57 +00:00
Hal Canary
f1138888e7 experimental/editor: StringSlice::fPtr type change
Change-Id: Ibfc06b96d04e3bf42d4df7a2eacdaf6b4043efd1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/232576
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-05 18:13:37 +00:00
Hal Canary
71c34240f4 experimental/tools/gerrit_percent_encode
NoTry: true
Change-Id: I448b4791911dd1b87104ca809b2b41c62ce0ee3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231480
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-08-05 16:11:45 +00:00
Hal Canary
ebfcf0c073 experimental/editor: cleanup
Remove unneeded setText().
    Change default font.
    EditorApplication constructor does no real work.

Change-Id: Ie257fbc9873d99ccb3972842493d65a12b0e7904
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231479
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-08-02 16:51:04 +00:00
Hal Canary
3f4a2b3499 sk_app, editor: cursor blink
Change-Id: I43044727298265ddb711456346c2b544ca8d509d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/231477
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-08-02 15:36:40 +00:00
Hal Canary
7679b28639 editor: try to fix moltenvk bots
Change-Id: Id57103ac3bc9bad5f6e4b685e8b00fdc5e53aecd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230752
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-30 17:11:03 +00:00
Hal Canary
e9cb762215 experimental/editor : handle word-left and word-right
Bug: skia:9020
Change-Id: I308a0c9867777eb5c008f583d86d8d1c8ff5d8e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230745
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-30 15:48:29 +00:00
Hal Canary
1f94d3900b experimental/editor: clean up BUILD.gn
Place build rules in experimental/editor/BUILD.gn to keep the top-level
BUILD.gn file smaller.

Change-Id: Idf22aec6f86bc510f4528fe0296bc1bea69f3df2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230740
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-30 14:28:58 +00:00
Hal Canary
e37874e19e experimental/editor: Editor::markDirty() private helper
CQ_INCLUDE_TRYBOTS=skia.primary:Build-Mac-Clang-arm-Release-iOS

Change-Id: Ie6a20943c51c45f2abc37f7215b1c67810ce20ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230736
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-30 14:21:28 +00:00
Ben Wagner aka dogben
e19a4f2614 Revert "experimental/editor: depend on ICU, handle word-left and word-right"
This reverts commit de23697549.

Reason for revert: Causing segfault on Mac builders; BUILD.gn needs to be formatted.

Original change's description:
> experimental/editor: depend on ICU, handle word-left and word-right
> 
> In App: ctrl-left-arrow and ctrl-right-arrow.
> 
> Added a TODO about using better notion of a word.
> 
> Bug: skia:9020
> Change-Id: I6f2b930928b9d38bca47291fd39dde7f93ccac03
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230417
> Commit-Queue: Hal Canary <halcanary@google.com>
> Reviewed-by: Ben Wagner <bungeman@google.com>

TBR=halcanary@google.com,bungeman@google.com

Change-Id: I62dc160d8ae1ce58878b8e222a4d7860cc92ddfe
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9020
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230577
Reviewed-by: Ben Wagner aka dogben <benjaminwagner@google.com>
Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-07-29 20:55:36 +00:00
Hal Canary
de23697549 experimental/editor: depend on ICU, handle word-left and word-right
In App: ctrl-left-arrow and ctrl-right-arrow.

Added a TODO about using better notion of a word.

Bug: skia:9020
Change-Id: I6f2b930928b9d38bca47291fd39dde7f93ccac03
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230417
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-29 20:19:31 +00:00
Hal Canary
9ef1b771af experimental/editor: scroll on cursor movement, Editor::getLocation
Bug: skia:9020
Change-Id: Iab91402790077c969af8e553b03525e63dab44ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230496
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-29 19:43:38 +00:00
Hal Canary
ac0e466154 experimental/editor: fix Movement::kUp, Movement::kDown
Bug: skia:9020
Change-Id: I5c765f2be92971690f59d744207cf8b8f78c8c4a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230128
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-26 18:01:02 +00:00
Hal Canary
23b37dc9e0 experimental/editor: fix home, end
Bug: skia:9020
Change-Id: Ib7611212590d29eff9da870492e6ecc84f405786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229836
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2019-07-26 15:54:12 +00:00
Hal Canary
8e9fc27822 experimental/editor: fix resize
Bug: skia:9020
Change-Id: I2f2ade4a5406b60e1b6c2004136fbbad36085d58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/230121
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-26 15:26:45 +00:00
Hal Canary
b3956dc6ba experimental/editor: Find nearest possible cursor position when click in whitespace
Bug: skia:9020
Change-Id: Ieb1f7a545ab3458db7124535b3be3c3d589bf1be
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229388
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-24 15:05:05 +00:00
Hal Canary
ff2e8fe65f sk_app, Sample: Unify InputState enum.
replace() {
      if git grep -q "$1")";
      then sed -i -e "s#${1}#${2}#g" $(git grep -l "$1");
      fi
    }
    replace 'k\([A-Za-z]*\)_InputState' 'InputState::k\1'
    replace '\(\(sk_app::\|\)Window\|Sample\|\)::InputState' 'InputState'

Change-Id: I4cc18814fb1fbdd1f240aabba05aae79c54a4841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/227642
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-16 14:51:03 +00:00
Hal Canary
c726ca637b experimental/tools: set-change-id-hook
No-Try: true
Change-Id: I585d14f9614fc9b1ae03b04bb838e79d1efc2bb2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/226511
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-07-11 14:07:21 +00:00
Hal Canary
3a85ed12bf ModifierKey unifies sk_app::Window::ModifierKey & Sample::Click::ModifierKey
Change-Id: Idb5dfe57a7f6e3d6078ab1e68d542b084114cfbe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/225735
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-07-09 16:16:41 +00:00
Hal Canary
43e97165d2 experimental/editor: app layer: setTitle
Change-Id: I8f8aec909f85e3bc99f6b0c9887ba513b17e00c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/223925
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-06-26 16:58:20 +00:00
Hal Canary
66bf2cfb93 experimental/editor: progress on newlines
Editor:
  - Editor::Shape(): Place end-of-line cursor correctly.
  - Editor::insert(): Allow insertion of '\n' character.
  - Don't try to reshape empty string each time.
  - Editor::insert(), Editor::setText(): Validate utf8 input
  - Editor::remove(): Delete across newlines.
  - Editor::copy(): implement.
  - Editor::text() Iterator.

App:
  - Implement Ctrl-c, Ctrl-x, Ctr-v
  - Implement Ctrl-s
  - Handle "Enter" key as "insert '\n'"

StringSlice:
  - Cleanup, copy ctor.

Change-Id: I724edb82c93b30f4d5279f5a99036459a21ca2cd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222508
Auto-Submit: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-06-24 17:24:35 +00:00
Nathaniel Nifong
0426c38daa Reland "Deserialize MultiPictureDocument based SKP files (with image sharing proc) in wasm debugger."
This is a reland of 7635013ad1

Original change's description:
> Deserialize MultiPictureDocument based SKP files (with image sharing proc) in wasm debugger.
> 
> Change-Id: I73affae3cd05a2aa6ac1c75c8e049d352bbf3a85
> Bug: 9176
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217135
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

Bug: 9176
Change-Id: Ifef1ff45ac0013ba3015f88c7ecd75527b28b604
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222505
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2019-06-21 15:49:21 +00:00
Brian Salomon
384981be3d Revert "Deserialize MultiPictureDocument based SKP files (with image sharing proc) in wasm debugger."
This reverts commit 7635013ad1.

Reason for revert: breaking bots 

Original change's description:
> Deserialize MultiPictureDocument based SKP files (with image sharing proc) in wasm debugger.
> 
> Change-Id: I73affae3cd05a2aa6ac1c75c8e049d352bbf3a85
> Bug: 9176
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217135
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

TBR=djsollen@google.com,mtklein@google.com,kjlubick@google.com,reed@google.com,nifong@google.com

Change-Id: Ie5e5dac46ba1beeb8de0a29c1a7be1264616fe92
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 9176
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/222502
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2019-06-20 18:52:01 +00:00
Nathaniel Nifong
7635013ad1 Deserialize MultiPictureDocument based SKP files (with image sharing proc) in wasm debugger.
Change-Id: I73affae3cd05a2aa6ac1c75c8e049d352bbf3a85
Bug: 9176
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217135
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-06-20 17:33:04 +00:00
Eric Boren
b26747c0ec Remove experimental Go bindings
Change-Id: I56f85055ca93bd8db4adb157467d0c1987859511
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221656
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
2019-06-18 17:13:05 +00:00
Greg Daniel
f91aeb259e Move a bunch of gpu files out of include/private and into src/gpu.
In GrRecordingContext I moved the auditTrail onto the heap and only there
when compiling for tests. This allowed us to move a lot of files out of
include private.

Change-Id: Ib76ac211c0c6fd10bacaccf0c5f93f21a59f35d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/221344
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Greg Daniel <egdaniel@google.com>
2019-06-18 14:24:42 +00:00
Mike Reed
d62d406aa2 Revert "Revert "try resolver pattern""
This reverts commit 2bafb64ed3.

Change-Id: I46f29284546a8978fd0005a0937e28410e5ac0da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/220518
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-06-12 14:46:56 +00:00
Herb Derby
2bafb64ed3 Revert "try resolver pattern"
This reverts commit a716809d5a.

Reason for revert: breaks google3

Original change's description:
> try resolver pattern
> 
> Change-Id: I32c5dbf4cacce9112df42a6f29800859625dc4a9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218965
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
> Auto-Submit: Mike Reed <reed@google.com>

TBR=robertphillips@google.com,reed@google.com

Change-Id: Ib6facd0fda07762ed394b7b2c84771d7a93edae0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219488
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
2019-06-11 16:01:14 +00:00
Mike Reed
a716809d5a try resolver pattern
Change-Id: I32c5dbf4cacce9112df42a6f29800859625dc4a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/218965
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-06-11 12:35:38 +00:00
Mike Klein
4b432fa87b run rewrite_includes.py
Just your basic periodic cleanup.

Change-Id: I04d9ca5cfff05e6e2c29dd9caef3ce12cda45247
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219340
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-06-06 17:11:02 +00:00
Mike Reed
ede7e99465 add simpler addFrame api (helps with threaded producers)
Change-Id: I458dc2fb59aa32e084b0b03945afd74ff5ee42ae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217861
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-06-03 15:40:35 +00:00
Mike Reed
ab399c8467 free formatctx when we're done
Change-Id: I039fad48a65048cf20c0d2d2981120466c41038b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/217124
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-30 17:41:28 +00:00
Mike Reed
210a28a8cf rm dead code
Change-Id: I2829d94451ce0278b44b98ca0195d04124b669fb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216682
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-29 20:09:04 +00:00
Mike Reed
f97e8e961b simplify api to make encoder, use swscale for faster rgb->yuv
Change-Id: I19ea48667aa843e1166231fe8d2622af91cce972
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216611
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-29 17:59:18 +00:00
Mike Reed
c0ee21feb8 skia helper for encoding video
Change-Id: I36aef5872fc8f5938854ab18b754f3800b9879ad
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215165
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-05-28 20:39:21 +00:00
Hal Canary
308adbb418 experimental/editor: minor change
Change-Id: Ifd3963e6bb337832c287f2b0553315828a5d3889
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/216350
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-05-28 16:26:19 +00:00
Mike Klein
fe0aeb3691 update SkUserConfig.h a bit
- tweak comments to be immune to tools/rewrite_headers.py
    - remove a few bonkers settings no user should change

While I'm at it, re-run tools/rewrite_headers.py.

Change-Id: Ie588d604010dd26abcdd277c586cd6c58568dcf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214740
Auto-Submit: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-05-20 17:52:22 +00:00
Mike Reed
7bf160e6d5 Revert "Revert "Experimental SkVideoDecoder, to wrap calls to ffmpeg""
fix google3 build (don't build the new gm)

This reverts commit 9cc53fa4bd.

Change-Id: I3de8aa4959f62a380f1d4aaf2b788d250775e194
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214442
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-05-17 21:25:48 +00:00
Michael Ludwig
9cc53fa4bd Revert "Experimental SkVideoDecoder, to wrap calls to ffmpeg"
This reverts commit 69596470d1.

Reason for revert: breaks google3 roll
third_party/skia/HEAD/gm/video_decoder.cpp:8:10: fatal error: 'experimental/ffmpeg/SkVideoDecoder.h' file not found
#include "experimental/ffmpeg/SkVideoDecoder.h"

Original change's description:
> Experimental SkVideoDecoder, to wrap calls to ffmpeg
> 
> If you want to build ffmpeg locally, here is how I configured it:
> ./configure --disable-all --enable-avcodec --enable-avformat --enable-decoder=h264 --enable-parser=h264 --enable-demuxer=mov --enable-static --enable-protocol=file
> 
> Bug: skia: 9085
> Change-Id: If1892b62314af26e56ecb0293850f7554106c3d0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213664
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Nathaniel Nifong <nifong@google.com>

TBR=mtklein@google.com,bsalomon@google.com,scroggo@google.com,brianosman@google.com,fmalita@chromium.org,reed@google.com,nifong@google.com

Change-Id: I33d68e11a67ccf3616296e3377b42438c7f95edc
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia: 9085
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214441
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2019-05-17 20:43:10 +00:00
Mike Reed
69596470d1 Experimental SkVideoDecoder, to wrap calls to ffmpeg
If you want to build ffmpeg locally, here is how I configured it:
./configure --disable-all --enable-avcodec --enable-avformat --enable-decoder=h264 --enable-parser=h264 --enable-demuxer=mov --enable-static --enable-protocol=file

Bug: skia: 9085
Change-Id: If1892b62314af26e56ecb0293850f7554106c3d0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213664
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2019-05-17 19:18:28 +00:00
Brian Osman
c6568afa0b Remove Nima from DEPS, experiments, Viewer, etc.
Change-Id: Ide69d3c9f0f02e886bd0d52723d425a548edd2e0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/214187
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-05-16 17:02:11 +00:00
Ben Wagner
8bd6e8f198 Move SkTSearch.h into src.
No public headers are using it anymore, so move it from include/private
into src/core where SkTSearch.cpp resides.

Change-Id: I4499c629487ff1b8c391b44708616d67567a3e9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213674
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2019-05-15 14:15:07 +00:00
Mike Klein
ad44dd500f preserve comments past the #include ""
Tacking on parts[2] lets us keep things like IWYU comments

    #include "something.h" // IWYU pragma: keep

Rerun the script too... not much interesting.

Change-Id: I9f02c81ffece0ecf3e99730d4a12d49e01417ddc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/213697
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-05-14 19:35:34 +00:00
Hal Canary
0569447470 experimental/editor: progress
- selection
  - some state moved out of editor.
  - Editor::getPosition() translates x,y mouse position into text
    position
  - General Editor::move() function for moving cursor
  - Editor::insert() (does not yet handle newlines)
  - Editor::remove() (does not yet delete across lines)
  - new StringSlice class to replace SkString.

Change-Id: I1ca03247a745bc045e41619cd5a839c495dc405b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211884
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2019-05-07 18:01:50 +00:00
Ben Wagner
c5eb81bf44 Fixes for experimental/go-skia
No-Try: true
Change-Id: I7799cde0a361984ed958386d2568a959a6cf12ac
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/212024
Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Auto-Submit: Ben Wagner aka dogben <benjaminwagner@google.com>
2019-05-03 19:22:51 +00:00
Ben Wagner
0b9b1f1847 IWYU for SkTLogic.h
Noticed that there was an include for <array> in there that didn't make
a lot of sense, so cleaned up the others which are hanging around from
older code which was in there.

Change-Id: I77acbb0914989e9bf67ab74dfd842a798ea592f3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206172
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-05-02 21:17:37 +00:00
Hal Canary
7b300a4e47 Experimental Editor: begin text selection code
Bug: skia:9020
Change-Id: I6a67ef4a3bcf443dbe14f58e81b405588f84848e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/211345
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
2019-04-30 17:21:52 +00:00
Hal Canary
50d650d3ef Experimental text editor: factor out Editor class.
Change-Id: Ie3ab5566b66f8255097001d015b39ca650cc0f20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210920
Commit-Queue: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2019-04-29 15:43:35 +00:00
Stan Iliev
4732dd3158 Fix C API example
Test: built and ran skia-c-example.c
Change-Id: I5691fa474f3efb6198c389180653ccded67e4f7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210633
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
2019-04-28 01:09:13 +00:00
Hal Canary
b8f81af531 Experimental: text editor
Proof of principle of a text editor written with Skia & SkShaper.

(Work In Progress)

Bug: skia:9020
Change-Id: I4fb837b719bc42fab8d8bdce2ca68fb9c1829d21
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/210381
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-04-25 15:22:49 +00:00
Mike Klein
c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00
Mike Klein
ba201aea74 make -Werror or /WX optional, off by default
Most external users complain about -Werror,
and I've heard anecdotally that devs find it annoying too.

This turns it off by default, but keeps it on the bots.

Change-Id: I6e87c92215261ebf6e961f816177386d5d58f28e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209787
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2019-04-23 20:39:34 +00:00
Brian Osman
c3186302bd Add skcms directory to public includes
skcms is part of Skia's public API now. This attempts to recognize that,
and pave the way for moving the header to another location more easily
in a follow up CL, or - at a minimum - for clients that redistribute
Skia as a library + includes to relocate the skcms.h header as part of
that.

Change-Id: I15da63b0d4ab8916a71fb7e6ab3656db87252707
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209640
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2019-04-22 20:32:23 +00:00
Nathaniel Nifong
26f410d8cf externs needed for cpu/gpu switch
Bug: skia:
Change-Id: I39de7abdc54872ae983bbb8a7e88a8b9d93a952b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206919
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-04-10 13:47:21 +00:00
Nathaniel Nifong
d54b1fcdd9 full collection of externs
Full list of externs that need exposing

Bug: skia:
Change-Id: I9abb3d2c595d213463f69f11b1164c965d036023
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206690
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-04-09 18:37:18 +00:00
Nathaniel Nifong
4c30340358 add SkpFilePlayer to externs
Bug: skia:
Change-Id: I190b6ac004f68f699cab2ec38b7af25e5113e335
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206680
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-04-08 17:57:04 +00:00
Nathaniel Nifong
298390e487 Add helper for loading files, use let
Bug: skia:
Change-Id: I2da7325f5cfbd451358e183e24dcf21278615eb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206200
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-04-05 18:31:53 +00:00
Kevin Lubick
c7755d9470 [canvaskit] Bump GPU resource cache to 256MB
Wrong file was previously edited.

Change-Id: I2e78d102ca85a22268481d1958b983e41d72ee3e
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206271
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-05 18:06:18 +00:00
Kevin Lubick
e21616804a [canvaskit] Bump GPU resource cache to 256MB
Change-Id: I057c1af8bd7789433ac41904c45a3f8ba2fdb7e9
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206078
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-04-04 18:04:39 +00:00
Mike Reed
fae8fceb4a Use SkTileMode instead of nested enum
Add guard to transition clients

Change-Id: Ia7a3e8f95722f91e84af262168dadf89a78707da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205720
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2019-04-03 15:24:18 +00:00
Nathaniel Nifong
63f8e0a3a9 Include wasm debugger in continuous build
Bug: skia:
Change-Id: Ic51ef5706bff66482127e648f2cb9ca0826ef4ca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205260
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-04-01 18:50:13 +00:00
Nathaniel Nifong
de5df65812 changes to wasm debugger for UI integration
Bug: skia:
Change-Id: I8f00cbb6682c1fdf6c1bb5eb118a00f38b7005f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203730
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-28 18:06:13 +00:00
Kevin Lubick
3902628e35 Support WebGL 1.0 with caps
There is some logic in here for 2.0 as well, just as a
"as long as I was looking at the specs", but only 1.0
is really supported.

This seems to resolve the bug where some GPUs weren't
advertising correctly that they had vertex array object
support, by checking for both extension names (with and
without "GL_" prefix)

Of note, this saves about 18 Kb (5.5 Kb gzipped) of code size
by compiling out the unneeded GLES checks/functionality.

Bug: skia:8378
Change-Id: I773bf4dbf231b991051d2a9f640b8047a9010e7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203461
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-28 17:21:23 +00:00
Mike Klein
e5acd7547b delete DAA
Change-Id: I1fd8cba067c0063c6621641e8196e69fd5e31cec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203080
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2019-03-22 15:44:03 +00:00
Mike Klein
8f4e224541 de-Sk tools/debugger
Change-Id: I489a54860139d1820471aa0330b29a8ae9eca31e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202316
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-20 18:27:01 +00:00
Nathaniel Nifong
46f5ee1561 Add selectable GPU backend to wasm debugger
Bug: skia:
Change-Id: If34e08cb320a141cb838caafeffa4f1f69c5234f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/201404
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-15 15:34:28 +00:00
Nathaniel Nifong
cfdf87ecd2 fill out more of SkDebugCanvas interface
Added methods for toggling clip viz, overdraw viz, gpu bound viz.
methods for getting number of commands, toggling command visibility and deleting commands.
Added method for writing out json command list.

bound methods with emscrpiten and connected up to buttons in barebones interface to prove they're working.


Bug: skia:
Change-Id: I3f733b13db00ce5d14b1b5170de8fb66102c8b14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199938
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-14 13:50:24 +00:00
Kevin Lubick
3f67f411d8 [canvaskit] Move from experimental to modules
Bug: skia:
Change-Id: I2ffd54cf81c974f3a80103e1726a06067cc90d82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200044
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-03-11 21:09:52 +00:00
Kevin Lubick
d8c42b0491 [canvaskit] roll on npm
Bug: skia:
Change-Id: I8efc4a02ada94557c65addccca093252942ca558
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/199250
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-11 12:43:35 +00:00
Kevin Lubick
543f352ace [canvaskit] Expose more options for working with Surfaces and Contexts
PS1 is mostly from luigi@2dimensions.com, with slight re-naming
tweaks (thanks!).

With the exposition of these extra methods, MakeWebGLCanvasSurface
is now really just a convenience function.

Bug: skia:
Change-Id: Ie61657bc580146e3e759fae8620e4df0c0212f62
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198720
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-08 18:22:43 +00:00
Florin Malita
4968ad72d6 [canvaskit] Clean up Skottie sources list
Bug: skia:
Change-Id: Ia237710d0d3a64d66750d024bd544cb39fde1e90
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198662
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-07 17:11:39 +00:00
Kevin Lubick
f2aaa0815b [canvaskit] more testing logs
Bug: skia:
Change-Id: Iaf6210f58cad82648756b7593d09396aeaf3a7fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198660
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-07 16:54:13 +00:00
Kevin Lubick
ec841f71ee [canvaskit] Increase timeout and add logging to further diagnose test flakiness
Bug: skia:8810
Change-Id: Ie1ddbd70a7521aaf7bd0e9fda7ad7a53a01db4b7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198600
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-07 15:08:16 +00:00
Nathaniel Nifong
e0aa7605f2 Interface for passing skp file from JS to WASM
Bug: skia:
Change-Id: I20d61933dd11c4cc7cc64baee8abf93372124cdd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198166
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-03-06 19:04:33 +00:00
Kevin Lubick
cb4eb612f0 [canvaskit] Remove additional copies of CanvasKit when testing
Speculative fix for flaky test bot. My guess is that since there were
3 .spec.js that were all trying to load CanvasKit at the same time, the
browser would fail to compile/process all that WASM and timeout.

This cleans it up so there's only one copy of CanvasKit shared by all
tests.

Bug: skia:8810
Change-Id: I60a77dae93b7c3e5d45923b4af93a223ac26220c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198161
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
2019-03-06 16:03:00 +00:00
Kevin Lubick
269fe89950 [canvaskit] Add particles integration
Bug: skia:
Change-Id: I5bf08e8007b59b5e21005f5004d698e53b99ffe6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197849
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2019-03-06 14:52:56 +00:00
Nathaniel Nifong
1523963d4f Basic wasm skp debugger unit test
Bug: skia:
Change-Id: I91a3f40279724a29d759229c012be864d8a02edd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197765
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2019-03-06 14:41:17 +00:00
Kevin Lubick
b3574c904f [canvaskit] Add some APIs for speed and clients
isVolatile = false may make drawing some meshes faster.

saveLayer can be used to draw more rich effects.

Bug: skia:
Change-Id: If26f30cebba2a45f7519dd934eab02597cd6d2dc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197851
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-06 13:54:19 +00:00
Nathaniel Nifong
ad5f6cdb7e Initial wasm debugger
Bug: skia:
Change-Id: I4d38e60f03bb315dee9c9db655ce168e9b3b475f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/195580
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-05 16:10:15 +00:00
Ben Wagner
a1810551f2 Add fetch-gn to canvaskit and cmake compile scripts
If fetch-gn is omitted, the scripts fail in a clean checkout.

Change-Id: Idc944f7e8c5cd2ca998ab685b942df280e17dbab
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/197207
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Auto-Submit: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-05 16:03:27 +00:00
Greg Daniel
bae712104d Add flush call to take access type, flags, and semaphore.
Bug: skia:
Change-Id: I5e664939a446616ef57acc79d26a10e6908cda10
Reviewed-on: https://skia-review.googlesource.com/c/196643
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
2019-03-02 03:45:36 +00:00
Kevin Lubick
53169df243 [canvaskit] Roll 0.4.1
Bug: skia:
Change-Id: I7d2750967ea5da83427a186b8fdd23d5d4aa69f2
Reviewed-on: https://skia-review.googlesource.com/c/196640
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-01 16:24:13 +00:00
Florin Malita
a8c728f080 [canvaskit] Ignore image paths in Skottie asset keys
The name should be sufficient.

Change-Id: I451ae4a0f8d0f0864f07abc0405b591a6e2ca769
Reviewed-on: https://skia-review.googlesource.com/c/196506
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-03-01 14:39:29 +00:00
Florin Malita
71a23d4195 [canvaskit] Consolidate Skottie assets
- use a single name -> SkData map for both images and fonts

 - consolidate images/fonts as a generic "assets" API

 - pass pre-constructed asset maps to the SkottieAssetManager factory
   and remove setter (immutable class at this point)

Bug: skia:
Change-Id: Ief6d3bcbba339ccd1d81fd9950871eaa691ee947
Reviewed-on: https://skia-review.googlesource.com/c/196503
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-03-01 13:14:12 +00:00
Kevin Lubick
88aff5fecd [canvaskit] Add support for external fonts
We ignore the url for web fonts, as we assume the names
will not collide.

Bug: skia:
Change-Id: Ifaaa0d27e0de2c5088bc0885c9299bb83ee78a5d
Reviewed-on: https://skia-review.googlesource.com/c/196426
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-02-28 21:24:52 +00:00
Kevin Lubick
f5ea37f981 [canvaskit] Support image assets for Skottie
There's a lot of refactoring here to fix up the
namespace of the JS (see pre/postamble js).

A reviewer can skip all the changes to interface.js,
as they are mostly whitespace changes.

Bug: skia:
Change-Id: I7cedeb98f04d4446ac4dfb555a416f30490b2b94
Reviewed-on: https://skia-review.googlesource.com/c/195885
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-02-28 15:56:09 +00:00
Kevin Lubick
dc822b1c9e update canvaskit docs to new API
Also add a dynamic text shaping demo

No-Try: true
Docs-Preview: https://skia.org/?cl=195440
Bug: skia:
Change-Id: I1e220cecae080a6a643fed8a1b9771ba8fe60915
Reviewed-on: https://skia-review.googlesource.com/c/195440
Reviewed-by: Heather Miller <hcm@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-02-27 16:30:29 +00:00
Kevin Lubick
2722083cbe [pathkit][canvaskit] roll versions
This removes the buggy .then() constructor, primarily.

Docs-Preview: https://skia.org/?cl=195126
Bug: skia:
Change-Id: Ie20512267ce3f822eb0d68e71fc07f3d3245c1e9
Reviewed-on: https://skia-review.googlesource.com/c/195126
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Commit-Queue: Joe Gregorio <jcgregorio@google.com>
2019-02-25 21:53:53 +00:00
Kevin Lubick
867da4b96e Allow system harfbuzz.
This should allow shaper to run on the no-deps bot.

Change-Id: I2515875d4e9b428681c20877630b904c3229ecc5
Reviewed-on: https://skia-review.googlesource.com/c/194420
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
2019-02-23 12:14:30 +00:00
Florin Malita
a753d1a347 Reland "[skottie] Add tritone layer effect support"
This reverts commit 42ee4028a9.

Original change's description:
> Revert "[skottie] Add tritone layer effect support"
> 
> This reverts commit 71c70ea13e.
> 
> Reason for revert: broke WASM builds
> 
> Original change's description:
> > [skottie] Add tritone layer effect support
> > 
> > Generalize sksg::TintColorFilter into GradientColorfilter, to support
> > multiple color interpolation ranges.
> > 
> > Keep the two-color/single-matrix (tint) specialization, and use a table
> > color filter for the general case.
> > 
> > Change-Id: Idf42833462127c29fb69fe94337a1d1478b77dd9
> > Reviewed-on: https://skia-review.googlesource.com/c/194024
> > Reviewed-by: Mike Reed <reed@google.com>
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> 
> TBR=fmalita@chromium.org,reed@google.com
> 
> Change-Id: Id5bd99701f74fbd4f54d0aca74e753b7ab88bdb3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/194429
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@chromium.org>

TBR=fmalita@chromium.org,reed@google.com

Change-Id: Ie7fc28ff784b91f01108415e50677e8982ccf858
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/194430
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2019-02-22 23:11:02 +00:00
Kevin Lubick
1ba9c4df77 [canvaskit] JS API in place for shaped text
Depends on https://skia-review.googlesource.com/c/skia/+/186870

It's optional at build time, which is good given that
it adds about 2MB of uncompressed size (from 4.3 MB to 6.4 MB)

Bug: skia:
Change-Id: I5f54ad628b735c3bc880e917394fb27d16849ebe
Reviewed-on: https://skia-review.googlesource.com/c/187924
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-02-22 15:39:55 +00:00
Kevin Lubick
2031f34a77 [canvaskit] Upgrade emscripten to .27
This should have some slightly better, more minified JS and other
bugfixes

Bug: skia:
Change-Id: I7c5367b6650267ec8bafcc5de9e351bd8788392b
Reviewed-on: https://skia-review.googlesource.com/c/193582
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2019-02-21 14:13:00 +00:00
Florin Malita
e29d579d15 [canvaskit] Add SkShaper to build list
In preparation for https://skia-review.googlesource.com/c/skia/+/183387

Bug: skia:
Change-Id: I1ce6db39fb722a9e2f2f989293cc4b61588efac3
Reviewed-on: https://skia-review.googlesource.com/c/186085
Auto-Submit: Florin Malita <fmalita@chromium.org>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-01-23 17:04:11 +00:00
Kevin Lubick
ec4903d515 [canvaskit] Use textblob
Removes old API and replaces with new version.
drawText now requires SkFont and other changes.

Bug: skia:
Change-Id: Ie42a5243629542934c761223ed2e8dc6685d3572
Reviewed-on: https://skia-review.googlesource.com/c/183389
Reviewed-by: Mike Reed <reed@google.com>
2019-01-14 14:12:59 +00:00
Kevin Lubick
da3d8acce5 [canvaskit] Add path/canvas methods
ToCmds/MakePathFromCmds taken from PathKit, as were the tests
for those methods.

Bug: skia:
Change-Id: I9c52c04fe61e8934543a10f84ebf8b01b449f7f4
Reviewed-on: https://skia-review.googlesource.com/c/181565
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-01-07 16:32:57 +00:00
Kevin Lubick
faa73875d2 [*kit] fulfil promise immediately
I think this would only commonly happen for cases which files aren't
being loaded (debug asmjs), but could happen if multiple ready() calls
are made (which is discouraged).

Bug: skia:
Change-Id: If848aad8603f997661502563136ac590cc9a6d5a
Reviewed-on: https://skia-review.googlesource.com/c/181409
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2019-01-07 03:29:04 +00:00
Kevin Lubick
65846c04e0 [canvaskit] Add .ready() which is a real promise
Prior to this, CanvasKit was unintentionally a thenable, which means if
it was used to resolve a Promise, certain logic would be called which
would put it into an infinite loop. By adding a .ready() which returns
a proper Promise and removes the .then(), this should make the CanvasKit
libary safer.

For now, the .then() still exists unless .ready() is called. .then will
be removed unconditionally in 0.4.0 which will be out after all known
clients (e.g. jsfiddle.skia.org) are changed.

See: https://github.com/kripken/emscripten/issues/5820

Bug: skia:
Change-Id: Ie4093f6b0ce03070ef737941693b06dfff93f61c
Reviewed-on: https://skia-review.googlesource.com/c/181177
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2019-01-04 19:48:19 +00:00
Kevin Lubick
5f1692c60a [canvaskit] Allow providing webgl context and canvas element
Maybe one day we'll want to expose makeWebGLContext too, thus
it takes in the attrs as a configurable parameter.

Bug: skia:
Change-Id: Idb38f932b5ea6b364d823283b262e8508bff07c4
Reviewed-on: https://skia-review.googlesource.com/c/180776
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2019-01-04 12:58:05 +00:00
Kevin Lubick
4683942a45 [canvaskit] Refactor skottie into own file
Just to clean things up a bit.

Bug: skia:
Change-Id: I0e34c148a92817084348fcf62d9f513887933cb3
Reviewed-on: https://skia-review.googlesource.com/c/180768
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-01-03 21:10:05 +00:00
Kevin Lubick
35ac038ce0 [canvaskit] Move to using SkFont instead of SkPaint.measure*
Bug: skia:
Change-Id: I72a744f58072f0bc5f9cad561c4367ff5d32e5ab
Reviewed-on: https://skia-review.googlesource.com/c/180643
Reviewed-by: Mike Reed <reed@google.com>
2019-01-02 20:52:35 +00:00
Kevin Lubick
ffde0f63dd [canvaskit] Get docs ready for npm release
Bug: skia:8584
Change-Id: I290f13e3e05af202f2ffd33f7d9b9361efa80e46
Reviewed-on: https://skia-review.googlesource.com/c/178270
Reviewed-by: Heather Miller <hcm@google.com>
2018-12-18 12:56:18 +00:00
Kevin Lubick
a40f832ae1 [canvaskit] Add Path2D to Canvas API
This moves the shared logic into path2d.js from
canvas2dcontext.js.

Bug: skia:
Change-Id: Id63bc52a190109f7cbc4e17ddb5603e6e87d5dc0
Reviewed-on: https://skia-review.googlesource.com/c/178268
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-12-17 21:19:48 +00:00
Kevin Lubick
fa720714c4 [canvaskit] Add files needed for npm release
Backport changes to pathkit too.

Bug: skia:
Change-Id: Id10f9ac52dc7d08f044eee1eeacc8737f1cd96f4
Reviewed-on: https://skia-review.googlesource.com/c/177894
Reviewed-by: Heather Miller <hcm@google.com>
2018-12-17 17:21:34 +00:00
Kevin Lubick
a96ec09599 [canvaskit] Performance tuning of GL calls
Don't check glerror on texture creation.

Initialize before texSubImage2D calls, especially for drawPath
(dramatic Firefox improvement).

Bug: skia:
Change-Id: Iec39fd84fffb886e5ecccf782fe75d419e4255d0
Reviewed-on: https://skia-review.googlesource.com/c/177893
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-17 16:28:30 +00:00
Kevin Lubick
8e4a331c8a [canvaskit] Canvas API for loading fonts
There's the barest hint of a "font manager" here.
Basically, nothing smart to deal with bold or fallbacks.

Maybe one day, we'll expose
SkTypeface* matchStyleCSS3(const SkFontStyle& pattern);

and do smart things for fallbacks, but for now that's not
in the immediate future.

Docs-Preview: https://skia.org/?cl=177067
Bug: skia:
Change-Id: Iaeabcbf5ff4511a01b37c16c983e447c25b0e3e7
Reviewed-on: https://skia-review.googlesource.com/c/177067
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-12-14 21:32:21 +00:00
Kevin Lubick
2b79d1ce45 [canvaskit] Expose setVolatile (especially for animations)
Bug: skia:
Change-Id: Ifd8ef390d1b9a102baaa89804b9f6d11e8f39955
Reviewed-on: https://skia-review.googlesource.com/c/177882
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-12-14 21:24:46 +00:00
Kevin Lubick
d090a706bd [canvaskit] Correctly translate between shadow radius and sigma
Bug: skia:
Change-Id: I7e069407334f8b0238fd6d9f529cdf30e3e269be
Reviewed-on: https://skia-review.googlesource.com/c/176960
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-12 15:40:08 +00:00
Kevin Lubick
ddd0a333f4 [canvaskit] Allow users to load their own fonts
Instead of using the test font(s), now ship with a small
(100k) Monospace font. This can be disabled by:
    compile.sh no_font ...

This saves about 350k (164k gzipped) in binary size.

Bug: skia:
Change-Id: I195e3b35bea86d0f096066c1c6a44a4b602571f3
Reviewed-on: https://skia-review.googlesource.com/c/176580
Reviewed-by: Ben Wagner <bungeman@google.com>
2018-12-12 15:40:08 +00:00
Kevin Lubick
53eabf6871 [canvaskit] Refactor Canvas2D JS into own files
Rather than one monolithic file, we now have one monolithic
file (canvascontext2d) and several smaller files (one per class,
and some helpers).

This should make the code navigation a little easier.

Bug: skia:
Change-Id: Ia191c2db778591af21d2a6126f053c17c4f677f1
Reviewed-on: https://skia-review.googlesource.com/c/175996
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-11 12:02:27 +00:00
Kevin Lubick
5d5723c1d8 [canvaskit] Refactor with getTotalMatrix
Follow up from https://skia-review.googlesource.com/c/skia/+/174843

Bug: skia:
Change-Id: I3b99d8550ecdf8085e11b6fbfbb304c857061149
Reviewed-on: https://skia-review.googlesource.com/c/175583
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-07 18:59:54 +00:00
Kevin Lubick
1646e7d715 [canvaskit] Add isPointInPath / isPointInStroke
While working on this, I realized some things I did
caused winding to be inconsistent with what the Canvas
spec said (and with what Chrome did).

This CL includes 2 changes to remedy that:
 - removal of the subpath (which added needless complication).
 - re-write of ellipse() (to mirror Chrome's implementation).

Bug: skia:
Change-Id: Idd6c8a40b3c46598892e50a1e586f2ff66b801e3
Reviewed-on: https://skia-review.googlesource.com/c/175425
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-07 18:58:48 +00:00
Kevin Lubick
d29edd77f5 [canvaskit] Add createPattern support to canvasAPI
Add Changelog to start tracking API changes (in preparation
for NPM)

Simplify globalAlpha passing.

API change:
 - Make ImageShader take an SkImage instead of encoded bytes.

Bug: skia:
Change-Id: I716f001b54ed58da3f40ae4e060b7098b550af9f
Reviewed-on: https://skia-review.googlesource.com/c/175260
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-07 14:14:37 +00:00
Kevin Lubick
ae9dfc0e58 [canvaskit] In Canvas2d, move matrix to internal canvas
This is similar to how Chrome does it - more or less unapplying
the matrix as it changes to keep everything in the same
coordinate space.

We still need to keep the matrix around for things and do the math
ourselves for things like gradients.

This simplifies a bunch of logic, which makes me happy.

Bug: skia:
Change-Id: I66ee379a501cc6701f51c0f0b51d4e0634a4a692
Reviewed-on: https://skia-review.googlesource.com/c/174843
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-12-06 17:03:46 +00:00
Hal Canary
b45d512481 bin/sysopen: script moved to bin
No-Try: true
Change-Id: I1b9b1be36c9ed2d574de681b90b98e56f45e70fa
Reviewed-on: https://skia-review.googlesource.com/c/174588
Auto-Submit: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-06 14:21:33 +00:00
Hal Canary
ed18c93d1e bin/gerrit-number (no longer experimental)
Change-Id: Iadbef27074201173be2c71447c5d6f721afffbb3
Reviewed-on: https://skia-review.googlesource.com/c/174585
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-12-05 16:47:29 +00:00
Hal Canary
e0dc346d9e experimental/tools/gerrit-change-id-to-number: cleanup
No-Try: true
Change-Id: I684e681ec38769f5c9b5d66c0190fb08f28ff367
Reviewed-on: https://skia-review.googlesource.com/c/174581
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
2018-12-05 16:05:14 +00:00
Kevin Lubick
92d8ea6f99 [canvaskit] remove setMatrix
Bug: skia:
Change-Id: I9fc895e8b499fec8d72dfcd794c705380108bf9b
Reviewed-on: https://skia-review.googlesource.com/c/174314
Reviewed-by: Mike Klein <mtklein@google.com>
2018-12-04 21:32:45 +00:00
Kevin Lubick
52b9f370b3 [canvaskit] Support getImageData/putImageData
setMatrix -> _setMatrix with the hope of removing it
from the API (it breaks the save()/restore() model) and
replacing it with concat (which I'll try in a follow on CL).

Adds MakeImage for those times when a client has pixels
and needs to clip them (e.g. putImageData with 7 args).

This removes SkSurface._readPixels, which I might have
been holding wrong. It might get re-surfaced eventually.

Bug: skia:
Change-Id: Iee9a494db720b22e23f9e674b20ba678fad91d25
Reviewed-on: https://skia-review.googlesource.com/c/174300
Reviewed-by: Mike Klein <mtklein@google.com>
2018-12-04 20:40:14 +00:00
Mike Klein
2d9e543a58 some SkAtomics cleanup
- Replace sk_memory_order with std::memory_order.
 - Remove SkAtomic<T>.

SkPath was the only user of SkAtomic<T>, for its fConvexity and
fFirstDirection fields.  I've replaced them with std::atomic types, and
funneled access to them through methods that enforce the relaxed memory
order like SkAtomic<T> did.

For fConvexity, we can use the exisiting setConvexity() and
getConvexityOrUnknown() methods, adding a private const setConvexity()
to mutate convexity from const methods.  For fFirstDirection I've added
private setFirstDirection() and getFirstDirection() methods.

Removing SkAtomic<T> means SkAtomics.h no longer needs SkNoncopyable.h.
I've had to update a bunch of other headers that were depending on
transitive inclusion.

Change-Id: Ib238be71a121519db6e970a9a8955834e1298c87
Reviewed-on: https://skia-review.googlesource.com/c/174220
Commit-Queue: Brian Salomon <bsalomon@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-12-04 13:53:39 +00:00
Kevin Lubick
f9910ea258 [canvaskit] Add profile mode
Firefox is the only browser that supports WASM+Source maps
so it's only really useful there.

It allows for profiling to see where time is speant, even
down in the C++ calls.  (see the below comment for a screenshot)

Bug: skia:
Change-Id: Ie0380bae9fdea45e1652dd7d2d8036f242087d33
Reviewed-on: https://skia-review.googlesource.com/c/174101
Reviewed-by: Mike Reed <reed@google.com>
2018-12-03 20:43:17 +00:00
Florin Malita
6ba8c7ea84 [skottie] Surface composition markers in CK
Change-Id: Ie53c81f4dbe981327469d8a9990d27f8a41d8b4c
Reviewed-on: https://skia-review.googlesource.com/c/173983
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-12-03 20:12:10 +00:00
Kevin Lubick
7a1b845f2f [canvaskit] remove POC Nima code
Now that drawVertices is exposed, no need to keep this around as a demo

Docs-Preview: https://skia.org/?cl=173994
Bug: skia:
Change-Id: I6293c8e2038ece27635d254db097e651c9d77a94
Reviewed-on: https://skia-review.googlesource.com/c/173994
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-12-03 19:31:09 +00:00
Kevin Lubick
0a1293c2e4 [canvaskit] Add drawImage support
Adds drawImageRect as well.

Bug: skia:
Change-Id: Ib74f92a3ee22664297d8ce7ff1d2cd2644b806b7
Reviewed-on: https://skia-review.googlesource.com/c/173990
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-12-03 18:47:29 +00:00
Florin Malita
91af8d8202 [skottie] Expose composition markers to embedders
Add a MarkerObserver interface (to replace the current
AnnotationObserver), and update CustomPropertyManager to intercept both
properties and markers.

TBR=
Change-Id: If79de419066916bc596316f0a551c75564069239
Reviewed-on: https://skia-review.googlesource.com/c/173766
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-12-01 04:44:03 +00:00
Kevin Lubick
ea905ec333 [canvaskit] Save a copy on CPU backend by using RasterDirect
Draw directly into an unpremul buffer (which is what Canvas's
get/putImageData is) and it speeds up Skottie animation by
about 3x.

Bug: skia:
Change-Id: Ie131276e3a675e0e5a35190da93f34d7469624e4
Reviewed-on: https://skia-review.googlesource.com/c/173644
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-30 19:29:25 +00:00
Kevin Lubick
dee08d8f65 [canvaskit] Fix conversion of large images to base64
Bug: skia:
Change-Id: I8ab40a382557ae6bd13884ddce027e51ce1fb21f
Reviewed-on: https://skia-review.googlesource.com/c/173701
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-30 18:43:37 +00:00
Kevin Lubick
eb2f6b0adb [canvaskit] Add gradients and clips
Refactors things inside to support both color
and gradient as _fillStyle/_strokeStyle.

Bug: skia:
Change-Id: I364ceb7d55c41e11161d5577dcd1611a592bbc29
Reviewed-on: https://skia-review.googlesource.com/c/173421
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-30 13:06:07 +00:00
Florin Malita
c2e85f942f [skottie] Expose property bindings in CK
Add a new (optionally-built) ManagedAnimation CK helper, and provide
accessors for color and opacity properties.

The new wrapper class can be used as a drop-in replacement for the existing
Animation.

Change-Id: Iab6b6be9c736697b4731722806b145cbd130ce73
Reviewed-on: https://skia-review.googlesource.com/c/173322
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-29 17:09:35 +00:00
Kevin Lubick
43ff69a83f [canvaskit] Fix arc() call
Bug: skia:
Change-Id: I7a06b4bd5d2e88b12b08b0568301515653512ebb
Reviewed-on: https://skia-review.googlesource.com/c/173236
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-28 20:52:09 +00:00
Kevin Lubick
12c0e50fda [canvaskit] support globalAlpha and dashed strokes
This involves a refactor of how we deal with paint.
Now, we have a source-of-truth paint that is copied
and modified for each of fill/stroke/shadow.

Adds preliminary support for blend modes.

Most of what remains is text, images, and gradients.

Bug: skia:
Change-Id: I41806adeb7de4faa6c98a580c4f1de4e4a34a37d
Reviewed-on: https://skia-review.googlesource.com/c/173223
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-28 19:03:19 +00:00
Kevin Lubick
61ef7b2589 [canvaskit] Add shadow and save/restore support
This also exposes the ShadowUtils::drawShadow on Canvas,
even though it wasn't what was needed to duplicate
the Canvas effect.

Bug: skia:
Change-Id: I12276ef106244218e4827b7fcd7949c83cf13e5f
Reviewed-on: https://skia-review.googlesource.com/c/172967
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-27 18:56:09 +00:00
Kevin Lubick
b9db3906d5 [canvaskit] Make transforms work properly
This re-works the subpath model and does transforming
of ports in JS rather than in C++; the latter was not easy
to conform to the Canvas Spec, especially for changing
transforms in the middle of a path.

Additionally adds jpeg to the available images it can produce.

Bug: skia:
Change-Id: I5a52ec341d4060198c8680aa4d3b85a26f77b6b9
Reviewed-on: https://skia-review.googlesource.com/c/172500
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-26 17:16:42 +00:00
Mike Reed
114bde830b Revert "Revert "add rect-parameter to makeImageSnapshot""
This reverts commit 1e28e5d79e.

Bug: skia:
Change-Id: I71c246885721c71de540e9079ecf7323234c8871
Reviewed-on: https://skia-review.googlesource.com/c/172302
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-21 14:46:06 +00:00
Kevin Lubick
6fccc9db67 [canvaskit] Add debug-mode only logs
And a fix for node.

Docs-Preview: https://skia.org/?cl=172143
Bug: skia:
Change-Id: I519c2693b386aa68655f235281d932ee5fffbc61
Reviewed-on: https://skia-review.googlesource.com/c/172143
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-20 22:22:04 +00:00
Kevin Lubick
b07204a6f9 Add software backend to gpu build
Bug: skia:8548
Change-Id: If3853711f4b183f3b0437ae2b31525b0e6c88213
Reviewed-on: https://skia-review.googlesource.com/c/172120
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-20 19:41:27 +00:00
Kevin Lubick
1a05fceb38 [canvaskit] Expand canvas2d API
Made addPath take one more arg to allow for append/expand
(which makes emulating the HTML canvas easier).

Add Gold test for various lineTo/pathTo, etc.

Make CanvasKit.Color() choose a better value for alpha
when omitted (was 0, should be 1).

Add some parsing logic to deal with colors/font sizes.
Fonts are going to be rather complex it seems.

Moves some arc-related logic to the JS side, (although
this should preserve the behavior of CanvasKit.arc() to
behave like the Canvas implementation)

Make Examples and tests to a side-by-side comparison to
HTML canvas where applicable.

Add a Changelog for PathKit.  There was a bug (I thought), but
turns out I was wrong.  The Changelog will be for future
bug fixes.

Bug: skia:
Change-Id: I1bd603fdb518232604b098e24543e3453015b504
Reviewed-on: https://skia-review.googlesource.com/c/170446
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-20 18:39:43 +00:00
Alexander Khovansky
3e11933765 [canvaskit] Exposed SkPath::arc. Exposed SkEncodedImageFormat enum. Exposed SkImage::encodeToData overload with arguments
These changes expose the arc function for SkPath. The ApplyAddArc function is a copy from the PathKit bindings.

Also exposed the PNG and JPEG formats from the SkEncodedImageFormat enum and the SkImage::encodeToData overload that accepts format and quality options. The direct binding of encodeToData was replaced with a pre-js wrapper that calls the appropriate private overload

We are working on a PostCSS conic gradient polyfill plugin and want to use the CanvasKit to generate it.
Problem is - it lacks the arc function that technically exists but isn't exposed. And it would be really great to have encodeToData with options since generated PNGs are quite large.
More details on the issue can be found here: https://github.com/jonathantneal/postcss-conic-gradient/issues/10

R=kjlubick@google.com

Bug: skia:
Change-Id: I3f1dc88ad308369fe62004080bcc196c4fbbf742
Reviewed-on: https://skia-review.googlesource.com/c/171046
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-11-15 02:52:02 +00:00
Mike Klein
54378230f8 Reland "simplify disabling effect deserialization"
This reverts commit 34d7a163a4.

Reason for revert: ok now?

Original change's description:
> Revert "simplify disabling effect deserialization"
>
> This reverts commit 5bbf790b5b.
>
> Reason for revert: flutter GN needs some love
>
> Original change's description:
> > simplify disabling effect deserialization
> >
> > Switch to a simple #define instead of conditional build targets.
> >
> > No one changes skia_enable_effects or skia_enable_effects_imagefilters,
> > so we can merge all that together back into :skia.
> >
> > Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
> > Reviewed-on: https://skia-review.googlesource.com/c/169220
> > Reviewed-by: Kevin Lubick <kjlubick@google.com>
> > Commit-Queue: Mike Klein <mtklein@google.com>
>
> TBR=mtklein@google.com,kjlubick@google.com
>
> Change-Id: I3b818418d303dbc6d2a926a19df64a68499f0ec3
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/169222
> Reviewed-by: Mike Klein <mtklein@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Cq-Include-Trybots: skia.primary:Build-Debian9-Clang-arm-Release-Flutter_Android
Change-Id: I534346c3ef3561a871f1af6df976bfee0b48014a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/169640
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-11-08 14:26:52 +00:00
Mike Klein
34d7a163a4 Revert "simplify disabling effect deserialization"
This reverts commit 5bbf790b5b.

Reason for revert: flutter GN needs some love

Original change's description:
> simplify disabling effect deserialization
> 
> Switch to a simple #define instead of conditional build targets.
> 
> No one changes skia_enable_effects or skia_enable_effects_imagefilters,
> so we can merge all that together back into :skia.
> 
> Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
> Reviewed-on: https://skia-review.googlesource.com/c/169220
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Commit-Queue: Mike Klein <mtklein@google.com>

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

Change-Id: I3b818418d303dbc6d2a926a19df64a68499f0ec3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/169222
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-07 18:52:19 +00:00
Mike Klein
5bbf790b5b simplify disabling effect deserialization
Switch to a simple #define instead of conditional build targets.

No one changes skia_enable_effects or skia_enable_effects_imagefilters,
so we can merge all that together back into :skia.

Change-Id: I2985f95ee89149ddc687dc31f4c6bf35cb3a93c7
Reviewed-on: https://skia-review.googlesource.com/c/169220
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-11-07 18:20:23 +00:00
Kevin Lubick
e5a06e7bd3 [canvaskit] Update examples after enum name change
Docs-Preview: https://skia.org/?cl=169186
Bug: skia:
Change-Id: I083a07cc44e1534f4aeedc4e25e8ed786e29f168
Reviewed-on: https://skia-review.googlesource.com/c/169186
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-07 15:45:14 +00:00
Kevin Lubick
e71e9ef311 [canvaskit] Add catchException everywhere
This should make the logs in the bots more actionable by showing
the error and trace.

This also fixes the API change causing mysterious red.

Bug: skia:
Change-Id: I38df2bb4557041f8bdfefcae5c8d95b58e770033
Reviewed-on: https://skia-review.googlesource.com/c/168180
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-11-05 13:07:02 +00:00
Kevin Lubick
b5ae3b5afc [canvaskit] Add drawVertices API
This also does some clean up to how we name enums - the caps felt a bit
obnoxious. CAPS are reserved now for constants (like colors).

Small bug fix with leaking memory on discrete path effects

This also adds a few more things from PathKit

Bug: skia:
Change-Id: Iad7e21ac36d35a36a8b255dc82b1dcc886344db1
Reviewed-on: https://skia-review.googlesource.com/c/166804
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-11-03 12:18:04 +00:00
Mike Reed
f67b1620aa add pvg experiment
Bug: skia:
Change-Id: I4b7e512e6ee8e4da4ab96924acc034355ae6b8bf
Reviewed-on: https://skia-review.googlesource.com/c/167101
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-11-02 15:35:21 +00:00
Hal Canary
a0a6fe44fc experimental/tools/generate-unicode-test-txt: update
No-Try: true
Change-Id: Ie904a1493570e7f2d50ab2e79c30951610641428
Reviewed-on: https://skia-review.googlesource.com/c/166802
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
2018-10-31 17:05:54 +00:00
Kevin Lubick
134be1d9ba [canvaskit] Expose nima animation as POC
Still to come, actually exposing drawVertices, and the
other APIs needed.

Had to re-make all the jsfiddles because of an API change
in a previous CL.

Docs-Preview: https://skia.org/?cl=166444
Bug: skia:
Change-Id: I4d4825f6e7b073d6792ab8d99d5117df860d4815
Reviewed-on: https://skia-review.googlesource.com/c/166444
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-30 20:15:28 +00:00
Kevin Lubick
d969932474 Refactor Nima code
There were two copies of a Nima "player" and this moves them out of
samplecode/ and viewer/ to experimental/ where it is a bit more
accessible (e.g. for WebAssembly).

Bug: skia:
Change-Id: I05419a352f0d13d16b462a374578107513eb1243
Reviewed-on: https://skia-review.googlesource.com/c/166441
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-30 19:32:52 +00:00
Kevin Lubick
2cf29ce4db [canvaskit] Remove ReadBuffer
Takes about 20kb off uncompressed size, 8kb gzipped.

Also turns off AAA and DAA on CPU builds (already off on GPU)

Bug: skia:
Change-Id: I708038394b61cc8eb7944d5ad1a3bb494db6c719
Reviewed-on: https://skia-review.googlesource.com/c/165100
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-25 19:17:59 +00:00
Kevin Lubick
006a6f3b14 [canvaskit] Fleshing out the beginnings of a Canvas API
I can probably write most, if not all, of a Canvas API in
JS using the SkCanvas and SkPaint objects. This lets us expose
the fancier API and optionally have a more familiar API.

This is controlled at compile time, i.e. bring in the extra
JS or not.

There is still plenty of the API that needs working, but
this is meant to outlay the plans of where this is going.

Bug: skia:
Change-Id: I2e36a33c24c2bacd52811dc85508dba170ab0dd7
Reviewed-on: https://skia-review.googlesource.com/c/163490
Reviewed-by: Mike Reed <reed@google.com>
2018-10-22 18:02:09 +00:00
Kevin Lubick
9e40e6fa79 Give attribution
Bug: skia:8488
Change-Id: If96c6bb500ceb0bf4b41c9b3aaf10aa9ad301c70
Reviewed-on: https://skia-review.googlesource.com/c/164260
Reviewed-by: Heather Miller <hcm@google.com>
2018-10-22 16:55:34 +00:00
Kevin Lubick
b9d7fb9624 [canvaskit] Disable effect_deserialization
This trims about 260k uncompressed, 88k gzipped

Bug: skia:
Change-Id: I8c51a7929c0cf1387df88fcb77d90ada54c48bcb
Reviewed-on: https://skia-review.googlesource.com/c/163487
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-19 14:44:10 +00:00
Kevin Lubick
d04b551b4a [canvaskit] Increase timeout thresholds for perf
Especially on the very first load of the wasm binary,
this has been seen to sometimes timeout.

Bug: skia:
Change-Id: I9321eb1e2f70751a1dbbaee3c1e54d38f5bea450
Reviewed-on: https://skia-review.googlesource.com/c/163247
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-18 14:54:33 +00:00
Kevin Lubick
32dfdbe1af [canvaskit] Slice out SkPicture
Removes about 120k uncompressed, 40k gzipped

Bug: skia:
Change-Id: I7e0b404f18fc3c6d4ff6b01d2c9bcd657b7d5e07
Reviewed-on: https://skia-review.googlesource.com/c/163246
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-18 14:15:47 +00:00
Kevin Lubick
f2a146c6ad [canvaskit] Add perf jobs
Of note, the perf results reported are not directly
comparable CPU->GPU because the GPU ones are likely
emulated (no real gpu in the Docker container on an
GCE VM).

Bug: skia:
Change-Id: I52259085f4d9e22c45b67f3e8ce1211a5c6c6d3e
Reviewed-on: https://skia-review.googlesource.com/c/163126
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-17 19:41:16 +00:00
Kevin Lubick
f20c3493eb [canvaskit] Remove DAA and SAA from gpu build
Bug: skia:
Change-Id: If7f5eaf19fd268613ac883b268b424ca84b9be00
Reviewed-on: https://skia-review.googlesource.com/c/162660
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
2018-10-17 14:11:51 +00:00
Kevin Lubick
5b90b84085 [canvaskit] POC working on Node.js
Basically no hoops to jump through - the same binary
that works in the browser works in Node.

Tested locally with Node 8.9.3.

This aligns the GPU and CPU APIs (that is, makeSurface)
and breaks out the GPU/CPU js interface parts into
their own files. We only need one of them and we know
which at compile time.

Bug: skia:
Change-Id: I6d141387403a792d2374cf904872c6dbc999abfb
Reviewed-on: https://skia-review.googlesource.com/c/162746
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-10-17 12:48:24 +00:00
Kevin Lubick
3d99b1e347 Add Correctness tests for CanvasKit
Also make a CPU only and GPU only build (although
the latter still has a lot of CPU logic).

Bug: skia:
Change-Id: I857c2300021c2adb5344865c28e4ad3e8d332954
Reviewed-on: https://skia-review.googlesource.com/c/162022
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-16 14:32:28 +00:00
Kevin Lubick
4bf2c26b93 Remove nvpr from CanvasKit
Saves about 20k uncompressed, 7k compressed.

Bug: skia:
Change-Id: I060c58380f3e3266bca9028ba5ba6aa17ce178dc
Reviewed-on: https://skia-review.googlesource.com/c/161942
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-15 14:11:29 +00:00
Mike Klein
36528e91c2 clean up SkPipe
One less SkCanvas subclass to deal with...

Change-Id: I21e81648026be5d732e8d9a28baed55015492a04
Reviewed-on: https://skia-review.googlesource.com/c/161584
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2018-10-12 16:50:21 +00:00
Brian Salomon
d7065e72da Revert "Revert "Add experimental API to draw a set of SkImages in one SkCanvas call.""
This reverts commit 8d5b41b553.

Bug: skia:8444
Change-Id: I29b52c6fe9475c6113ec954b7918cf591111846c
Reviewed-on: https://skia-review.googlesource.com/c/161627
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-10-12 16:09:21 +00:00
Brian Salomon
8d5b41b553 Revert "Add experimental API to draw a set of SkImages in one SkCanvas call."
This reverts commit 0a0304c426.

Reason for revert: Breaking metal

Original change's description:
> Add experimental API to draw a set of SkImages in one SkCanvas call.
> 
> The client provides a src and dst rect for each image as well as
> a bitfield that indicates whether each edge of the image should be
> antialiased. This per-edge AA is useful for tiled compositors.
> 
> Rather than take a full SkPaint this API only takes an alpha, a filter
> quality (which is pinned to kLow), and a blend mode. This is a likely
> point of future evolution.
> 
> Currently the API is only fully implemented for kSrcOver on the GPU
> backend. With other blend modes or on other backends AA will be ignored
> for images that do not have all four edge AA flags set.
> 
> BUG: skia:8444
> 
> Change-Id: I143998dda8ad6a25f64e18cd600392ba553030ac
> Reviewed-on: https://skia-review.googlesource.com/c/159062
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>

TBR=mtklein@google.com,bsalomon@google.com,brianosman@google.com,reed@google.com

Change-Id: I815baaeee5de9c6722cf2b9d071a8e2f7c1b6a96
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/161622
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2018-10-12 14:25:06 +00:00
Brian Salomon
0a0304c426 Add experimental API to draw a set of SkImages in one SkCanvas call.
The client provides a src and dst rect for each image as well as
a bitfield that indicates whether each edge of the image should be
antialiased. This per-edge AA is useful for tiled compositors.

Rather than take a full SkPaint this API only takes an alpha, a filter
quality (which is pinned to kLow), and a blend mode. This is a likely
point of future evolution.

Currently the API is only fully implemented for kSrcOver on the GPU
backend. With other blend modes or on other backends AA will be ignored
for images that do not have all four edge AA flags set.

BUG: skia:8444

Change-Id: I143998dda8ad6a25f64e18cd600392ba553030ac
Reviewed-on: https://skia-review.googlesource.com/c/159062
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
2018-10-12 13:14:24 +00:00
Kevin Lubick
53965c9d68 Add CPU backend for CanvasKit
This also makes the GPU and Skottie portions optional
at build time.

Bug: skia:
Change-Id: I34f494caf0e2ca35dc4767d57f79ba92b24e818f
Reviewed-on: https://skia-review.googlesource.com/c/159146
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-11 13:30:27 +00:00
Kevin Lubick
93faa6795b Make CCPR optional
This can reduce code size where CCPR is not supported (e.g. WebGL 1.0)

Drops 130k uncompressed, 50k compressed.

Bug: skia:
Change-Id: I8af7e681e1f3520a18e0c0d55e318dcf88206584
Reviewed-on: https://skia-review.googlesource.com/c/161041
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-10-10 20:20:01 +00:00
Kevin Lubick
e805b243f6 Tweak to compile flags
Bug: skia:
Change-Id: I067fa83e1a07b244bec71ed4f95c144dc7e2edc1
Reviewed-on: https://skia-review.googlesource.com/c/161143
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-10-10 19:10:26 +00:00
Kevin Lubick
8e9750d3c5 Add CanvasKit build
Building CanvasKit uses very similar logic to PathKit, so there
was a fair amount of copy/paste/customize.

Fixes the name of skia.js/wasm -> canvaskit.js/wasm and
adds a package.json to formally track versions.

Also move PathKit helper scripts to align better.

Docs-Preview: https://skia.org/?cl=160463
Bug: skia:
Change-Id: Ie75b30592dcc4d520dca41f6f5579006aaa8849b
Reviewed-on: https://skia-review.googlesource.com/c/160463
Reviewed-by: Eric Boren <borenet@google.com>
2018-10-09 13:56:56 +00:00
Kevin Lubick
d45c7811ef Fix text on CanvasKit
Updates example to use text (and be more mobile friendly).

Also make the compile step a bit nicer and remove SKOTTIE_HACK.

Docs-Preview: https://skia.org/?cl=158664
Bug: skia:
Change-Id: I4c465482058ad7d359729a492e29205c07f3933e
Reviewed-on: https://skia-review.googlesource.com/c/158664
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-10-02 17:58:33 +00:00
Mike Klein
60900b55f9 move skpipe to experimental
Nothing's using it except test tools.
I'd like to make that a bit clearer by getting it out of src.

Disabled the fuzzer.

Removed the bench so Android's building nanobench doesn't block this.

Bug: chromium:886713

Change-Id: I761f52c40171c27ff4b699409b32647e84684ec3
Reviewed-on: https://skia-review.googlesource.com/156240
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-09-21 17:20:25 +00:00
Kevin Lubick
1466af42a4 [canvaskit] Link demos to fiddles
This adds one more skottie example and spruces up
the demos a bit (including making the star only
respond when you hold down the mouse)

No-Try: true
Docs-Preview: https://skia.org/?cl=156141
Bug: skia:
Change-Id: Ib577d6c06bd9784f4566d506150c451beadf1f1c
Reviewed-on: https://skia-review.googlesource.com/156141
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-09-21 16:49:24 +00:00
Kevin Lubick
217056c048 [CanvasKit] Implement some basic Canvas/Surface things.
drawText is having issues in a release build.  Skottie sometimes
asserts in debug mode. This possibly has something to do with
memory alignment - like https://skia-review.googlesource.com/c/skia/+/155980
helped fix.

Patchset 9 shows off integrating Skia drawing to
an HTML canvas using Ganesh.

To see it locally, set up https://kripken.github.io/emscripten-site/docs/getting_started/downloads.html
and then set $EMSDK to be that directory.  Then run

   make clean
   make local-example

and navigate to http://localhost:8000/skia-wasm/example.html

Patchset 20 shows off Skottie animating directly to a Canvas.

Docs-Preview: https://skia.org/?cl=153882
Bug: skia:
Change-Id: I2ad2f4ffac00925ee901982ccbaeb7aa63b1ea23
Reviewed-on: https://skia-review.googlesource.com/153882
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2018-09-21 12:03:55 +00:00
Kevin Lubick
c7d057103e [PathKit] Move from experimental to modules
Add in Code of Conduct and Contributing.md as well.

Docs-Preview: https://skia.org/?cl=150901
Bug: skia:8216
Change-Id: Ia881124f653617ad0b7b91f40ba21de2c13220a6
Reviewed-on: https://skia-review.googlesource.com/150901
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2018-08-31 14:18:16 +00:00
Cary Clark
5de5233463 remove scaling from pathops
PathOps added a cheat some time ago to reduce
fuzzer bugs by scaling down very large paths,
with the hope that it would make the math more
sane.

This had the side-effect of causing small edges
to disappear altogether if the bounds is large
enough.

Removing the scaling causes a single regression to
one fuzz-generated bug. That path succeeeded with
scale by eliminating the troublesome tiny contour.

Eliminating the scale may fix the CCPR-related bug
discovered by Flutter, or at least uncover the next
bug.

I would expect more fuzzer bugs to appear with
this change; paths with large and small values will
no longer have the small values removed.

R=csmartdalton@google.com,reed@google.com,bsalomon@google.com

Bug: skia:8290
Change-Id: I3bfdb101c568e9cfa324858685eac1f9c368c291
Reviewed-on: https://skia-review.googlesource.com/150465
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2018-08-30 17:36:05 +00:00
Kevin Lubick
d6719cac91 [PathKit] Make pathops assertion a little more forgiving
Bug: skia:
Change-Id: I5135b8e38e955fe5dbbad8a16bf3f26c98e4e996
Reviewed-on: https://skia-review.googlesource.com/150124
Reviewed-by: Cary Clark <caryclark@google.com>
2018-08-29 13:38:50 +00:00
Kevin Lubick
1fd58fd34f [PathKit] Re-create test expectations
See https://skia-review.googlesource.com/c/skia/+/149620

Bug: skia:
Change-Id: I2a8c88e813b5084f667d08317145866b57bbd7ab
Reviewed-on: https://skia-review.googlesource.com/149681
Reviewed-by: Ravi Mistry <rmistry@google.com>
2018-08-27 19:13:11 +00:00
Kevin Lubick
d993648fa4 [PathKit] Write more complete docs and clean up API to be consistent
Breaking Changes (should be minor, as it's mostly just things
for testing):
 - PathKit.ApplyPathOp should have returned a new SkPath, but didn't.
It now does and is named "MakeFromOp", which makes the convention of
"Have 'make' in name, needs delete" more consistent.
 - PathKit.FromCmds(arr) now only needs to take the JS Array and
will handle the TypedArrays under the hood. If clients want to deal
with TypedArrays themselves, they can use _FromCmds(ptr, len) directly.
 - PathKit.MakeLTRBRect is now just PathKit.LTRBRect. The thing
returned is a normal JS Object and doesn't need delete().

As per custom with v0 apps, we are updating the minor version
to v0.3.0 to account for breaking changes.


Docs-Preview: https://skia.org/?cl=147960
Bug: skia:8216
Change-Id: Ia3626e69f3e97698fc62a6aee876af005e29ffca
Reviewed-on: https://skia-review.googlesource.com/147960
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Heather Miller <hcm@google.com>
2018-08-24 16:30:00 +00:00
Kevin Lubick
f14a3c059f [PathKit] Add asm.js build and test jobs
Consolidates the karma files into one for docker/asmjs/wasm and all
combinations.

The asm.js build seems to have some small imprecisions that we didn't
see as much as with WASM, probably due to JS limitations/differences
to c++'s floats.

To address these, I've marked some (5) tests in PathOps* as flaky
because they fail on Release, Debug or Test versions of the asm.js build.

Other then that, asm.js seems basically identical to the WASM.

WASM is much smaller, 416k vs 877k and seems to load faster (not
measured).

Note to reviewers:
example.html was copied from npm-wasm version, so doesn't need
further review.

Bug: skia:8216
Change-Id: Ib92b90fa6c598de85a0be319d46b25693ae5aaa4
Reviewed-on: https://skia-review.googlesource.com/148396
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-22 17:19:10 +00:00
Kevin Lubick
c6c48aaf2b [PathKit] Add more correctness tests to gold
Bug: skia:8216
Change-Id: I549f59f165e01ef2e827cf389a5412c123314a90
Reviewed-on: https://skia-review.googlesource.com/147817
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-18 02:05:10 +00:00
Kevin Lubick
c623af2e10 [PathKit] Add conic tests and re-create expectations.
Expectations changed in https://skia-review.googlesource.com/147720

Also apparently I missed a spot when adding conics.

Bug: skia:
Change-Id: I6a9b40ef4518a304bcb575a1ea9be1c900ef18d1
Reviewed-on: https://skia-review.googlesource.com/147816
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-08-17 18:55:47 +00:00
Kevin Lubick
11194ab930 [PathKit] Rework API to avoid extra copies unless explicitly called for.
Breaking Changes:
 - All method calls that mutate a path now return the same JS path
object to allow chaining (moveTo, lineTo, trim, op, simplify, etc).
Pre-existing code likely will need to have some delete() methods
removed because the path will be deleted multiple times. See
chaining.js for this code (basically, we wrote our own binding code
since the default code wasn't quite flexible enough)
 - GetCanvasFillType -> GetFillTypeString (Was in https://skia-review.googlesource.com/c/skia/+/147209)
Since Canvas and SVG use the same strings, it seemed logical to make
them share.
 - stroke() now takes a single object instead of 3 params. This object
currently can have up to 4 params, cap, join, width, miter_limit.
This object can be expanded on in future versions as more configuration
options are added.

As per custom with v0 software, we bump the minor version to 0.2.X
to indicate breaking changes in a pre-release software package.

Other changes of note:
 - Simple tests added for effects (see effects.specs.js) A follow up
CL will handle the Gold (correctness tests)
 - Simple tests added for equals and copy constructors (from https://skia-review.googlesource.com/c/skia/+/147209)
 - Added transform() to allow for arbitrary matrix transforms
 - Added SimpleMatrix as a value_array, which means users can
provide a 9 element array which will be converted to SimpleMatrix
and then SkMatrix on the C++ side.
 - Renamed helpers_externs.js to externs.js and expanded it greatly.
This was necessitated by the code written in chaining.js
 - Fixed a few bugs in previous tests (svg gold test race condition,
uncaught exception in svg reporting)

See also https://skia-review.googlesource.com/c/skia/+/147209 which
allows .moveTo .lineTo, etc to chain on the C++ SkPath.

Bug: skia:8216
Change-Id: I7450cd8b7b5377cf15c962b02d161677b62d7e15
Reviewed-on: https://skia-review.googlesource.com/147115
Reviewed-by: Mike Reed <reed@google.com>
2018-08-17 18:30:32 +00:00
Kevin Lubick
a0ba612bb2 [PathKit] Adding test infrastructure to support Gold output
To get the gold images out of the browser tests, this adds
testReporter.js and pathkit_aggregator.go.  testReporter bundles
up the output as a base64 encoded PNG and sends it over the local
network to pathkit_aggregator.  pathkit_aggregator will keep
a list of test results reported in this way and write the PNGs
to /OUT of the container (which is the swarming output directory).
Finally, after all the tests are run, the helper script "test_pathkit.sh"
makes a POST request that creates the JSON file that gold expects
(following the schema https://github.com/google/skia-buildbot/blob/master/golden/docs/INGESTION.md)

pathkit_aggregator takes many command line arguments which control
the keys that Gold needs in order to ingest and handle the data.
Of note, this creates a new set (i.e. source_type) of gold images
called "pathkit", which will distinguish it from "gm", "image", etc.

There will be at least 2 sub-sets of "pathkit" images, "canvas" and "svg",
(representing the 2 output types of PathKit).  This CL doesn't
quite handle SVG yet, as it needs a way to convert SVG to PNG in the
browser and will be addressed in a follow up CL.

A "standard" gm is sized at 600x600. This was arbitrarily picked.

Note that the functions in testReporter.js return Promises based
on the fetch requests to post the data. This eliminates the race
condition between the /report_gold_data and /dump_json since
running the karma tests won't return until all reports are done.

Other changes of note:
 - Adds go to karma-chrome-tests container.
 - renames recipe_modules/build/wasm.py -> pathkit.py to be consistent with
the name of test_pathkit.py and make for easier grepping.
 - Increases the JS test timeout to 10s (up from 5) to hopefully avoid
the flakes seen in the Debug Test.

Bug: skia:8216
Change-Id: Ic2cad54f3d19cc16601cf2e9a87798db1e6887a2
Reviewed-on: https://skia-review.googlesource.com/147042
Reviewed-by: Stephan Altmueller <stephana@google.com>
2018-08-15 19:25:42 +00:00
Kevin Lubick
084d996d5a [PathKit] Fix bindings to account for SkPath methods returning this
Bug: skia:
Change-Id: I25baf2d5d215cc950da99679649bb3da89dc0681
Reviewed-on: https://skia-review.googlesource.com/147209
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2018-08-15 17:35:39 +00:00
Kevin Lubick
97d6d98402 [PathKit] Add various path effects
API Changes (nothing should be breaking):
 - Exposes conic, although all output formats (SVG, Canvas) need conics
to be approximated with quads. Tests have been added to verify this
happens.
 - Add .dash(), .trim(), .stroke() and examples for them.
 - Expose Stroke enums (StrokeJoin, StrokeCap)

Adds tests for the cubic part and clean up a few spacing things.

There are some changes to the C++ code to simplify the build -
otherwise, I need to appease the linker and add add in a bunch
of files that may or may not get optimized out.  Best make them
not even be compiled, just to make sure.

Bug: skia:8216
Change-Id: I1da3aaab1891f14a5b3dc01bb6523b4fd9a87b04
Reviewed-on: https://skia-review.googlesource.com/146650
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-10 20:07:47 +00:00
Kevin Lubick
644d8e7175 [PathKit] Add PathOps Op and Simplify tests imported from the C++ tests.
Because of https://skia-review.googlesource.com/c/skia/+/146165 and
https://skia-review.googlesource.com/c/skia/+/146100 we have a way
to turn PathOps tests into JSON, which has input paths (as Cmd arrays),
combination verb and expected output.

In this CL, we make tests from the JSON, compare them to the expected
output and, optionally, create SVGs to visualize the difference if any.

API changes (nothing breaking on release builds):
 - Exposes SkRect as a JS Object.  No need to call delete() on this.
 - expose path.getBounds() and path.computeTightBounds()
 - Remove SkRegion exposure (debug/test only), which was going to be
used for this purpose, but the approach in this CL works fine.
 - Add loadCmdsTypedArray(cmd) helper function to JS [see helper.js].
This was previously known as `floatTypedArrayFrom2D` in the
old shell.html, and is now exposed to avoid clients having to
implement this boilerplate by themselves.
 - Add set/getFillType - mostly for testing the difference between
a Winding and an EvenOdd path.

Bug: skia:8216
Change-Id: I2cd25ce2e1e7f285c79c596678678e62135963f0
Reviewed-on: https://skia-review.googlesource.com/146524
Reviewed-by: Cary Clark <caryclark@google.com>
2018-08-09 18:13:48 +00:00
Kevin Lubick
92c9171125 [Pathkit] Add recipe for running JS tests using Docker
This adds a few JS tests (see *.spec.test) and runs them
using Karma and a Docker image containing Karma, node, and
Chrome (currently at 68).

We only add a Debug Test here because the Release version
has some test helpers (e.g. Region) compiled out.  If those
end up not mattering for tests, we can add in a Release version.


Bug: skia:8216
Change-Id: Ica6ab3a4f21688cfa175a90d42c2254d38e8fcf1
Reviewed-on: https://skia-review.googlesource.com/145723
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2018-08-09 14:17:28 +00:00
Mike Reed
5edcd31f2c migrating SkTDArray towards std::vector api
fix for https://skia-review.googlesource.com/c/skia/+/146140

Change from original was to include <initializer_list>

Bug: skia:
Change-Id: Ie36426fcf7ce778a95e2b656ce80a9a394a8307c
Reviewed-on: https://skia-review.googlesource.com/146160
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2018-08-08 15:51:44 +00:00
Mike Reed
f9ecb4e67e Revert "migrating SkTDArray towards std::vector api"
This reverts commit 79884be809.

Reason for revert: broke flutter build -- initializer_list?

Original change's description:
> migrating SkTDArray towards std::vector api
> 
> push -> push_back
> add some aliases to match std::vector: count, reserve, ...
> 
> Bug: skia:
> Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
> Reviewed-on: https://skia-review.googlesource.com/145884
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Mike Reed <reed@google.com>

TBR=mtklein@google.com,fmalita@chromium.org,reed@google.com

Change-Id: Ib6132b725aaed7c01287e3e8c2b5a14da3d3d7e9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/146140
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 15:14:37 +00:00
Mike Reed
79884be809 migrating SkTDArray towards std::vector api
push -> push_back
add some aliases to match std::vector: count, reserve, ...

Bug: skia:
Change-Id: I1921c31d0d6e5ed3d622a0def6054c697be2d02f
Reviewed-on: https://skia-review.googlesource.com/145884
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2018-08-08 14:43:28 +00:00
Kevin Lubick
5f0e3a158a [PathKit] Made some APIs return null if things failed
This makes our calls to emscripten::val a bit more consistent.

Adds in the macro SkPathOrVal to self-document where it's really
a SkPath we are returning, but C++ doesn't realize SkPath and
emscripten::val::null() can be the same type.  Casting SkPath
via emscripten::val() is basically a no-op, since Emscripten bind
seems to be doing it under the hood anyway.

No functional changes, except when there would be a failure,
methods will return null instead of an empty SkPath.

Bug: skia:8216
Change-Id: I1fff620d5aa50ec4a57f76e706d8d005ea26605f
Reviewed-on: https://skia-review.googlesource.com/145728
Reviewed-by: Cary Clark <caryclark@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2018-08-07 16:41:58 +00:00