Commit Graph

1439 Commits

Author SHA1 Message Date
Tyler Denniston
209857c20f [svg] Parse data and non-local IRIs
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>
2021-02-02 03:46:59 +00:00
Mike Reed
9223665316 Guard legacy matrixtransforms, and expose new one
Bug: skia:11236
Bug: skia:11235
Change-Id: I53fc0532a6067c5b30fc0345ded95d50d9955d38
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363098
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
2021-02-01 22:10:39 +00:00
Kevin Lubick
3364579f83 [canvaskit] Move matrix helpers to their own file and make optional.
Change-Id: I904a491134d5e3b19de8b7c34dcde30f1fd2487e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362037
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-02-01 20:01:07 +00:00
Kevin Lubick
d1c6cc1692 Reland "[canvaskit] Break up helper.js into smaller files"
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>
2021-02-01 20:00:16 +00:00
Brian Osman
383168902b Particle refactor: Only have one code string, uniforms, etc.
Leverage the field visitor to temporarily support effects with the old
JSON layout.

See also: https://skia-review.googlesource.com/c/buildbot/+/363784

Change-Id: Ifab128172089fe9e570be96d7067c6c9d25aae9b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/363878
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
2021-02-01 19:29:48 +00:00
Brian Osman
7935900cad Make SkParticleEffect::RegisterParticleTypes thread-safe
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>
2021-01-30 23:04:50 +00:00
John Stiles
03da7cb8a3 Revert "[canvaskit] Break up helper.js into smaller files"
This reverts commit 2c3cec998f.

Reason for revert: broken in Google3?

http://test/ui?utm_source=tap-notifier&utm_medium=email&utm_campaign=buildcop#t=//third_party/skia/HEAD/modules/canvaskit:canvaskit_web_tests_chrome-linux&cl=354150879&p=skia.canvaskit&flags=CAMQBQ==

https://test.corp.google.com/ui#cl=354150879&prefer_presubmit=false

http://fusion2/invocations/b963e4f2-25af-4bab-93c3-2da799e56b15/targets/%2F%2Fthird_party%2Fskia%2FHEAD%2Fmodules%2Fcanvaskit:canvaskit_web_tests_chrome-linux/tests

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>

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

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: skia:11203
Change-Id: I6e953a702713fd81a02ff2776f61e923783a577b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362697
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
2021-01-30 06:25:29 +00:00
Brian Osman
38d8deae8f Revert "Add particle GM that uses uniforms, fix related bug in particle effect"
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>
2021-01-29 19:21:49 +00:00
Kevin Lubick
365949cf54 [canvaskit] Skip particles gms
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>
2021-01-29 19:17:08 +00:00
Mike Reed
99da77ae93 Pass sampling to drawImage
Bug: skia:7650
Change-Id: Ia0e02023ab65267e0be17ee1509c8562fe55d75a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362180
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2021-01-29 18:53:48 +00:00
Brian Osman
964b4465c4 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>
2021-01-29 18:01:48 +00:00
Mike Reed
0ab283aaf2 Revert "Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag"
This reverts commit 5817fe1069.

Reason for revert: broke GifTest

Original change's description:
> Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag
>
> Bug: skia:7650
> Change-Id: I7924efdbbb957c0453c5444796dc31f0b0f7459b
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361437
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

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

Change-Id: I1e6dc844b8780b332ef94234bed2e8fbdf60f8cf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:7650
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362179
Reviewed-by: Mike Reed <reed@google.com>
2021-01-29 17:25:45 +00:00
Mike Reed
5817fe1069 Hide SK_SUPPORT_LEGACY_DRAWIMAGE_NOSAMPLING flag
Bug: skia:7650
Change-Id: I7924efdbbb957c0453c5444796dc31f0b0f7459b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/361437
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2021-01-29 17:06:48 +00:00
Florin Malita
24df67d04e Reland "[svg] Plumb a ResourceProvider"
This is a reland of dd29e20904

