Commit Graph

28 Commits

Author SHA1 Message Date
Kevin Lubick
c0fcc50344 [canvaskit] Add in fillText to spreadsheet demo for comparison
The drawGlyphs implementation seems to have a 20-30% performance
edge and drawText is a few percent slower than fillText on my
machine.

Change-Id: I5b8a623bcd4fdbfea3d534d3dbaf3d6f38d37e55
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/508921
Reviewed-by: Ben Wagner <bungeman@google.com>
2022-02-15 15:35:43 +00:00
Brian Osman
77326adc07 Remove isOpaque parameter from CanvasKit SkRuntimeEffect APIs
Bug: skia:12643
Change-Id: I285d42c908c75532b78c9b80da7b6145e1b47fe7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506458
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2022-02-10 17:15:13 +00:00
Kevin Lubick
1d9237e3c2 [canvaskit] Add demo excercising lots of text
There are two approaches taken - naively using a bunch
of drawTexts and using drawGlyphs. The latter runs about
twice as fast (45 ms per frame vs 90 ms per frame) at the
expense of more complex code (need to layout individual
glyphs in the JS).

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

Change-Id: I3a1ce6d4a335873f2b7670d56dadfccdc7881c38
Bug: skia:12723
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/495556
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2022-01-31 14:00:48 +00:00
Kevin Lubick
68365c7579 [demos] Add WebGPU demo using origin trial
Before we get too excited, this does not use CanvasKit.

