Like the destructors, most of these can just go unspoken.
SkTArray only knows its size in Debug builds, so it can't easily grow a
copy constructor. Instead just keep the explicit copies and moves on
SkTHashTable, and mark the others as explicitly default. I inverted the
pattern from assign-by-copy to copy-by-assign, but it's all basically
the same.
Change-Id: I0df552ef547ce9c7e232267c072a5f3b09197847
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324056
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
The benchmarks show a negligible performance decrease over the bespoke
TinyUnorderedMap class, but it's well within the margin of error, and
a real hash map will scale better in pathological cases.
Nanobench: http://screen/537ETJivpGdVJpk
Change-Id: I21279c47742a5dac81d57c7e9f7da4bfc595fdc9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323114
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Change-Id: I97a59563914c4f75f8cfdc2bd5a9ae430de9bb3c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323881
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Of note, I had to explicitly export _malloc and _free, since
we use those directly in the binding layer.
Code size change:
-20k on JS (-1k compressed)
-21k on WASM (-15k compressed)
Bug: skia:10419, skia:10794
Change-Id: Id7670b6fcbf1524ad3155a863db51eb49aa24811
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323979
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This will enable us to use SkTHashMap to store our definition maps.
Change-Id: I6017dfa71e1c5e68a20c97e955bb3d3abf347f0d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323891
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
In this CL, I forked compile.sh and created a new gm_bindings.cpp.
I also moved viewer.html into wasm_tools and created a gmtests.html
for testing out the bindings locally.
Right now there is only one gm file compiled in. I plan in a followup
CL to have some way to generate the list of cpp files that need to
be compiled in from gms.gni. I was unable to get it to work with
simply linking the lib_gm.gni, probably due to the same issue with
Registry that csmartdalton@ ran into when adding viewer.html
and the associated bindings.
Suggested reviewing order:
- gmtests.html to get a sense of how the test flow works.
- gm_bindings.cpp to make sure I setup the contexts/GMs correctly.
- compile_gm.sh to see how the gms are compiled in.
- The remaining files in any order.
When I tested this locally, the bleed_downscale digest was
exactly the same (pixel for pixel, byte for byte) as a known
digest in Gold, so I'm fairly confident in how things work.
Change-Id: I2babef848ca60f7db74e4adf27b8952a66bdeee1
Bug: skia:10812
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322956
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
As part of this change, broke up IRNode::type() and moved it into
virtual functions where it belongs.
Change-Id: Ib19e99f2e8392e34a20a1887b980225ac4b793f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323884
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Change-Id: I82d4aaf442be262ad8e397de4f820831f4797b95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323977
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
We now support cloning global variables that are "declared" by an
InterfaceBlock, or a GlocalVarDeclaration. At this point, there are no
"inherited" elements - any mutable data that starts out owned by the
pre-includes is cloned.
Follow-up will remove the inherited element list entirely - splitting
this out to make the changes clearer.
Bug: skia:10589
Change-Id: I2a95c73bf53db313e9f3467c681a05dffffeaa3a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323976
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This appears to just be dead code.
Change-Id: I2a8510f2e8c15a833af72552a13c2a893b3b123a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323925
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This also links the main canvaskit landing page to the quickstart
and both pages to the Typescript types and documentation.
Bug: skia:10717
Change-Id: I843639651aa04e48bb13f995c15e4ee18fb348bd
No-Try: true
Docs-Preview: https://skia.org/?cl=323889
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323889
Reviewed-by: Nathaniel Nifong <nifong@google.com>
The next pre-include refactor will require cloning InterfaceBlocks, and
re-targeting the variable.
Change-Id: Iccfc1f39789fcd572199682386cd612500334061
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323890
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Change-Id: Icccc14019ae5c87a09c8439fa1b1ae324b8e32bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323777
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
The goal is to have all of the IR structs be classes when the
rearchitecture is complete. Some of these should have been changed in
earlier CLs, and some of them never contained any data in the first
place and thus won't be affected by the rearchitecture.
Change-Id: Id5a3cebffd59a4c43b79f2195b50106ede7c2f87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323882
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
We now assume that the Symbol's name() is its actual name, instead of
having it passed it in by the caller. This simplifies calling code, and
also removes redundant symbol names from the Dehydrator, saving a few
hundred bytes here and there.
Change-Id: I3e3d65b238ea58ab52f5dca205458d6f45c06c3d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323110
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
We'll need this for a proper implementation of onUpdateBackendTexture().
Change-Id: I4b9ac93934ef39ed3c82a55f7d74fc1f826f7740
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323558
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Stephen White <senorblanco@google.com>
Change-Id: I53af66c1b65971c204ac7c515e0d0e39481b015d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323097
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
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>
In practice, callers of getInputBounds already have an output pixel
region they need covered by the image filter, so DeviceSpace<SkIRect>
is more appropriate than DeviceSpace<SkRect>
Change-Id: Ica062b59257966d12240201b7d942cbaed56adb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323598
Auto-Submit: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Chromiun no longer use set_sources_assignment_filter() anywhere in the
build, so these are no longer needed.
Bug: chromium:1018739
Change-Id: I0e460922947430ed357838ff4196516d19c382a5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323636
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Before this change each backend had its own special stencil format
struct that contained information like the actual format, stencil bits,
etc. This change removes all of that and instead reliess on static
helper functions that can return all this information based on the
backend format.
Besides being cleaner, this change helps move towards being able to
combine all surface attachment classes into a unified class.
Bug: skia:10727
Change-Id: I26003e44f55ce32293e9092bafce5baef6f938d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322958
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Currently there is nothing using these formats, but this change just adds
them along with a quaries about their properties. They will be used in a
follow up change.
Bug: skia:10727
Change-Id: Iaaf13baf372799d47c65bd974fd204a32be57617
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322622
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
This removes VarDeclarationsStatement entirely. VarDeclaration instances
appear directly as statements in Programs. SkSL that declares multiple
variables in a single declaration is transformed to represent that as a
series of VarDeclaration statements.
Similarly, global variable declarations are represented by
GlobalVarDeclaration program elements, one per variable.
Bug: skia:10806
Change-Id: Idd8a2d971a8217733ed57f0dd2249d62f2f0e9c5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323102
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Also, remove unused #include of SkBitSet.
Change-Id: Ib1b903f78e835a75c8ba88ac35bfa270df7bc0e3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322681
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Encode as PNG to an SkWStream instead of a path.
It's just as natural at the call sites, if not more so,
and is more flexible for environments without a filesystem.
While here, tweak the method names and add some comments.
Change-Id: I8ce9869471fc7e1a0955d51ecb621e76c2e1d4d8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323509
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
We'll also be needing this helper for HW-generated blur mask caching
Bug: 1108408
Change-Id: I60d91ae8864239f0cf68830d0a5b4266d27545d3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323109
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Change-Id: Id3ee43fb72408f5bd0287f8b57b4a83109109aae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321778
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
go/skiastyle: "Variables declared constexpr or const, and whose value is
fixed for the duration of the program, are named with a leading "k" and
then camel-capped."
Change-Id: Id9cf292a923d6b4db760975ffb7bc1a04c516e87
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322440
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit 57c37ad0e4.
Reason for revert: Breaking the Mali400 bots.
Original change's description:
> Add a 2d cross product intrinsic to sksl
>
> Change-Id: Iebaf4616665547d6ca4900e1247d5b68e0f3512a
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321790
> Commit-Queue: Chris Dalton <csmartdalton@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com,csmartdalton@google.com,ethannicholas@google.com,johnstiles@google.com
Change-Id: I3e1aa251e883e3d2a1170b0fc6cdc84ea06e784a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323556
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
and begin using it for cached SW-generated blur masks.
This is needed to begin mixing and matching HW & SW-generated blur
masks since they have different draw-rects.
It will also be useful if/when we add support for triangulated paths
to the thread-safe cache.
Bug: 1108408
Change-Id: I085ad1127dc2deb98b35d704b06e50b27c72fd1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322657
Reviewed-by: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
I wrote code that called SkAutoTArray::data() and discovered that it
was broken, but not generating compile errors because it's part of a
template and never instantiated anywhere else. I fixed the
implementation and added it to our container unit test to prevent later
regression. This revealed another issue, that "containers in
SkTemplates.h [should] all have a consistent api", according to
test_container_apis. However, data() was never added to the non-array
container APIs. So I added data() to the other containers as well.
Change-Id: I52532c91fdab3fc8c4539053ba8420815b7b0ee5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323276
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
I don't think we need the extra bin folder; we should be
able to declare our types all in index.d.ts.
This also checks in the package-lock.json, now that we
have devDependencies to run those type checks.
`make typecheck` runs the typecheck tests.
The tsconfig.json and tslint.json were created following
the instructions at https://github.com/microsoft/dtslint
and using the DefinitelyTyped rules.
Bug: skia:10717
Change-Id: I7f943e9cfa264496e0d8932018ab1749702ab2c4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/322957
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Change-Id: Iebaf4616665547d6ca4900e1247d5b68e0f3512a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/321790
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
SymbolTable::addAlias can be used to create a Symbol that's an alias for
an existing symbol, but uses a different name. (e.g. in Runtime Effects,
a `fragmentProcessor` is a `shader` and `float4` is also `vec4`.)
SymbolTable::addWithoutOwnership will now assert if an attempt is made
to add a Symbol with the wrong name. In a followup CL, the name argument
will be removed entirely and it will simply use the Symbol's name.
Change-Id: I9aee7717e2600a6d84ebe4c3ab7fca40229faa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323106
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Also rm extra space in CK binding.
Change-Id: I3ec50d24cf77ed7773bd0f9c7a6a141221ecd063
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/323104
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>