Original change's description:
> [svg] Plumb a ResourceProvider
>
> ... for image loading.
>
> Update the SVG tools to pass local/FS resource providers.
>
> Change-Id: I2c0e446047da87f177fde0f23b7ea1f0a856e808
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359996
> Commit-Queue: Florin Malita <fmalita@google.com>
> Reviewed-by: Tyler Denniston <tdenniston@google.com>

Change-Id: I28de60b299fc89f46b090812fc632105143fb6da
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360607
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-01-27 21:12:23 +00:00
Tyler Denniston
e71f547302 [svg] Expand SkSVGIRI type
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>
2021-01-27 21:05:41 +00:00
Kevin Lubick
2c3cec998f [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>
2021-01-27 20:13:34 +00:00
Florin Malita
64400d95d6 Revert "[svg] Plumb a ResourceProvider"
This reverts commit dd29e20904.

Reason for revert: breaking the G3 roll

Original change's description:
> [svg] Plumb a ResourceProvider
>
> ... for image loading.
>
> Update the SVG tools to pass local/FS resource providers.
>
> Change-Id: I2c0e446047da87f177fde0f23b7ea1f0a856e808
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359996
> 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: If5f9673f9ff40dd5f8a8f9cf8f46a4342f29f31f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360602
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@google.com>
2021-01-27 18:53:31 +00:00
Ben Wagner
dd9449c23b Add SkShaper::PurgeCaches.
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>
2021-01-27 17:50:30 +00:00
Tyler Denniston
8eedcd2dea [svg] Partial implementation of feSpecularLighting
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>
2021-01-27 16:14:29 +00:00
Julia Lavrova
d20a1097e8 Round unresolved font blocks to grapheme edges
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>
2021-01-27 15:39:09 +00:00
Florin Malita
dd29e20904 [svg] Plumb a ResourceProvider
... for image loading.

Update the SVG tools to pass local/FS resource providers.

Change-Id: I2c0e446047da87f177fde0f23b7ea1f0a856e808
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359996
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-27 14:10:09 +00:00
Ben Wagner
1604ad6b48 Clean up ParagraphCache::abandon.
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>
2021-01-27 00:41:56 +00:00
Florin Malita
131decbf41 [svg] Fix node factories order
TBR=
Change-Id: I622581de30dd290b858fe99ece3ae85fd15a0c2f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/359918
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@google.com>
2021-01-26 23:14:23 +00:00
Tyler Denniston
32b3089618 [svg] Add light source classes and lighting-color pres attr
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>
2021-01-26 21:36:34 +00:00
Florin Malita
f661ec788b [svg] Text asPath() support
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>
2021-01-26 14:55:47 +00:00
Florin Malita
f9652245b4 [svg] Text object bounding box support
Implement onObjectBoundingBox() for SkSVGText.

Enables use of objectBoundingBox filters effects on text.

Bug: skia:10840
Change-Id: I84ab3df04683cb23073ba9ddc531abe4e5788e5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358476
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-25 21:37:59 +00:00
Tyler Denniston
f005c8a30b [svg] Implement feDisplacementMap
https://www.w3.org/TR/SVG11/filters.html#feDisplacementMapElement

Bug: skia:10841
Change-Id: Icf1a560b2d83e7954207fb1740e77193362b9fd4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356312
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-25 21:12:01 +00:00
Mike Reed
9911630fc2 Hide misc non-sampling draw methods
Related chrome CL:
https://chromium-review.googlesource.com/c/chromium/src/+/2646604

Bug: skia:7650
Change-Id: I1069a6151cb70bb6d2c743cf2513f47284c9df7b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358221
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Auto-Submit: Mike Reed <reed@google.com>
2021-01-25 17:54:56 +00:00
Tyler Denniston
7aea2ae902 [svg] Fix non-xy length scale factor
We were miscalculating percentage lengths that do not correspond to the
x or y axis. Spec:

https://www.w3.org/TR/SVG11/coords.html#Units_viewport_percentage

Change-Id: I5c02e101f3bf7f1f93be3e8718290f490638f9b8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/357279
Reviewed-by: Florin Malita <fmalita@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-25 17:12:46 +00:00
Florin Malita
c55c8c1e8e [svg] Generalize text shaping
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>
2021-01-25 16:40:16 +00:00
Tyler Denniston
bd91660b6e [svg] Handle unspecified filter effect inputs
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>
2021-01-25 15:18:16 +00:00
Florin Malita
302ea2e03c [svg] Cleanup text content model rules
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>
2021-01-25 14:49:16 +00:00
Ben Wagner
3193ff2716 Remove SK_SHAPER_HARFBUZZ_USE_BAD_SCALE
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>
2021-01-22 20:54:25 +00:00
Brian Osman
ce75036b3e SkSL: Remove ByteCode interpreter, generator, etc.
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>
2021-01-22 14:38:41 +00:00
Mike Reed
e02d7f844b More hiding of legacy drawImage calls
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>
2021-01-22 13:53:42 +00:00
Brian Osman
e89d8ea20b Update particle system to use skvm, rather than ByteCode
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>
2021-01-21 23:07:29 +00:00
Nathaniel Nifong
110367dcfc Fix most remaining wasm gm unit tests by correctly providing gl context
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>
2021-01-21 20:46:19 +00:00
Tyler Denniston
8a37fb2c60 [svg] Implement SourceAlpha input for filter effects
https://www.w3.org/TR/SVG11/filters.html#SourceAlpha

This is the last "trivial" filter input type.

Bug: skia:10841
Change-Id: I96a7c9ccd318dec3b2b3ddd656be714b6b8fc59e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356838
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-21 19:34:39 +00:00
Tyler Denniston
c7e482441e [svg] Several filter helper tweaks
- 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>
2021-01-21 19:23:39 +00:00
Kevin Lubick
6de1e52d0b [canvaskit] Properly downsample 4x4 matrices.
Also address feedback from Tuesday.

Change-Id: I4497e4112c758a071c834045d20a009397184254
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356837
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2021-01-21 18:14:04 +00:00
Brian Osman
14d336eeb7 Remove "death" functions from particle system
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>
2021-01-20 23:27:03 +00:00
Florin Malita
cdeabcaf57 [svg] Fix handling of root element position attributes
Per https://www.w3.org/TR/SVG11/struct.html#SVGElementXAttribute,
x/y have "no meaning or effect on outermost svg elements".

Change-Id: I028e3a4a1d91735d849e32874ae99d609fae4aaf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356308
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2021-01-20 19:13:17 +00:00
Tyler Denniston
4c89481be4 [svg] Implement feMorphology filter
https://www.w3.org/TR/SVG11/filters.html#feMorphologyElement

Bug: skia:10841
Change-Id: I0b0028fb815c490670f9f1e888770efb194a8f3b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/356107
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
2021-01-20 16:13:56 +00:00
Julia Lavrova
420a75d685 Include placeholder widths in minIntrinsicWidth
Bug: skia:11179
Change-Id: Ic69c5a54b142584eddb28351c326952f4dd77376
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355976
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2021-01-19 22:47:56 +00:00
Florin Malita
ea27de5cb7 [svg] Cleanup: use FP alpha for opacity
Update general opacity and stop-opacity to use float alpha.

Change-Id: I496b2d41d77c0123ea2a2e1f8f8e4b1377a98abc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/355627
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2021-01-19 19:22:49 +00:00
Florin Malita
bde06cc511 [svg] Cleanup: drop the presentation attribute SkPaint cache
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>
2021-01-19 15:58:55 +00:00
Ben Wagner
e9a8238d3c Avoid division by zero when shaping.
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>
2021-01-19 15:53:14 +00:00
Florin Malita
d414e600b2 [svg] Property inheritance workaround
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>
2021-01-15 22:19:16 +00:00
Tyler Denniston
a25e1a38dd [svg] Implement feBlend filter
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>
2021-01-15 19:45:56 +00:00
Brian Osman
bf061a32ef Fix an (int + float) error in "cube" particle demo
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>
2021-01-15 19:15:16 +00:00