What this does add is an origin-trial token so we can
more easily demo our progress on *.skia.org and test
locally using localhost:8123 (which is the default
if you run make local in //demos.skia.org)

To view this locally, I started chrome (stable 94) with
--enable-features=Vulkan --enable-unsafe-webgpu

Enabling the Vulkan was the advice of
https://web.dev/gpu/#browser-support
The second flag make sure the whole stack also uses Vulkan.

Change-Id: Ia1838352a46387b0b79e353601a32c859f6911c1
Bug: skia:12512
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/457316
Reviewed-by: Brian Salomon <bsalomon@google.com>
2021-10-08 16:35:34 +00:00
Brian Osman
cbfa34a58c Convert internal SkSL to use .eval()
Also update RELEASE_NOTES to describe new syntax.

Change-Id: I2666551b98f80b61ae3a48c92a9e306cdc7242b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/444735
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2021-09-03 15:54:54 +00:00
Brian Osman
293497e77f Convert internal sample() calls to shade/filter/blend
Bug: skia:12302
Change-Id: I8cf958acf9214d0de903a4097647afd74f2a659e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/441541
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2021-08-24 21:03:44 +00:00
Kevin Lubick
df398c5552 [canvaskit] Fix demo image link
Assets are served from /demo not /demos
6be53e5cdf/demos/go/demoserver/main.go (L145)

Change-Id: I48b8f1a5c5320c9eb5acda25178b2e080ca17fcd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/415165
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-06-03 12:57:50 +00:00
Kevin Lubick
7b6a92818d [canvaskit] Add Surface.makeFromTexture
This includes a helper Surface.makeFromTextureSource that will
make the gl calls with some sensible defaults.

Change-Id: I31bb2f3118b4749e77fb1fc2cb013d35ccb7cfce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/413336
Reviewed-by: Brian Osman <brianosman@google.com>
2021-06-03 12:29:07 +00:00
Mike Reed
77724af76c Add 'w'avy style to textedit
Change-Id: I337f4dff10f30aa248ebc520449f3b763ede0ed8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414096
Reviewed-by: Mike Reed <reed@google.com>
2021-05-31 20:43:39 +00:00
Mike Reed
e3bea7a60a Can ctrl-key work on non-macs?
Change-Id: I9cd06689c209941a45a8e842eb0dca99abc11a5b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407497
Reviewed-by: Mike Reed <reed@google.com>
2021-05-12 17:53:41 +00:00
Mike Reed
0270bf5d10 Add shader styling
Change-Id: I0ce66418d98160ae9bd343fbe62b47fd86f328f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407496
Reviewed-by: Mike Reed <reed@google.com>
2021-05-12 16:35:59 +00:00
Mike Reed
433d25c947 Safeguard against wacky keys for now
Change-Id: I48e8a5a6bbf66a11c71d676e11b3d5f7c84cb29d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/407456
Reviewed-by: Mike Reed <reed@google.com>
2021-05-12 15:33:23 +00:00
Mike Reed
a5b17fd8d0 Move paragraph extra into demos
Change-Id: I5006e412084ad8e82eae5671577228f9241dbc1d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/406176
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-05-11 14:46:28 +00:00
Mike Reed
3386533c20 Add some comments
Change-Id: I37363e6efb5aaf5a3c8c25fcbe3755cc36645114
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402019
Reviewed-by: Mike Reed <reed@google.com>
2021-04-27 22:16:02 +00:00
Mike Reed
b3d14873d4 Demo different sampling options
Requested by blink team

Change-Id: I5b93c330341e8582bfc479bd830bb6dfa3489847
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396198
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-04-14 19:17:57 +00:00
Mike Reed
319565ac6e Clean up prev experiment.
- Only need 4 (not 5) samples
- Document some of the math
- Use round of CTM to better match 'brute-force' version

Change-Id: Ibcc8e8eabc10158da8eecaba303385ed79218126
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379847
Reviewed-by: Mike Klein <mtklein@google.com>
2021-03-05 15:56:14 +00:00
Mike Reed
3b58d38966 Upscaling demo
Change-Id: I22f26ff2a618f95f6f4f9ab0962a3fede509f1e6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/379837
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-03-05 02:30:49 +00:00
Kevin Lubick
a1e30a3a28 [canvaskit] Update all demos to use full version from 0.25.0
Also add some explanation to the image_sampling demo.

Change-Id: Id20fe4d47c45b6a6b27e227871458bb862ec83d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378936
Reviewed-by: Mike Reed <reed@google.com>
2021-03-03 14:38:35 +00:00
Mike Reed
2d2c4f0af3 Interactive toy for custom image sampling
Change-Id: I116d0fbe5556e77606a1a08de33351156a4fa3bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370938
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-03-02 14:41:59 +00:00
Kevin Lubick
7026961111 [canvaskit] Remove references to particles.skia.org from demos
We should encourage users to use a real CDN, not a random build of ours.

This also fixes a few broken demos.

Change-Id: I3b607665744b5f481bca0b9b3072aaa25b3d2c57
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371221
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-02-18 19:00:44 +00:00
Joe Gregorio
555b7a4d77 [particles] Fix up URLs for the particles migration.
Bug: skia:11108
Change-Id: Id41d061adbaab325634a2497fc96e4fc89bde6ea
Docs-Preview: https://skia.org/?cl=356762
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356762
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-01-25 20:44:32 +00:00
Kevin Lubick
54c1b3dd43 [canvaskit] Remove Sk from nearly all function/type names.
This is a massive breaking change for all existing users of CanvasKit.

It will be (one of the only) changes in 0.19.0 to make the transition
easier.

Suggested reviewing order:
 - index.d.ts (to see type changes). Notice SkPicture still has Sk
   prefix, but no other types do (this felt "right" since Sk is
   part of the name of the type, but I can be swayed on this).
 - canvaskit-wasm-tests.ts
 - tests/*.spec.js
 - interface.js and helper.js
 - html examples
 - markdown files

Change-Id: I3b3d3815df2078f986893df3c70101d6248c117d
Docs-Preview: https://skia.org/?cl=322617
Bug: skia:10717
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322617
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-10-07 21:01:32 +00:00
Kevin Lubick
c21dc07a78 [canvaskit] Add demo on how to decode images in web worker
Change-Id: I3c9107799c5df2c39a8ea8ddf106978786de79f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317389
Reviewed-by: Yegor Jbanov <yjbanov@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-09-17 20:15:05 +00:00
Elliot Evans
1a4107a32a Add path rendering performance demo to demos.skia.org
In this demo the user may choose between one of three path rendering methods
    1. SVG
    2. Canvas2D Path2D API
    3. CanvasKit

SVGs is animated using css transforms on the main thread, while Canvas2D and CanvasKit are animated
in a worker using OffscreenCanvas.

While the user views the result of the rendering, the demo collects framerate data and displays it
so the user may compare the performance of the three methods.

Change-Id: I8cd6e079bab8815614e09a276cfe78bee9557fda
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309327
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-08-11 19:57:08 +00:00
Elliot Evans
683bbe01ff Modify CanvasKit to work in a Web Worker and add a demo of it in action.
In this CL:
- Modify modules/canvaskit/gpu.js to support the use of OffscreenCanvas.
- Add a CanvasKit demos.skia.org demo for CanvasKit in a Web Worker.

Change-Id: I8c26bd94f2aa5b3c09cf149b056b910b0e4cd602
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/304320
Reviewed-by: Elliot Evans <elliotevans@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Elliot Evans <elliotevans@google.com>
2020-07-21 22:21:06 +00:00
Kevin Lubick
d12c124d87 [demos] Move to subdir
This was supposed to go in the previous CL, but patchsets are hard.

Change-Id: I9c479e547bc3f206bb2225ca54b25c52b9483960
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298407
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-06-23 17:29:37 +00:00
Kevin Lubick
2639a144ff [demos] Add directory from which to serve demos.skia.org
To run the demos locally, cd in to the directory and run
  make local

Then navigate to, for example, http://localhost:8123/demos/hello_world/

Change-Id: I5954989053d4602cd558c646e19106998dc00604
Bug: skia:10170
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298397
Reviewed-by: Weston Tracey <westont@google.com>
2020-06-23 17:24:59 +00:00