Move the ctor Cluster::Cluster into ParagraphImpl.cpp to allow
inlining. This results in about a 5% speed up using means.
min median mean max
before: 57.2µs 61.3µs 60.1µs 64.1µs
after: 55.8µs 58.4µs 57.3µs 59.4µs
Change-Id: Ie4cfcae9fde601ccf4a42aec69a853cc0bddb377
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/386817
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Only text string + size for now, we can surface more if needed.
Change-Id: I4b40c1bb5e27ea5fc4ed20a1214c4eeb04bf1ca8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382279
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Jorge Betancourt <jmbetancourt@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
These have been replaced by "CanvasPerf" jobs.
Bug: skia:11331
Change-Id: Id7d625eb8ade2d93754e4021171af0ce4a5224a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/381219
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Adds proper framework dependencies and moves from using ArenaAlloc
to header only SkAutoSTArray so it can be built in a shared build.
Change-Id: I6467153915e00a28d5569869187aecc3dd1f0112
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/380318
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This will allow users to create PDFs with the actual text embedded. This
will allow for correct search and copy operations on the generated PDF.
Since these are now public, SkTextBlobBuilderPriv is no longer needed
and is removed. For consistency, the allocRunRSXform overload is renamed
to allocRunTextRSXform.
Change-Id: I44be82d9038a433e1221d5cbfd8ed113ecb6d4fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375017
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
The 'lang' was never stored or used, so this makes no current practical
difference. The original intent was to be able to specify a language so
that it could be emitted as a 'Lang' override in the 'ActualText' when
generating a PDF. However, due to the way 'ActualText' is generally used
this would be impractical. If there is ever a desire to mark up sections
of the PDF with a specific language it would be better handled in a
different way.
Change-Id: Id63596190235fc45ce17249b9b578b6f9b838b2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/375060
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Also rename //modules/canvaskit/canvaskit to //modules/canvaskit/npm_build
to make it more clear the purpose of that folder (what we ship to
npm and stage our builds for local testing).
Bug: skia:11203
Change-Id: I4299ded97d14f4155c36798d60e88a660ce6fe6a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/372392
Reviewed-by: Kevin Lubick <kjlubick@google.com>
This had been previously deprecated.
Bug: skia:10717
Change-Id: Ic57ed835c13cfa7812099a3ef20ed7ff5aa62f7f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371339
Reviewed-by: Nathaniel Nifong <nifong@google.com>
The Paragraph API is what should be used.
Bug: skia:10717
Change-Id: I135aff09bffae0718045b5c744f8e774e2ee1bce
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371338
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Change-Id: I2bf8070fccacb21d2c5de56cdd9b6b77adb6c5a1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368876
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Split the :tests target into a :test target which contains the test
framework and :tests which collects all of the test cases. This allows
for all targets which define tests to depend on :test in order to define
tests, with :tests then depending on all targets which define tests. A
similar split should be considered for gms, samples, and benches.
Change-Id: Ic9f373ec0c1a8ea842fa68327e854db23477caae
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/371696
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
This change will allow these types to be forward-declared; C++ doesn't
allow forward declaration of types declared inside a struct. Moving
these types out of Programs resulted in a large diff.
The Settings::Value helper class has been moved inside of the
IRGenerator. In practice, it was actually just an implementation detail
of how IRGenerator looks up caps-values by name. It seems very unlikely
that this will be necessary elsewhere going forward.
Change-Id: I6119417fae608f1c492a27de746d2b550ef8ca20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/370836
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This reverts commit e89b50ae05.
Reason for revert: landed Android fix at http://ag/13544365 (master) and
http://ag/13554983 (sc-dev)
Original change's description:
> Android roll broke with a compilation error:
> frameworks/base/libs/hwui/jni/Shader.cpp:243:37: error: no matching function for call to 'get'
> sk_sp<SkRuntimeEffect> effect = std::get<0>(result)
>
> Revert "Remove deprecated form of SkRuntimeEffect::Make."
>
> This reverts commit 1cda194366.
>
> Reason for revert: <INSERT REASONING HERE>
>
> Original change's description:
> > Remove deprecated form of SkRuntimeEffect::Make.
> >
> > Chromium has migrated to the new API at https://crrev.com/c/2675855.
> >
> > Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
> > Reviewed-by: Brian Osman <brianosman@google.com>
> > Commit-Queue: Brian Osman <brianosman@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
>
> TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
>
> Change-Id: Ie18f865f3b7f5b0263db1e52b19cf6faa0500fdd
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368616
> Reviewed-by: Stan Iliev <stani@google.com>
> Commit-Queue: Stan Iliev <stani@google.com>
TBR=mtklein@google.com,brianosman@google.com,stani@google.com,johnstiles@google.com
Change-Id: I9d679013cb275dc80aaaa977b7f1f4da31f36d1e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/369037
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Plumb lighting props and implement a Phong lighting model.
This is ~40% slower with the SW backend - to mitigate, construct two
runtime effects and only apply fancy lighting when needed.
Change-Id: If6f71253e7adc148f6d5cf5fbde2c1dff977f669
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368246
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
frameworks/base/libs/hwui/jni/Shader.cpp:243:37: error: no matching function for call to 'get'
sk_sp<SkRuntimeEffect> effect = std::get<0>(result)
Revert "Remove deprecated form of SkRuntimeEffect::Make."
This reverts commit 1cda194366.
Reason for revert: <INSERT REASONING HERE>
Original change's description:
> Remove deprecated form of SkRuntimeEffect::Make.
>
> Chromium has migrated to the new API at https://crrev.com/c/2675855.
>
> Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
> Auto-Submit: John Stiles <johnstiles@google.com>
TBR=mtklein@google.com,brianosman@google.com,johnstiles@google.com
Change-Id: Ie18f865f3b7f5b0263db1e52b19cf6faa0500fdd
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368616
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Stan Iliev <stani@google.com>
Chromium has migrated to the new API at https://crrev.com/c/2675855.
Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
ResourceProviderProxyBase is supposed to forward all virtuals to fProxy,
but it currently drops loadAudioAsset().
TBR=
Change-Id: I8c690802cd3ba6078232e210b032aa67499d7ba8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/368116
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Written to use the exact same names and semantics as particles.
Cq-Include-Trybots: luci.skia.skia.primary:Test-Debian10-EMCC-GCE-CPU-AVX2-wasm-Release-All-CanvasKit,Test-Debian10-EMCC-GCE-GPU-AVX2-wasm-Release-All-CanvasKit
Change-Id: I4031efbce06527a519f1ce8c261f79231554e1ef
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365701
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Also adds an example particle system that uses uniforms, and an instance
of the particles GM that draws it.
Change-Id: I64e2514fd17c8ce615b4e13b9f82424f80b8424e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356840
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This allows us to control the inline threshold of runtime effects in a
thread-safe way.
The new Make API now returns a struct, for readability; the old Make API
continues to return a tuple.
The old Make function is deprecated and subject to removal. You can
migrate to the new API by passing a default-constructed Options struct.
In this case there will be no difference in behavior.
Change-Id: Ic62d6f294f596d0a61095e35a87ccdbbe0b1cf93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363785
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Remove/rename some fields now that data migration is done, adjust
comments to reflect new data, etc.
Change-Id: I77a8ff182fc73699407eb711a54cf5642f23c257
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365480
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
It would otherwise be difficult/tedious/not-backwards-compatible
to return the RuntimeEffect AND the error message.
Change-Id: I9bdbafb653398ccbb72e6e762ec4b6af294f9110
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/365483
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
https://www.w3.org/TR/SVG11/struct.html#ImageElement
Supported reference types are data and non-local URIs. Resource loading
requires a ResourceProvider to have been set on the render context.
Not handled in this CL:
- preserveAspectRatio support
- SVG reference types (i.e. '<image xlink:href="file.svg" ...')
Bug: skia:10842
Change-Id: Ieec7569f60516b01fc847f4160d0733b1e3a1cf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/364576
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Implement CC Sphere.
No lighting support for now (matches AE's Light Intensity: 0,
Ambient: 100).
Change-Id: I7eb4d8f9c5dd4b4cb312321cefee0231a9901873
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362457
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Change-Id: Ic53dc7ecab1b44761fe06e6b528864d24cc5fa58
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363940
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This will make cleaning up the PosTan value easier.
Change-Id: I13aa12f94c560bf8539aa2edb1f9e13779635692
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362458
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Using value_array (and value_object), while convenient,
adds a measurable overhead. This removes the Point value_object
and replaces it as a return value with Float32Array
(similar to rects). For inputs of a single point, I just
split it into x and y. For inputs with two points, I used
a _scratchFourFloats (formerly _scratchRect) bit of memory.
Two subtle decisions here:
- Why not use scratch memory for a single point? The cost of
having one extra param is a small/negligible price to pay
for less complex code.
- Why not accept Malloc objects? Again, simplicity. Accommodating
Malloc would make the code harder to read and require more
checks. I don't know if anyone wants to have malloced points;
if they do, we can probably accommodate that.
Change-Id: I1b1c29f62e01c2f1c8c1218f58e3bad642214322
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362097
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Not currently used, but will be used for <image> support.
Change-Id: I3bbb79c88890100901a8b85734d3a4d86a618848
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360605
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This is a reland of 2c3cec998f
Original change's description:
> [canvaskit] Break up helper.js into smaller files
>
> This will hopefully make some things easier to find/understand.
> I have a few more ideas for breaking up other parts.
>
> Bug: skia:11203
> Change-Id: Ia54c13fd6e3c897e04a737b258f6e77c50a1aed3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356839
> Reviewed-by: Nathaniel Nifong <nifong@google.com>
Bug: skia:11203
Change-Id: I8850e8e9e5f39f537232e0f1f8a814f763ab7853
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363942
Reviewed-by: Kevin Lubick <kjlubick@google.com>
TSAN caught this when I added particle GMs.
Change-Id: I6c03afe4b7a4323c7b8d8a1eaf197ff9aa76a09c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362498
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This reverts commit 964b4465c4.
Reason for revert: Earlier CL needs revert
Original change's description:
> Add particle GM that uses uniforms, fix related bug in particle effect
>
> We weren't allocating uniform storage until after the first update, far
> too late for users to pump uniform values in. They're now allocated as
> soon as the effect is created, which is tested by the new GM.
>
> Change-Id: Ia0084bcec5986479c350ead27d14344c3ed82520
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362176
> Reviewed-by: Brian Osman <brianosman@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
TBR=brianosman@google.com
Change-Id: Ib6f963840af2abba0a4e6b99185f4010b61dde54
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362418
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The gms are failing to link at the moment with the current build.
Change-Id: I3c73c68c9bfd053ffb2687e54ed9d0899dadca5a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362337
Reviewed-by: Brian Osman <brianosman@google.com>
We weren't allocating uniform storage until after the first update, far
too late for users to pump uniform values in. They're now allocated as
soon as the effect is created, which is tested by the new GM.
Change-Id: Ia0084bcec5986479c350ead27d14344c3ed82520
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362176
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This CL adds a type enum to SkSVGIRI that will eventually be used to
distinguish between local fragments ('#frag-id'), non-local fragments
('/path/to/file.png') and data URIs ('data:image/png;base64,...').
To do so required a bit of refactoring of other types that previously
treated IRIs as basic strings. There are no functional changes in this
CL.
Change-Id: I8bf426f77c0779890bce74d2d243c09617f024c8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360601
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This will hopefully make some things easier to find/understand.
I have a few more ideas for breaking up other parts.
Bug: skia:11203
Change-Id: Ia54c13fd6e3c897e04a737b258f6e77c50a1aed3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356839
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Allows the user to signal that any global outstanding cached data should
be cleaned up to free resources.
Change-Id: I59d4bb2bbb4356920dea8caf912d9cb5f13014cf
Bug: skia:10763
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360079
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
https://www.w3.org/TR/SVG11/filters.html#feSpecularLightingElement
Because a fair amount of functionality will be shared between
feSpecularLighting and feDiffuseLighting, this CL adds an intermediate
SkSVGFeLighting base class for common code.
The only light source type implemented in this CL is fePointLight, which
exercised by the filters-light-03 W3C test.
Bug: skia:10841
Change-Id: Icae26dedb1aae1cd25ba2db7c6468a243ebacbc5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359756
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
I had to stage the change with SK_PARAGRAPH_GRAPHEME_EDGES because of
some google3 tests.
Bug: skia:11196
Change-Id: Ic45e43e6c69f649c6bc0fedcc6f303891139b85e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359566
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
This makes ParagraphCache::abandon just forward to
ParagraphCache::reset. This removes re-entering fParagraphMutex and an
empty loop.
Change-Id: I1f31474ec4e381c71e6eba062ba572a1c29d1a6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359839
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
https://www.w3.org/TR/SVG11/filters.html#LightSourceDefinitions
The three classes represent light source elements that will eventually
be used for feSpecularLighting and feDiffuseLighting. Currently they are
unused.
Also added the (currently unused) lighting-color presentation attribute.
Bug: skia:10841
Change-Id: Ic7824671662b8cd88cf627affc54173d5e881b7d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359557
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Enables use of text as a clip path.
Bug: skia:10840
Change-Id: I9de40e23696083e8cdd7e0b82221da3f3c36ac8b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358533
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
In preparation for text bounding box support, fission the actual
rendering phase from the shaping/alignment phase:
- rename onRenderText -> onShapeText
- introduce a ShapedTextCallback abstraction for consuming the result
of text processing
- relocate the final rendering step to a ShapedTextCallback impl
Bug: skia:10840
Change-Id: Ia8cc0d9a5a5484972a34042fd782f9e4fada6b12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358223
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Per spec [1], unspecified inputs ('in', 'in2' attributes) have different
meaning depending on whether the referencing filter is the first in the
pipeline. This CL adds previous result tracking to the filter context
and handles unspecified values accordingly during input resolution.
[1] https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveInAttribute
Bug: skia:10841
Change-Id: I64618ad712979f6dd62adb4686085fe31618c3cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357278
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Per spec (and empirically) <text> elements are not nestable (neither
directly or indirectly):
https://www.w3.org/TR/SVG11/intro.html#TermTextContentChildElement
Update the implementation to
- only bridge onRender -> onRenderText in the root SkSVGText
implementation
- disallow <text> elements as text container descendants
Change-Id: I07b3abaf943b820e01c88f78bddf7ce5970ee508
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358220
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
No longer used. Remove old numerically unstable scaling.
Change-Id: I3aa05369167377e0277eaca155536c2f1e8036b3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356379
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Change-Id: Ib150e6d6d3de34a85ce8051eea843ab3b2d7ab75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356921
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Also cleanup some of the duplicate code in SkRecords
Bug: skia:7650
Change-Id: I4d3167a892c126c19a54002beab25c9a6c96fa5d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357000
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This was the last remaining user of ByteCode. The skvm solution
is faster, and lets us delete the ByteCode system.
Testing on 15 instances of sinusoidal_emitter (90k particles):
- ByteCode ~9 ms
- ByteCode (older, optimized): ~5.5 ms
- skvm ~2.1 ms
Change-Id: Ia2e5c9ab2d36c97e59af28a6f989bf212889e439
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356919
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
The basic problem was that WasmContextInfo shadowed non-virtual members
of ContextInfo. the tests, which work with that type, end up calling the
super class's methods which return null for directContext()
The context created and stored in WasmContextInfo would have worked if it
could be returned, but I've opted to go with what looks like a more
canonical way to test a new backend, that is to create a platform-
specific subclass of GLTestContext, and let GrContextFactory create the
GL context.
Bug:skia:10869
Change-Id: Ie9e1142cf2e7268242ff9aab70f76151714850a3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355116
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
- Allow resolving inputs without modifying their colorspace
- Add helper to get the colorspace of a particular input
- Make resolveColorspace() virtual and add filter context to its
signature
Bug: skia:10841
Change-Id: I2e226ec26205f527c2d171140072f106ec35fbe0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356416
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Without the "spawn another effect" binding (that was recently removed),
these serve no purpose.
Change-Id: Ica8cc3f444c6b749c634c41453501edfff9d9a23
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356417
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Instead of attempting to keep fill & stroke SkPaints synchronized with
the current presentation attributes throughout the DAG walk, build the
SkPaints on the fly, only when needed.
This simplifies presentation attribute handling and enables further
/future refactoring.
Change-Id: I3791b4244530644e7e4b983d93b3c966ea7a1b22
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355096
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
The hb_position is always tracked in 16.16 now, so take direct advantage
of that instead of relying on the ratio of the requested size and size
as known by HarfBuzz. This avoids potential issues with division of zero
by zero when shaping zero sized fonts.
Bug: oss-fuzz:29240
Change-Id: I9715629034008552f88afd4feb1074a11cae15e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354117
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Property inheritance is supposed to follow the tree hierarchy, but we
implement it based on the render path.
One nasty side effect is when resolving IRI paint servers
(gradients, patterns), the referencing node properties get inherited
(leak) into the paint server fragment. E.g.
<pattern id="pat">
<rect fill="green"/>
</pattern>
<rect stroke="blue" fill="url(#pat)" stroke="blue"/>
The pattern subtree incorrectly inherits a blue stroke property from
the referencing node when we resolve the fill.
As a temporary (and imperfect) workaround, we can reset the presentation
context when resolving IRI paint servers.
Change-Id: Ia4a8a6199222820661f805c43340b5e16902feff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354668
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Note we are still not passing filters-blend-01-b because we don't yet
support feImage.
Bug: skia:10841
Change-Id: Ibca52c0e8e8d45e73473dea3b0252d6b81eaa584
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354657
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Also fix a crash if you try to play an effect that has never compiled
correctly. (After the first compile, the arrays were always large enough
to set "dt" -- this code is all going to be reworked soon for SkVM, but
I hit this while diagnosing the type coercion error).
Change-Id: I5bfab539c7304bde2da36b0b0604991d5b5b303a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354660
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
When both filter and opacity attributes are set on a leaf node, the
opacity must be applied as a separate layer so that the results of the
filter are modified by the opacity. Previously in this circumstance we
were incorrectly applying the opacity to the paints only (without a
layer).
To illustrate:
<svg viewBox="0 0 1000 500" version="1.1"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<filter id="Green" x="0%" y="0%" width="100%" height="100%">
<feFlood flood-color="lime" flood-opacity="1" />
</filter>
</defs>
<rect x="30" y="20" width="400" height="100" fill="red" opacity="0.1"
filter="url(#Green)"/>
<g filter="url(#Green)">
<rect x="30" y="200" width="400" height="100" fill="red" opacity="0.1"/>
</g>
</svg>
The two rects should render differently. In the <g> case, the filter
output (opaque green) overrides the translucent red pixels of the rect.
In the <rect> case, the filter output overrides the translucent red
pixels with opaque green, but then is modified by the opacity on the
<rect>.
Relevant W3C test is filters-blend-01-b (and possibly others).
Change-Id: I165eed36c546f1f99457865cee58ee2b3bffe6f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354879
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Per spec, the explicit <mask> bounds [x,y,w,h] are used to also clip
the content (the actual mask geometry may extend beyond these bounds).
This clip is currently scoped such that it applies both to the mask
layer and the content layer. When the clip is not pixel-aligned,
we're anti-aliasing both layers' edges -- which darkens the composition
result (producing dark hairlines around the mask).
Push the clip down such that it applies to content only.
Change-Id: I32169e2b6dc9685e50a51c6b22cfaaac1a897239
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354217
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
From the spec [1], if any inputs of a filter are one of the standard
inputs (SourceGraphic, FillPaint, etc. -- anything except another
filter), then the default filter primitive subregion is equal to the
filter effect region.
[1] https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion
Bug: skia:10841
Change-Id: I70632e5119861c46c9e48af944d2c7cfdfc3c351
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354119
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Previously we were using fX and fY as the top left of the returned
bounds. We need instead to offset the referenced node's bounds by fX,
fY.
While I was here I updated the attribute parsing to the new form and
changed the type of fHref from SkSVGString to SkSVGIRI.
Change-Id: I4bfb91bca62e47f5dabfbb4aad48cbb301a7ea36
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/354118
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
The input may contain invalid text constructs lacking a root <text> node
e.g. <svg><tspan>foo</tspan></svg>
Since we don't perform content model validation at the moment and text
contexts are only instantiated for root nodes, we must guard against
this case at render time.
Bug: oss-fuzz:29558
Change-Id: I7e39c1c4048900ce5becb3549802dc66bb1d242b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353711
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
https://www.w3.org/TR/SVG11/masking.html#Masking
Implement masking based on a classic two-layers + kSrcIn blending
approach.
An additional layer is used to filter the mask content (but could be
avoided in a pinch -- see inline comments).
Also consolidate the objectBoundingBox rect resolution logic as
SkSVGRenderContext::resolveOBBRect().
Bug: skia:10842
Change-Id: I273318e97cc28d599d1ecf01706b6117eecb62d5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353631
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
This reverts commit 36acb7b10c.
Reason for revert: artifacts in 1010102 are expected
Original change's description:
> Revert "[svg] Perform colorspace conversions for filter effects"
>
> This reverts commit a0880eda22.
>
> Reason for revert: visual artifacts in 10-bit color depth (10-10-10-2)
>
> Original change's description:
> > [svg] Perform colorspace conversions for filter effects
> >
> > A filter effect can optionally be specified to operate in either sRGB
> > or linearRGB, according to the SVG spec:
> >
> > https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties
> >
> > This CL adds any necessary conversion steps (SkColorFilters) while
> > constructing the filter DAG. The default filter effect color space is
> > linearRGB. We should now be passing the filters-gauss-* W3C tests.
> >
> > Specific changes:
> > - Tag filter effect results with their colorspace when storing them in
> > the filter context map
> > - Add an SkColorFolor conversion step as necessary when resolving filter
> > effect inputs
> >
> > Bug: skia:10841
> > Change-Id: Ide12698ea64c4d40f09df93a60718788809086fa
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353078
> > Commit-Queue: Tyler Denniston <tdenniston@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
>
> TBR=fmalita@chromium.org,tdenniston@google.com
>
> Change-Id: Id4a33c49643039cfb2d2867a1513e8ee1d7b181a
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10841
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353630
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>
TBR=fmalita@chromium.org,tdenniston@google.com,johnstiles@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:10841
Change-Id: Id6d9e01d9b18ebfb6f9a6cb74518ad5cd73ea00a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353777
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This reverts commit a0880eda22.
Reason for revert: visual artifacts in 10-bit color depth (10-10-10-2)
Original change's description:
> [svg] Perform colorspace conversions for filter effects
>
> A filter effect can optionally be specified to operate in either sRGB
> or linearRGB, according to the SVG spec:
>
> https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties
>
> This CL adds any necessary conversion steps (SkColorFilters) while
> constructing the filter DAG. The default filter effect color space is
> linearRGB. We should now be passing the filters-gauss-* W3C tests.
>
> Specific changes:
> - Tag filter effect results with their colorspace when storing them in
> the filter context map
> - Add an SkColorFolor conversion step as necessary when resolving filter
> effect inputs
>
> Bug: skia:10841
> Change-Id: Ide12698ea64c4d40f09df93a60718788809086fa
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353078
> Commit-Queue: Tyler Denniston <tdenniston@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
TBR=fmalita@chromium.org,tdenniston@google.com
Change-Id: Id4a33c49643039cfb2d2867a1513e8ee1d7b181a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10841
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353630
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
A filter effect can optionally be specified to operate in either sRGB
or linearRGB, according to the SVG spec:
https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties
This CL adds any necessary conversion steps (SkColorFilters) while
constructing the filter DAG. The default filter effect color space is
linearRGB. We should now be passing the filters-gauss-* W3C tests.
Specific changes:
- Tag filter effect results with their colorspace when storing them in
the filter context map
- Add an SkColorFolor conversion step as necessary when resolving filter
effect inputs
Bug: skia:10841
Change-Id: Ide12698ea64c4d40f09df93a60718788809086fa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353078
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Gate this behind an ifdef that can be disabled in environments where
the ICU ubrk_safeClone API is not available.
Change-Id: Ia1a3f677271622f2b7ae478b4d1ce76c74eed057
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352876
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
The default colorspace for filter effects is linear RGB, as specified in
https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties.
Currently we perform all filtering in the destination colorspace. This
CL adds the new presentation attribute with the default setting
(according to the spec) of linear RGB.
This CL does not actually implement any colorspace transformations for
filters.
Bug: skia:10841
Change-Id: Id778ad3fa5cb6e0aed756584a50880edd9d82e2b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352738
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Introduce SkSVGMask and plumb related attributes.
Also consolidate the clip/mask/filter property types - they all support
the same values: <funciri>|none|inherit.
Bug: skia:10842
Change-Id: If45a75cccc19b84d6547237336fe5d562a85d594
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353436
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
- introduce SkSVGTextPath and update the text render logic to
instantiate new SkSVGTextContexts in onRenderText() overrides
instead of renderText() root -- this is to observe spec semantics
[1] requiring <text> and <textPath> to always start a new chunk,
regardless of their relative nesting.
- expand SkSVGTextContext to also store PathData when used in the
scope of a textPath
- PathData caches SkContourMeasures, for path position lookup
- update flushChunk() to apply path glyph adjustments [2]:
* the horizontal glyph position (including relative offset dx),
adjusted for the glyph center yields a path offset
* if the offset is outside the path range, the glyph is skipped
* otherwise the position is determined based on the path matrix
at the computed offset
- to support the logic above, the chunk starting position is no
longer used as a global blob offset but instead is folded into
individual glyph RSXforms (and the blob always draws at {0,0})
[1] https://www.w3.org/TR/SVG11/text.html#TextLayout
[2] https://www.w3.org/TR/SVG11/text.html#TextpathLayoutRules
Bug: skia:10840
Change-Id: I462eada7c086646afdc1bc84f08ec2368613f1c0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/349397
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
This is no longer used, and the current design is fairly incompatible
with skvm.
Change-Id: Ibebb9b42a0f4277c333839c3d1e9cf0f691b37cc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/353079
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This filter implementation should be complete, but note we are still
not quite passing the W3C filters-gauss-* tests because our filters
currently operate in sRGB and not linear RGB (which is quite noticable
in some of the blur tests).
Bug: skia:10841
Change-Id: I706cde879ef6eb47ce586279999536cf67237f13
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352506
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Also removed an erroneous call to mapToRect() when returning bounds
for SkSVGContainer. The contexts in which we access object bounds are
always such that any transforms have already been applied.
Change-Id: Ieac488e1699d3ebff56038d6ada36737291671eb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345117
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Previously, these were in SkSL::Context directly. This change doesn't
remove them from the context entirely, but it gives them a dedicated
subclass and firewalls them off from the rest of the context.
Change-Id: I0c344bf7436a11b8494a5fe7542d0a4ef1ece964
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352502
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Spec: https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion
The filter primitive subregion restricts the output of a specific <fe*>
node in a filter DAG. By default it's equal to the union of subregions
of all input filters, or the filter region if no inputs exist. If
x/y/w/h are specified on the <fe*> node, those are used to bound the
primitive subregion instead.
In this CL:
- Implement the computation of the primitive subregion in
SkSVGFe::resolveFilterSubregion
- Add primitiveUnits to filter context
- Change result registration (by string ID) in filter context to include
the primitive subregion of that result. This is needed because filters
referencing previous results need access to those primitive subregions
to compute the union.
Bug: skia:10841
Change-Id: I66fbb4979e3c65cb5e5cc61f98286ec7ad023438
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344666
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Is not used by a major client and can be implemented using runtime
effects for users who want this noise.
Bug: skia:10536
Change-Id: Iaa06e6e1406b808c7f8dc0f76621fecf2becabf5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/352057
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
The skia gn/ninja build step and the emscripten build step were using
a different set of defines. this violated assumptions of a couple of
tests
Change-Id: Id5364c0e1281b2e4024685fe8f106ee55c4961cb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338343
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Change SkBase64::decode interface completely and better document
how to use. Unfortunately there are users of ::decode (and they are
leaking) so will need to keep the old interface until users can be
updated.
Change-Id: I214b771136d78fef758c5d0d9ec302f956f6e4f0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/351201
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Previously ExternalValues were flexible, and could be used as raw values
(with the ability to chain access via dot notation), or they could be
callable. The only non-test use-case has been for functions (in
particles) for a long time. With the push towards SkVM, limiting
ourselves to this interface simplifies things: external functions are
basically custom intrinsics (and with the SkVM backend, they'll just get
access to the builder, and be able to do any math, as well as
loads/stores, etc).
By narrowing the feature set, we can rename everything to reflect that,
and it's overall clearer (the SkSL types now mirror FunctionReference
and FunctionCall directly, particularly in how they're handled by the
CFG and inliner).
Change-Id: Ib5dd34158ff85aae6c297408a92ace5485a08190
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/350704
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Implement support for text 'rotate' attribute:
https://www.w3.org/TR/SVG11/text.html#TSpanElementRotateAttribute.
Unlike other character-positioning attributes (x/y/dx/dy), rotate
- is not cumulative
- only applies to its respective node scope (does not affect other
fragments in the current chunk)
- has different padding semantics: if there are fewer rotate
values than characters, the remaining characters use the last
specified value from the closest ancestor
To the last point, we now have to discriminate three states:
- unspecified (default -> 0)
- explicit value for the given character index
- implicit value (last value in the closest ancestor)
Local implicit values override implicit ancestor values -- but not
explicit ancestor values.
High level changes:
- plumb 'rotate' attribute
- expand per-character position info (ShapeBuffer) to include rotation
- expand per-glyph position info (RunRec) to include rotation
- expand PosAttrs to include rotation and add specific inheritance
rules (see above)
- pass computed rotation values to RSX blob buffers
Bug: skia:10840
Change-Id: Ia19ec5e8bb6fea06d49a9bd72ace575c2ffd100e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348877
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
This reverts commit 8f924ac0ce.
Reason for revert: suppressions landed for fuchsia images to rebaseline
Original change's description:
> Revert "Add new virts, hide old ones"
>
> This reverts commit c56e2e5aa6.
>
> Reason for revert: suspected of breaking chrome roll
>
> Original change's description:
> > Add new virts, hide old ones
> >
> > Add virtuals for the draw methods that now take sampling/filtermode.
> >
> > drawImage
> > drawImageRect
> > drawImageLattice
> > drawAtlas
> >
> > Add a flag that can remove the older virtuals, once each client has
> > stopped overriding them. In that situation, the older public methods
> > will simplify extract the sampling from the paint, and call the new
> > public methods.
> >
> > Bug: skia:11105, skia:7650
> > Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> > Commit-Queue: Mike Reed <reed@google.com>
> > Reviewed-by: Florin Malita <fmalita@chromium.org>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,fmalita@chromium.org,reed@google.com
>
> Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:11105
> Bug: skia:7650
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>
TBR=djsollen@google.com,bsalomon@google.com,fmalita@chromium.org,reed@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:11105
Bug: skia:7650
Change-Id: Ia2b4537a2d330460b7554278d2c05075cf27162a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348876
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This reverts commit c56e2e5aa6.
Reason for revert: suspected of breaking chrome roll
Original change's description:
> Add new virts, hide old ones
>
> Add virtuals for the draw methods that now take sampling/filtermode.
>
> drawImage
> drawImageRect
> drawImageLattice
> drawAtlas
>
> Add a flag that can remove the older virtuals, once each client has
> stopped overriding them. In that situation, the older public methods
> will simplify extract the sampling from the paint, and call the new
> public methods.
>
> Bug: skia:11105, skia:7650
> Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Florin Malita <fmalita@chromium.org>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
TBR=bsalomon@google.com,fmalita@chromium.org,reed@google.com
Change-Id: I0a90952c11a180d918126ea06a630f4a0bf9b49b
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:11105
Bug: skia:7650
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/348194
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Add virtuals for the draw methods that now take sampling/filtermode.
drawImage
drawImageRect
drawImageLattice
drawAtlas
Add a flag that can remove the older virtuals, once each client has
stopped overriding them. In that situation, the older public methods
will simplify extract the sampling from the paint, and call the new
public methods.
Bug: skia:11105, skia:7650
Change-Id: I8b0029727295caa983e8148fc743a55cfbecd043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347022
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
SkPaintPriv methods are just an internal stopgap
Change-Id: Ibe6e37c5871068d8cd67dc0948961444dfd2b62a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347041
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
uint (and bitwise operations) aren't supported by our minimum spec, and
they're going to be removed from public SkSL. For now, convert the
random generator to a good-enough chaotic sequence of high-frequency
sine waves.
If/when the interpreter (and particles) are converted to the newer skvm
backend, it will be straightforward to support custom intrinsics that
emit skvm instructions directly into the builder, and re-introduce a
better integer-based PRNG, without requiring SkSL language support.
Bug: skia:11093
Change-Id: I885b15a51a9e5c12b4274b5938d8deb77219d41b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/347036
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
... and lots and lots of IWYU
Change-Id: Ie5157dcdd2e6d29b95c71b39153278ab48ef4eb3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346778
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
No longer used by any example content, and it requires unsigned integers
and bitwise ops (which are both going to be hidden from public SkSL).
Bug: skia:11093
Change-Id: I1941f7a1bed6c8512a5117ef256d18e420cbabee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346779
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Introduce support for relative position adjustments [1]:
- plumb dx, dy attributes
- extend ScopedPosResolver to also handle the new attributes
- introduce ShapeBuffer to store both utf8 text and position
adjustments for shaping (replaces prev 'filtered' array).
- position adjustments are cumulative (relative adjustments affect
all following characters)
- utf8 encoding is variable length; for simplicity, ensure that the
pos adjustment array and the utf8 array are always the same size by
repeating the pos adjustment times number of utf8 bytes
- introduce a temporary buffer for retrieving utf8 cluster information
from SkShaper
- post-shaping, use the utf8 cluster info to map back to character
indices and apply the associated position adjutment
[1] https://www.w3.org/TR/SVG11/text.html#TSpanElementDXAttribute
Bug: skia:10840
Change-Id: Ia9f227f91723400711ff2b5d260976290da1e2e5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346636
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
No known clients (CanvasKit, Android) want to ignore the exif
orientation in an animation.
A follow-on CL will deprecate SkAndroidCodec::ExifOrientation, leaving
it up to the client (e.g. SkAnimatedImage, hwui/ImageDecoder) to
handle the orientation. Add SkEncodedOriginSwapsWidthHeight to assist
clients to do so.
Update stoplight_animated_image GM. It previously showed using
SkAnimatedImage without respecting the orientation, which is no longer
supported. The new version replaces the left half of the image with the
right.
Remove assert that is no longer true. Originally, an SkAnimatedImage was
"simple" if it did not have a crop or postProcessor. This is no longer
true if has an exif orientation. Add a test that calls the simple
constructor and verifies it does not crash.
Change-Id: I421fd02700f220fb90458cd03c4431dee7daf399
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344762
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
This reverts commit e2f6245352.
Reason for revert: relanding with fixes
Original change's description:
> Revert "[svg] Absolute positioning support for text"
>
> This reverts commit febb1b87a5.
>
> Reason for revert: breaking the android roll
>
> Original change's description:
> > [svg] Absolute positioning support for text
> >
> > Implement per-character position attribute lookup based on [1]:
> >
> > - convert "x" and "y" attributes to arrays
> > - introduce ScopedPosResolver to handle positioning attribute lookup
> > and fallback
> > - push a new resolver every time we enter a text positioning element
> > scope (<text>, <tspan>, etc).
> > - flush/reposition a new text chunk every time we encounter explicit
> > absolute positions
> >
> > The position attribute fallback logic is complex enough to warrant a
> > unit test.
> >
> > [1] https://www.w3.org/TR/SVG11/text.html#TSpanElementXAttribute
> >
> > Bug: skia:10840
> > Change-Id: I66c478fea4a179fdb8b1a6a9ff00c4dd9509f8d2
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345161
> > Commit-Queue: Florin Malita <fmalita@chromium.org>
> > Commit-Queue: Florin Malita <fmalita@google.com>
> > Reviewed-by: Tyler Denniston <tdenniston@google.com>
>
> TBR=fmalita@chromium.org,fmalita@google.com,tdenniston@google.com
>
> Change-Id: I80e3396d555369fe835ee73102135061f63e8bf0
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:10840
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345417
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Derek Sollenberger <djsollen@google.com>
TBR=djsollen@google.com,fmalita@chromium.org,fmalita@google.com,tdenniston@google.com
# Not skipping CQ checks because this is a reland.
Bug: skia:10840
Change-Id: I4c6f6a9f19c0f7598bdcf34e915f43c139b995a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345420
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
This reverts commit febb1b87a5.
Reason for revert: breaking the android roll
Original change's description:
> [svg] Absolute positioning support for text
>
> Implement per-character position attribute lookup based on [1]:
>
> - convert "x" and "y" attributes to arrays
> - introduce ScopedPosResolver to handle positioning attribute lookup
> and fallback
> - push a new resolver every time we enter a text positioning element
> scope (<text>, <tspan>, etc).
> - flush/reposition a new text chunk every time we encounter explicit
> absolute positions
>
> The position attribute fallback logic is complex enough to warrant a
> unit test.
>
> [1] https://www.w3.org/TR/SVG11/text.html#TSpanElementXAttribute
>
> Bug: skia:10840
> Change-Id: I66c478fea4a179fdb8b1a6a9ff00c4dd9509f8d2
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345161
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Tyler Denniston <tdenniston@google.com>
TBR=fmalita@chromium.org,fmalita@google.com,tdenniston@google.com
Change-Id: I80e3396d555369fe835ee73102135061f63e8bf0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10840
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345417
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
Implement per-character position attribute lookup based on [1]:
- convert "x" and "y" attributes to arrays
- introduce ScopedPosResolver to handle positioning attribute lookup
and fallback
- push a new resolver every time we enter a text positioning element
scope (<text>, <tspan>, etc).
- flush/reposition a new text chunk every time we encounter explicit
absolute positions
The position attribute fallback logic is complex enough to warrant a
unit test.
[1] https://www.w3.org/TR/SVG11/text.html#TSpanElementXAttribute
Bug: skia:10840
Change-Id: I66c478fea4a179fdb8b1a6a9ff00c4dd9509f8d2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345161
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
We also include the CHANGELOG in the release notes.
Change-Id: Icbdedf124c114c2f4be757f408a437fda71c40ec
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345288
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Instead of relying on RenderContext to pass text rendering options
downstack, introduce a dedicated virtual (onRenderText) and pass options
explicitly.
Root text nodes bridge from onRender() -> onRenderText().
This removes some complexity from RenderContext and incidentally fixes
xml:space = preserve (the value was being dropped during local ctx
copying).
Bug: skia:10840
Change-Id: Ic5fd9e0f9382f52f65108521574fcb2a422b97aa
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344559
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
When the filter units are objectBoundingBox, values are fractions/pcts
of the object's bounding box, which we were miscomputing.
Also adding in a small tweak to return bounds for <polygon> elements
(will be needed for future filter tests).
Bug: skia:10841
Change-Id: I7fcac21258570d872672c42e99a9739a65c53e30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343520
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This probably isn't ideal, but it's a step to keep it compiling while we
get this utility up and running in a more permanent way.
Change-Id: I98f56fe28b98862000a134f697bb441d87e47f30
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344176
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Some of the SVG libraries, there appear to be some SYScalls
(getStreamFromFD) that are no longer included in an emsdk 2.0.10 build.
Change-Id: Ib6ac4c20186e79316cd5b2566ed2deb2d3e3d0af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344076
Reviewed-by: Kevin Lubick <kjlubick@google.com>
By using npm ci, we can make sure the versions of the helper
libraries (e.g. Karma, Jasmine) we are testing with locally
is the same as the versions we are using in the continuous
integration system.
The copying is needed because our docker recipe forces us
to run as not root, and this was causing some issues. As a
result, I changed the canvaskit test/perf to not re-use the
same file as pathkit does so copying was easier and the
dependencies between the two modules is broken.
Bug: skia:11077
Change-Id: Ib05890d666d3507d4f724a4ae298484629c7932a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343503
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Update pathkit too. I want to make sure we are up to date with testing
harnesses that could support testing as ES6 modules.
Bug: skia:11077
Change-Id: I1ecd8acbdf6ad47a5877aa7dbb6772406d2edb54
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343501
Reviewed-by: Kevin Lubick <kjlubick@google.com>
- Add primitiveUnits attribute to SkSVGFilter class
- Add optional x, y, width, height attributes to filter effect base
class (SkSVGFe)
- Add function to return list of inputs for all filter effects
- Add function to compute filter primitive subregion and use it in all
filter effect classes.
Currently the "primitive subregion" just returns the entire filter
effect region, so there should be no diffs on gold with this change.
Bug: skia:10841
Change-Id: I1de283bebe302c0710d6b09d62a2472787820a49
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343107
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
- Consolidate SVGColor resolution into one method in render context, now
that it's a shared type.
- Remove all instances of `~TypeName() override = default;`. The only
thing this provides is slight/unreliable protection against someone
inadvertently removing 'virtual' from the base class destructor. In
our case that is SkRefCnt, which I'm assuming has very low risk of
that happening.
- Clean up some .h copy/paste issues of the form
`#endif // Typename_DEFINED`
Change-Id: I67fb40b2828b010fb7fdd83046bc1eae1a476267
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Several related W3C tests still won't pass until we implement the filter
primitive subregion.
Bug: skia:10841
Change-Id: I9e4beb9da8aa769f23a979ad5116a38fcda85ca4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/343105
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Expand existing SkottieColorizeGM to also handle text properties and
add text-focused instance.
Update layer names in one of the json assets to match expected demo
prefix ($).
TBR=
Change-Id: I076229067523fe597be66c611a8653897f995bc8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342916
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This reverts commit ff7bfea4ab.
Reason for revert: several broken bots, e.g.
../SRC/skia/modules/skparagraph/src/TextLine.cpp:309:21: error: non-const lvalue reference to type 'skia::textlayout::TextLine::TextBlobRecord' cannot bind to a temporary of type 'void'
TextBlobRecord& record = fTextBlobCache.emplace_back();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original change's description:
> Cache text blobs computed by TextLine::paintText
>
> Change-Id: I7d4414fb64b14a714623e4c20199cab06e6ed18c
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342297
> Commit-Queue: Jason Simmons <jsimmons@google.com>
> Reviewed-by: Julia Lavrova <jlavrova@google.com>
TBR=jsimmons@google.com,jlavrova@google.com
Change-Id: I467c61eead7b0d8c190cb2f883b05537de97a08e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/342856
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
These are somewhat the first presentation attributes of their kind,
in that they are non-inherited but also not applied via canvas layers.
Implementation-wise the main difference is that these attributes are
not propagated through the fInherited field of the render context's
presentation attribute list.
Change-Id: I0909507b0ecbd21732b3f80c46a343f5a0a9bf7a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340661
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
This color type will be shared in paint, stop-color, and flood-color
attributes (mainly so they can use 'currentColor').
Change-Id: Ib4200ea729a91a0db5da069c68d64e5e8e3f5010
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/340617
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Introduce proper text shaping via SkShaper/drawTextBlob (to replace
SkTextUtils::DrawString).
Also add basic text layout support (text chunk alignment and default
fragment advances -- see [1]).
[1] https://www.w3.org/TR/SVG11/text.html#TextLayoutIntroduction
Bug: skia:10840
Change-Id: I246f899d2926d1e365dac06b414c8e1ab4371e1e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341736
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
These print out all the time when I'm testing things locally. :/
Change-Id: I110a80c5b59c3fa024bee99f1516853b1dfd05d9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341797
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Introduce classes to support text node nesting:
- TextContainer -- base class for nestable text containers
(<text>, <tspan> etc)
- TextLiteral -- actual text string/payload
Example structure mapping:
<text>Foo<tspan>Bar</tspan>Baz</text>
TextContainer[text]
TextLiteral["Foo"]
TextContainer[tspan]
TextLiteral["Bar"]
TextLiteral["Baz"]
Also add text layout state (SkSVGTextContenxt) to SkSVGRenderContext.
This will be used to track layout across a text subtree.
For now we don't touch rendering, so the output is quite garbled for
non-trivial text (no advance propagation -> things draw on top of each
other).
Bug: skia:10840
Change-Id: Ic6d3990ec8635b586f5d3d226be070fbf134e391
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/341236
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>