For API simplicity, if the rectangle is to be omitted, the client
should only provide the paint. (emscripten already does parameter
count checking, so let's use that instead of doing it ourselves).
This also adds tests to help verify the new behavior.
Revert "Revert "Allow null rect for saveLayer""
This reverts commit 7957d53c80.
Bug: skia:10043
Change-Id: I9ed8caabbfc77deab1ca3d9b1a415489e012528f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277399
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Dan Field <dnfield@google.com>
This reverts commit 9d4b788807.
Copyright issue has been fixed in
https://skia-review.googlesource.com/c/skia/+/275998.
Original description:
Bug: skia:9756
In CanvasKit, a large part of the binary is for encoding. Clients
would be happier with a smaller binary and no webp/jpeg encoding. Make
this an option by splitting up the GN arguments.
Split SK_HAS_WEBP_LIBRARY into SK_CODEC_DECODES_WEBP (to match the
existing SK_CODEC_DECODES_RAW) and SK_ENCODE_WEBP. Same for JPEG and
PNG.
Update CanvasKit compile script to disable webp and jpeg encoding.
Update debugger compile script to disable all encoding.
Change IsPng signature to match other SkCodecs.
TBR=djsollen@google.com
Change-Id: Ic847bae0154e0a2922100b3f2ee14a077ee5635a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276007
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This reverts commit 94aaf7cdf5.
Reason for revert: you know what I already typed the reason stop making rules that people have to follow, robots.
Original change's description:
> Split building encoding from decoding
>
> Bug: skia:9756
>
> In CanvasKit, a large part of the binary is for encoding. Clients
> would be happier with a smaller binary and no webp/jpeg encoding. Make
> this an option by splitting up the GN arguments.
>
> Split SK_HAS_WEBP_LIBRARY into SK_CODEC_DECODES_WEBP (to match the
> existing SK_CODEC_DECODES_RAW) and SK_ENCODE_WEBP. Same for JPEG and
> PNG.
>
> Update CanvasKit compile script to disable webp and jpeg encoding.
> Update debugger compile script to disable all encoding.
>
> Change IsPng signature to match other SkCodecs.
>
> Change-Id: Iec8466ee1b76bc3d1e377c24201068b776cd7718
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273768
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Nathaniel Nifong <nifong@google.com>
TBR=djsollen@google.com,scroggo@google.com,kjlubick@google.com,nifong@google.com
Change-Id: I4fc2ea916743fda7e7d0d668b59e52052e880104
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9756
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275710
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Bug: skia:9756
In CanvasKit, a large part of the binary is for encoding. Clients
would be happier with a smaller binary and no webp/jpeg encoding. Make
this an option by splitting up the GN arguments.
Split SK_HAS_WEBP_LIBRARY into SK_CODEC_DECODES_WEBP (to match the
existing SK_CODEC_DECODES_RAW) and SK_ENCODE_WEBP. Same for JPEG and
PNG.
Update CanvasKit compile script to disable webp and jpeg encoding.
Update debugger compile script to disable all encoding.
Change IsPng signature to match other SkCodecs.
Change-Id: Iec8466ee1b76bc3d1e377c24201068b776cd7718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273768
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
This also adds a helper option to writing canvas2d spec tests
to see the CanvasKit option side by side with the real canvas
version.
Bug: skia:9940, skia:9947
Change-Id: Ia8fc4e1332d3896933b86291181bc3ba890d26ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275618
Reviewed-by: Florin Malita <fmalita@chromium.org>
Uniforms in the general case can be multiple floats, so
we expose a small struct to provide information about all
uniforms (including the built in ones like "dt") as well
as effectUniforms and particleUniforms which return Float32Arrays
bound to the WASM memory containing those unifroms.
Thus, by modifying the Float32Array, one can directly affect
the particle/effect properties.
This allows us to expose sliders on particles.skia.org
(https://skia-review.googlesource.com/c/buildbot/+/272398)
Change-Id: Ie390f3d2dc571ee4ebaab59a7fa1b7b2dc24d871
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272377
Reviewed-by: Brian Osman <brianosman@google.com>
This is handy for interacting with <input type=color>
Change-Id: I7946c08ef10a2481016885d58cc52f76f5cd40e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272344
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Change-Id: Id046199edd63535ef07e1dfa65fbc7c0f8cefd00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269371
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
We accidentally were not waiting until all font files were loaded before
trying to process them.
Bug: skia:9858
Change-Id: I10decd5fbf0aa46e300d2ce5255f24f1ac1c12d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268626
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Adds a test to load different font types. Currently supported:
- .ttf
- .otf
- .ttc
Not supported:
- .woff
- .woff2
This only increases code size by ~4kb, so that big glyph table
has still been successfully removed.
Bug: skia:9829
Change-Id: I0231578b2abf4f36df57ff8073b7697d16606373
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/267180
Reviewed-by: Ben Wagner <bungeman@google.com>
I belatedly realized that drawOnce's test would always be blank now
that drawOnce is async.
Change-Id: If30bbdd895039bd8de050a59dd348ba6849c5835
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/266631
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
The existing |SkSurface.requestAnimationFrame| API provides a convenient way of
drawing Skia animations using the same idiom as the well known
|Window.requestAnimationFrame|. It gracefully handles providing the caller with
access to the right canvas, as well as flushing after the user-supplied
callback.
The new |SkSurface.drawOnce| API added in this change provides the same
conveniences around access to the right canvas and flushing, but for the
use-case where the user wishes to draw a single frame only. Importantly, this
new API disposes of the SkSurface upon completion, i.e. frees the memory
associated with the underlying pixel storage an surface. This avoids memory
leaks that occur when |SkSurface.requestAnimationFrame| is used for single-frame
purposes.
Bug: NONE
Change-Id: Ic4e48e65dffc4809513ceaf72260ac0432b98952
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265604
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Cached references to the WASM heap buffer are invalid following memory growth:
https://github.com/emscripten-core/emscripten/issues/6747#issuecomment-400081465.
This change replaces references to the cached CanvasKit.buffer with direct
references to CanvasKit.HEAPU8.buffer. The symptom of this bug is a Javascript
error thrown in the Chrome console: "Uncaught TypeError: Cannot perform
Construct on a neutered ArrayBuffer", causing the operation in question to fail.
Bug: NONE
Change-Id: I27462e80db1d33e0e77ee7295b25039c9036d2e2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264477
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Flutter on the web wants to be able to extract arbitrary frames from
an animated image and pass those into functions like:
drawAtlas, drawImage, drawImageRect
This should allow that to happen w/o having to add lots of variants like
drawAnimatedImage. If this sticks, is drawAnimatedImage still useful?
(maybe it saves a copy?)
Change-Id: I99d7045c5dea61d0a1bd6d335c88e7517f2c4fc2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/263020
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
We were previously building FreeType2 with the psnames module,
which included large tables of glyphnames [1]. These were only
used in code related to PDF (and only when outputting Type 1
fonts, which is very rare).
Even though the PDF backend isn't in CanvasKit, the compiler
couldn't throw away these massive tables (about 80k in all)
of strings. Since these tables were only used for T1 fonts,
it made sense to tell FreeType not to include the rest of the
T1 related code, which saved about 55k more.
If, one day, we add in support for the PDF backend to CanvasKit,
SK_PDF_DO_NOT_SUPPORT_TYPE_1_FONTS is likely something we'll
want to define.
The roll-freetype.sh is inspired by a script of the same name
in the Chromium repo and aids in the updating of freetype
and our forked config files.
[1] 0a3d2bb99b/src/psnames/pstables.h (629)
Bug: skia:9733
Change-Id: I359bab4184587cbe91400661fb012eac1a601a83
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262232
Reviewed-by: Ben Wagner <bungeman@google.com>
This saves about 32kb uncompressed, 21kb gzipped from CanvasKit.
This would also save about 11kb from a Flutter build.
Bug: skia:9733
Change-Id: I0a21b7279a73c692ea39aa28ac00d70d24b70373
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/262218
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>