Commit Graph

902 Commits

Author SHA1 Message Date
Florin Malita
bb7d95f0f0 [skottie] Cleanup: relocate Animator base class out of SkSG
Decouple animator semantics from the scene graph.

No functional changes, just shuffling code around.

TBR=
Change-Id: I9a4592c424d2f8eb45b1b5f3e1f4b885cfaff9f6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279421
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-26 20:50:10 +00:00
Julia Lavrova
a169b00a54 Respect grapheme clusters when wrapping text
Bug: skia:10075
Change-Id: I52fad5db0944e74c780c1dbfa0c8e6eb7fa42cf1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278468
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-03-26 18:33:29 +00:00
Nathaniel Nifong
e5d3254ece Reland "Switch to using a Float32Array (bound as value array) for color."
This is a reland of 4e79b6730d

Original change's description:
> Switch to using a Float32Array (bound as value array) for color.
> 
> Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

Change-Id: If6b9097b2fcd6b9dbf75c6dd22138e0b2531e70d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278780
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-26 14:41:29 +00:00
Chris Dalton
bccb5f3b38 Add a simple FPS meter to CanvasKit viewer
Change-Id: I7577f9634afd2555543ca56ca774219724b90ce8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279206
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-25 21:09:26 +00:00
Kevin Lubick
988ce0490a remove localmatrix parameter from Blend and Lerp compose shaders
Bug: skia:10080
Change-Id: I936d6d696c86c50d5b51dc84894127c38ad753d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279048
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-03-25 17:56:26 +00:00
Chris Dalton
2b5989005c Bootstrap a very simple viewer implementation in CanvasKit
Adds a "viewer" option to the build system that brings in tooling code
and sample code. Adds a very simple "MakeSlide" binding that knows
how to create the WavyPathText sample slide. Adds viewer.html with
code to animate viewer slides.

This can hopefully be the starting point for future work on bringing
viewer to CanvasKit.

Change-Id: Ia26e08726384b40b3f544fe8254f430dc9db08db
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278892
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
2020-03-25 17:31:56 +00:00
Florin Malita
ae58199380 [skottie] Initial drop shadow style support
Plumb layer style parsing, and extend existing DropShadowAdapter to
support both drop shadow style and drop shadow effect.

Change-Id: Id99a419dacd06dc38dc4cf84ff4ecb92218c45f7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/279020
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-25 12:14:26 +00:00
Robert Phillips
cb77eab343 Revert "Switch to using a Float32Array (bound as value array) for color."
This reverts commit 4e79b6730d.

Reason for revert: Bad canvaskit GM images

Original change's description:
> Switch to using a Float32Array (bound as value array) for color.
> 
> Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
> Commit-Queue: Nathaniel Nifong <nifong@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

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

Change-Id: I2f5e995ccee415a49f813b5ba61c095acbc445b5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278766
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-03-24 14:20:04 +00:00
Nathaniel Nifong
4e79b6730d Switch to using a Float32Array (bound as value array) for color.
Change-Id: I1bcca931954b1399c79f4074a3d57a68847ac785
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276757
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-24 13:32:55 +00:00
Julia Lavrova
99ede42ffe Some bengali text does not have cluster index in ascending order
Bug: skia:10050
Change-Id: Ia8933d43e9c08687e52398528460b98eb5d59935
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277464
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-03-23 16:23:43 +00:00
Ben Wagner
9339266839 Infer NodeType in attachDiscardableAdapter.
This makes the call sites a bit simpler, doesn't materially change
anything in an optimized build, allows NRVO, and generally fixes a
number of warnings in gcc 9 about pessimizing-move.

Change-Id: I0ea5f57db163425da728630bfa6c1add7c416bd7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/278178
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
2020-03-20 19:50:12 +00:00
Brian Salomon
f4ba4ec796 Revert "Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""""
Updated to use sentinel GL context even when GL backend is not built.

This reverts commit 1171d314ef.

Change-Id: Ia94bbe4865ddd4e898446c13886877c539f0eb0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277976
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-20 17:11:58 +00:00
Brian Salomon
1171d314ef Revert "Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots"""
This reverts commit fb27c9a25f.

Revert "Remove MoltenVK support"

Reason: TSAN Vulkan bots hanging.

This reverts commit 6cafe73da9.

Change-Id: I8ec9db35c112f3c8da8636dab2065e6f18de7d0b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277936
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-19 13:10:59 +00:00
Chris Dalton
fabad15705 Remove ln "-T" option from cavaskit demo
-T isn't supported on mac.

Change-Id: Ic25dd48de1cfddcccb4d4b09f12585d889e5184d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277779
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-19 11:12:05 +00:00
Kevin Lubick
d3b92b910c [canvaskit] Add tests for gradients
Change-Id: I28a001f281d9dc0c64c37ad1f22a6387eadca843
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277607
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-03-18 20:03:16 +00:00
Kevin Lubick
afa83bc20b [canvaskit] Update to 0.14.0
Change-Id: I35b1c05e8e92a4dc01a3bf2b0502af18d8cb8b41
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277743
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-18 19:47:15 +00:00
Kevin Lubick
f279c63a60 [canvaskit] Add tests for patheffects
Also move around internal Dash PathEffect api.

Change-Id: I445626462f4e76523474b027555da45a58d54632
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277599
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-03-18 19:33:50 +00:00
Kevin Lubick
8febecfee6 [canvaskit] Make codec inclusion configurable
By default, we just ship with PNG encoding/decoding and
then decoding of JPEG, GIF, WEBP.

Change-Id: I19cbb3162acdbfde809df29d49050e3e7cb049db
Bug: skia:9733
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277598
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-03-18 19:32:32 +00:00
Brian Salomon
fb27c9a25f Revert "Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots""
This reverts commit 00ba5ef4a6.

Bug: skia:10051

Change-Id: I13fd5494b7e7e64159e6330f168ab8c16a2db149
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277609
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-18 18:12:11 +00:00
Florin Malita
3a76975a7c [skottie] VectorValue specialization
Currently we're handling VectorValues via a generic animator => we use
vector<vector<float>> for storage.  That's kinda clunky, especially for
small-size vectors (3d values, colors).

Introduce a more efficient VectorKeyframeAnimator:

  - stores vector values in a contiguous/consolidated float array
  - keyframes reference value offsets in storage
  - fast/sk4f lerp impl

Change-Id: Ia9538068f2c722c2d2209f87e26564f0fe28ac31
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277578
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-03-18 17:57:41 +00:00
Brian Salomon
00ba5ef4a6 Revert "Don't build GL on Metal, Vulkan, Dawn, Direct3D bots"
This reverts commit f6784a8c84.

Reason for revert: breakage of builds

Original change's description:
> Don't build GL on Metal, Vulkan, Dawn, Direct3D bots
> 
> Misc fixes to omit GL-dependent targets and fix assumptions that
> SK_SUPPORT_GPU implies SK_GL.
> 
> Bug: skia:10051
> Change-Id: Ida88ac3f1bf4d9e23f66d0700c2bce18b938ed6f
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277456
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Greg Daniel <egdaniel@google.com>

TBR=egdaniel@google.com,jvanverth@google.com,bsalomon@google.com

Change-Id: I4e02f675fd8820ed3c8efee192c64e570a23c3e5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10051
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277601
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2020-03-18 14:42:28 +00:00
Brian Salomon
f6784a8c84 Don't build GL on Metal, Vulkan, Dawn, Direct3D bots
Misc fixes to omit GL-dependent targets and fix assumptions that
SK_SUPPORT_GPU implies SK_GL.

Bug: skia:10051
Change-Id: Ida88ac3f1bf4d9e23f66d0700c2bce18b938ed6f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277456
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
2020-03-18 14:26:28 +00:00
Kevin Lubick
beefcb9d38 Reland saveLayer can omit the rectangle argument.
For API simplicity, if the rectangle is to be omitted, the client
should only provide the paint. (emscripten already does parameter
count checking, so let's use that instead of doing it ourselves).

This also adds tests to help verify the new behavior.

Revert "Revert "Allow null rect for saveLayer""

This reverts commit 7957d53c80.

Bug: skia:10043
Change-Id: I9ed8caabbfc77deab1ca3d9b1a415489e012528f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277399
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Dan Field <dnfield@google.com>
2020-03-17 17:38:54 +00:00
Florin Malita
141ac68fa0 [skottie] Cleanup: split animators into separate CUs
No functional changes, just code reshuffle.

TBR=

Change-Id: Ia04add9d51d6e84903d010534434c9a60464a72a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277457
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-17 15:48:17 +00:00
Kevin Lubick
7957d53c80 Revert "Allow null rect for saveLayer"
This reverts commit f2e9709266.

Reason for revert: Breaking the build

Original change's description:
> Allow null rect for saveLayer
> 
> Bug: skia:10043
> Change-Id: Ia049e72565810e1f72500141678e166027230535
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277097
> Reviewed-by: Kevin Lubick <kjlubick@google.com>

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

Change-Id: I0aae159380cbdfd4ead0f8e3e9c9de284c2dc103
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10043
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277182
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Kevin Lubick <kjlubick@google.com>
2020-03-16 18:08:45 +00:00
Dan Field
3d44f73b64 Sweep gradient support for CanvasKit
Change-Id: I04af9ea7aa6c6f95de6ff1eaf5ee41d59df7f09e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277059
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-16 16:57:03 +00:00
Dan Field
f2e9709266 Allow null rect for saveLayer
Bug: skia:10043
Change-Id: Ia049e72565810e1f72500141678e166027230535
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277097
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-16 16:46:12 +00:00
Mike Reed
ba96256581 hide getters so we can change the internals of SkVertices
Bug: skia:9984
Change-Id: Id8d8d568fb29b006d19079248c579282207279c1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275692
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-03-13 12:08:12 +00:00
Florin Malita
6509bc715f [skottie] Cleanup VectorValue use
Replace with Vec2Value where appropriate.

TBR=

Change-Id: I530b451d6d858621615e33791e610a562d9643ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276644
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-12 15:35:20 +00:00
Florin Malita
c02e77ce0a [skottie] Effects cleanup pass
1) switch 2D properties to new Vec2Value type
2) convert vebose binding code to more concise EffectBinder pattern

TBR=

Change-Id: If0244fea887c350dd3d59ddd50a7be75e058d799
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276639
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-12 14:03:00 +00:00
Florin Malita
06e5a15567 [skottie] Power reduce trivial spatial Berzier
A significant number of spatial keyframes have trivial Bezier control
points - e.g. located on the linear interpolation segment.  The
corresponding cubics have no effect and can be discarded.

Change-Id: I706546653c3621fd0d3eb9c285627ccd4d0bc549
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276410
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-11 18:12:17 +00:00
Florin Malita
6e7eac9fff [skottie] Simplify the separate-dimensions vector interpolator
No need for an intermediate adapter object - just bind individual/scalar
fields using existing mechanisms.

No functional side effects.

TBR=
Change-Id: I16be769e5fb92dba0ebb6ce3b0584c5cdcc2b92c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276215
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-10 19:55:50 +00:00
Florin Malita
92ec801a2b [skottie] 2D spatial interpolation support
AE discriminates [1] between basic 2-dimensional properties
(PropertyValueType.TwoD - e.g. scale), and spatial 2D properties
(PropertyValueType.TwoD_SPATIAL - e.g. position).

For the latter it provides additional keyframe controls (tangent in &
tangent out) to describe a non-linear interpolation path ("spatial
interpolation").  This composes on top of the usual temporal
interpolation (with its own optional cubic mapping).

To support spatial interpolation:

  - introduce a new Skottie value type (Vec2Value), to represent
    TwoD and TwoD_SPATIAL properties
  - introduce a KeyframeAnimator specialization for Vec2Value, which
    tracks per-keyframe tangent information
  - for spatial keyframes, instantiate/store an SkContourMeasure, and
    use instead of straight Vec2 LERP
  - switch interesting 2D properties to the new value type (transform
    position, anchor point, scale)

(we could look into separating TwoD/TwoD_SPATIAL if needed, but the new
specialization is already more efficient than the old
opaque-vector-with-late-binding approach)

[1] http://docs.aenhancers.com/properties/property/#property-propertyvaluetype

Change-Id: I0863fd970cec4c5ff15cf01b2fb5c6602a468179
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274283
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-10 17:50:55 +00:00
Nathaniel Nifong
2e307968fd Clean up Enums in Canvaskit
- Removed inverse filltypes
 - Removed StrokeAndFill Paint Style
 - Removed TextEncoding (all functions assume UTF-8)

Change-Id: Ie2824042b48b3dcefb41ef761bb3070df894da75
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276099
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-10 15:17:20 +00:00
Florin Malita
0c465e3f35 SkShaders::Blend/GPU: treat null inputs as input color
Matches CPU behavior.

Bug: skia:10019
Change-Id: I514bb996fdce8de2af5df008e185c48617a20a37
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276008
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-09 23:52:59 +00:00
Nathaniel Nifong
a3aa601ea6 Add a canvas test to make and draw SkVertices
Change-Id: I54647b84e0ee0e13cf3041e9340120a6aca89d08
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275997
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-09 20:28:48 +00:00
Leon Scroggins III
a77f30c7db Reland "Split building encoding from decoding"
This reverts commit 9d4b788807.
Copyright issue has been fixed in
https://skia-review.googlesource.com/c/skia/+/275998.

Original description:
Bug: skia:9756

In CanvasKit, a large part of the binary is for encoding. Clients
would be happier with a smaller binary and no webp/jpeg encoding. Make
this an option by splitting up the GN arguments.

Split SK_HAS_WEBP_LIBRARY into SK_CODEC_DECODES_WEBP (to match the
existing SK_CODEC_DECODES_RAW) and SK_ENCODE_WEBP. Same for JPEG and
PNG.

Update CanvasKit compile script to disable webp and jpeg encoding.
Update debugger compile script to disable all encoding.

Change IsPng signature to match other SkCodecs.

TBR=djsollen@google.com

Change-Id: Ic847bae0154e0a2922100b3f2ee14a077ee5635a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276007
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2020-03-09 20:21:19 +00:00
Florin Malita
4054061b0b [skottie] Defibrillate wipe effects
Since we can't use mask filters on layer paints any longer, refactor the
existing wipe effects to use explicit shader masking:

  - remove SkSG::MaskFilterEffect - it no longer works
  - replace with SkSG::MaskShaderEffect
    - for atomic draws, apply the shader to the draw paint as
      SkShader::Blend(kSrcIn, mask_shader)
    - for isolated content, apply the mask as an extra pass
      drawPaint(kDstIn, mask_shader) before restoring the layer
  - refactor VenetianBlindsEffect, LinearWipeEffect and RadialWipeEffect
    to use mask shaders
  - additionally, refactor the RadialWipeEffect gradient to avoid using
    a local shader matrix (does not compose correctly within the new
    framework)

Everyone clear... do not touch the patient... BZZZT!

TBR=

Change-Id: I3a88da97a17b3b68812480cad5298b8778b6847c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275694
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-09 18:41:08 +00:00
Florin Malita
ea3ddc9aef [skottie] KeyframeAnimator builders
Split the keyframe parsing logic into separate builder helpers.

No functional impact, this will facilitate some upcoming changes.

TBR=

Change-Id: I62a02a0ad90ddef572208f8714f22ae0a0b97023
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276003
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-09 18:10:59 +00:00
Nathaniel Nifong
c8f95e27c4 Fix deprecated names
Change-Id: I40756339e3ef61f05da2b0df510318ff4329c8ea
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275999
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-09 17:06:18 +00:00
Nathaniel Nifong
d96c3c78e7 Add shader makers to SkShader externs
Bug: skia:9843
Change-Id: I98ba2e41563b8b3dcec523ae7a2340b9aacfec2d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275963
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-09 15:22:28 +00:00
Nathaniel Nifong
4cf2ab6ffe JS files to support running jasmine tests in google3
accompanied by cl/299139086

Change-Id: I9d05aab8171313d2efd2f47c0007b716e4f5a76e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275763
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-09 14:20:27 +00:00
Mike Klein
9d4b788807 Revert "Split building encoding from decoding"
This reverts commit 94aaf7cdf5.

Reason for revert: you know what I already typed the reason stop making rules that people have to follow, robots.

Original change's description:
> Split building encoding from decoding
> 
> Bug: skia:9756
> 
> In CanvasKit, a large part of the binary is for encoding. Clients
> would be happier with a smaller binary and no webp/jpeg encoding. Make
> this an option by splitting up the GN arguments.
> 
> Split SK_HAS_WEBP_LIBRARY into SK_CODEC_DECODES_WEBP (to match the
> existing SK_CODEC_DECODES_RAW) and SK_ENCODE_WEBP. Same for JPEG and
> PNG.
> 
> Update CanvasKit compile script to disable webp and jpeg encoding.
> Update debugger compile script to disable all encoding.
> 
> Change IsPng signature to match other SkCodecs.
> 
> Change-Id: Iec8466ee1b76bc3d1e377c24201068b776cd7718
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273768
> Commit-Queue: Leon Scroggins <scroggo@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Reviewed-by: Kevin Lubick <kjlubick@google.com>
> Reviewed-by: Nathaniel Nifong <nifong@google.com>

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

Change-Id: I4fc2ea916743fda7e7d0d668b59e52052e880104
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:9756
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275710
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-03-06 21:39:21 +00:00
Leon Scroggins III
94aaf7cdf5 Split building encoding from decoding
Bug: skia:9756

In CanvasKit, a large part of the binary is for encoding. Clients
would be happier with a smaller binary and no webp/jpeg encoding. Make
this an option by splitting up the GN arguments.

Split SK_HAS_WEBP_LIBRARY into SK_CODEC_DECODES_WEBP (to match the
existing SK_CODEC_DECODES_RAW) and SK_ENCODE_WEBP. Same for JPEG and
PNG.

Update CanvasKit compile script to disable webp and jpeg encoding.
Update debugger compile script to disable all encoding.

Change IsPng signature to match other SkCodecs.

Change-Id: Iec8466ee1b76bc3d1e377c24201068b776cd7718
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273768
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-03-06 18:50:40 +00:00
Nathaniel Nifong
7e46b14d84 Replace red line skp with a prettier example
https://screenshot.googleplex.com/QqfxdSfccZD.png

Change-Id: Id7328beec06c54593a2f144dc4cd048442d9b443
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272059
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-06 16:15:08 +00:00
Kevin Lubick
a093cffed2 [canvaskit] Fix shadow bugs
This also adds a helper option to writing canvas2d spec tests
to see the CanvasKit option side by side with the real canvas
version.

Bug: skia:9940, skia:9947
Change-Id: Ia8fc4e1332d3896933b86291181bc3ba890d26ed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275618
Reviewed-by: Florin Malita <fmalita@chromium.org>
2020-03-06 16:14:20 +00:00
Julia Lavrova
54de2fa48d Cache resolved typefaces by Unichar + SkFontStyle + locale
Bug: skia:9983
Change-Id: I0dbb1cc72b95f896f21b4588a0c935c0dcdf9439
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275463
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-03-06 15:58:19 +00:00
Nathaniel Nifong
6066a0c2bd Remove all uses of bones
Change-Id: I302f43484c599a05e077545df5f053a89d63a6a6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275079
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-05 18:47:38 +00:00
Julia Lavrova
cd2a4d65e5 Adjusting getRectsForRange to grapheme edges.
Cluster edges were not enough.

Bug: skia:1003
Change-Id: Id2fdb7aa5dc2f6c4b03f1c841757796cf5c9b604
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275220
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-03-05 17:42:32 +00:00
Nathaniel Nifong
23b0ed9480 Name name changes suggested in API review
Bug: skia:9843
Change-Id: Ib7e30a129dff17ecde81daa1ff665304908face3
Docs-Preview: https://skia.org/?cl=275048
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275048
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-03-05 15:13:41 +00:00
Nathaniel Nifong
628f3e70ee Remove experimental from name of skm44 canvas methods
Change-Id: If275ede5049b74c0c4c36eb5ac5697ec63737228
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275047
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-04 21:36:18 +00:00
Julia Lavrova
2813d454f3 getRectsForRange results must be adjusted to glyphs.
Bug: skia:9957
Change-Id: I7c8537e8217288bf5d9d38950377cdacae705816
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274746
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-03-04 18:29:02 +00:00
Julia Lavrova
3c79a23414 Selection in justification: Bugs: skia: 9969
Make sure getGlyphPositionAtCoordinate works in RTL

Change-Id: I394d868bbbd4a3042e1a2f50901d137c65f1f2b9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274544
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-03-03 16:02:20 +00:00
Florin Malita
960f3d4cd1 [skottie] Text anchor point grouping support
Implement all AE grouping modes: character/word/line/all.

 -- character grouping was already supported (default mode)

 -- for word and line grouping, expand the existing domain mapping logic
    to also track cumulative advance and max(ascent) per span, then use
    this info to compute anchor point boxes

 -- for "all" grouping, the anchor point box coincides with the text box

(https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties)

TBR=
Change-Id: I8564f1349d167d82c31862d8f7e57615cdae0dcf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274201
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-02 23:07:39 +00:00
Mike Reed
5caf9358c3 remove bones from SkVertices
Bug: skia:9984
Change-Id: I7c4f33ee82087eb1b0a60243183f0c68e310f10d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274547
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-03-02 20:30:59 +00:00
Florin Malita
ed38d201de [skottie] Stroke dash support
AE supports dashing all strokes.  Dashes are specified as an arbitrary
number of intervals (alternating dash/gap) plus a start offset.

All values can be animated independently (but of course!).

  - implement a SkSG dash effect (based on SkDashPathEffect)
  - expand the shape builder logic to allow local geometry adjustments
    (kind of a bummer that dashing is a stroke/paint property as opposed
    to a geometry effect in AE)

Change-Id: Ic9ff35f2f9a552a3c26f9e1596ce58ad81f7ced5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274550
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-03-02 16:56:22 +00:00
Julia Lavrova
a0708e82dc Bugs: skia: 9968
Move justification shifts into Run

Change-Id: If1e7b87fd58ce791fc0e2ee9bdfb1b87ee6bb696
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274197
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-03-02 15:48:52 +00:00
Florin Malita
c4fae744d0 [skottie] Fix handling of time-reversed precomp layers
With time-reverse enabled

 - inPoint/outPoint are reversed
 - time stretch is negative

Bug: skia:9958
Change-Id: I5c1197251608aad4b0417cde6ca2600b1b2822fc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273808
Commit-Queue: Avinash Parchuri <aparchur@google.com>
Reviewed-by: Avinash Parchuri <aparchur@google.com>
2020-02-28 19:42:51 +00:00
Kevin Lubick
79e41e7063 [canvaskit] Roll to v0.13.0
Change-Id: I4ff4e7549f0eeb15fe66755f3da26c15f51bf8f1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274052
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-28 19:27:22 +00:00
Florin Malita
917dddece6 [skottie] Add support for text grouping alignment
AE allows relative adjustments for text animator transform anchor
points [1].

[1] https://helpx.adobe.com/after-effects/using/animating-text.html#text_anchor_point_properties

Change-Id: If98d6b522e73a768ed2358d918867d2aefd09071
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274044
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-28 18:59:05 +00:00
Julia Lavrova
76ae22e558 Bugs
Mainly, simplified iteration over visual run for performance reasons.
Check for locale when comparing fonts.
Try to resolve ALL unresolved codepoints.

Change-Id: Ic126ca9bcb3970e2cbd6da9c384c493f9fd81b0d
Bug: skia:9956, skia:9970, skia:9951
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273463
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-28 17:43:07 +00:00
Florin Malita
4bd834b167 [skottie] Fix default character transform origin
By default, per-character AE transforms are anchored on the glyph
baseline, mid-advance.

To support:

  - extend SkottieShaper to track per-fragment ascent and advance
  - adjust the fragment transform origin for (advance/2,0)

As an optimization, we only track the anchor point in the presence
of origin-dependent animators (scale & rotation ATM).

(note: the ascent info is going to be used in a follow up CL to support
relative anchor point adjustments)

Change-Id: I883a957028e624522fdf68a6b2fc44384dee18fe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273984
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-28 17:06:47 +00:00
Kevin Lubick
bde9fcce15 [canvaskit] Precise font measuring
Bug: skia:9864
Change-Id: I097ca54b55e0864a7659fa1c3a05ea7f02811aed
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273297
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-02-28 13:36:34 +00:00
Nathaniel Nifong
f106bc27a4 Add SK_NO_FONTS check around font uses in skottie
Prerequisite to cl/297131877

Change-Id: Icd58c69fd53b703e43d67f4a1a9bafe096943edc
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273765
Reviewed-by: Florin Malita <fmalita@chromium.org>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Nathaniel Nifong <nifong@google.com>
2020-02-27 20:50:16 +00:00
Nathaniel Nifong
19304d88c8 Move all canvaskit example resources to CDN
Change-Id: I92c83051017648d5703b06daac77e99ff40aeb2e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/273000
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-24 21:54:47 +00:00
Kevin Lubick
9279798022 [canvaskit] Expose releaseResourcesAndAbandonContext on GrContext
Bug: skia:9910
Change-Id: If0a6aa106d42c680f1f0f3092c4a4dbd0f04c937
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270936
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-02-24 17:11:28 +00:00
Florin Malita
9642b31a71 [skottie] Add support for text animator blur
In adition to transforms/opacity/etc, text animators can target
per-glyph opacity.

Change-Id: I6ab63a6e49a64beaf63fc955f0b672a5b8ba84ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272886
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-24 14:01:16 +00:00
Nathaniel Nifong
cc5415a8ce Modify 3D example with light and bump shader.
Depends on what I assume the final version of https://skia-review.googlesource.com/c/skia/+/272646 will be
Change-Id: I53485c5f47e0fef120c8a1bd6d0620fddfb3cde9
Bug: skia:9866
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272529
Commit-Queue: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-24 12:46:35 +00:00
Mike Reed
9e8f605344 SkM44.h is now in include/public
Change-Id: I679d3328a65123d4cbb15045d98fe4ac498ee531
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272837
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-22 16:43:56 +00:00
Kevin Lubick
ecd8762e1f [canvaskit] Support children shaders into runtime shaders
Change-Id: I88106babe35f6e5b3ee764e7fbaf82c7f43d136d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272646
Reviewed-by: Nathaniel Nifong <nifong@google.com>
2020-02-22 12:38:52 +00:00
Nathaniel Nifong
77798b4585 Expose 4x4 matrices on canvas in a way similar to SimpleMatrix, add example.
Bug: skia:9866
Change-Id: I718455743e482e4f60a462027b629dc19b1dbad3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270201
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-22 00:12:13 +00:00
Florin Malita
178b860769 [skottie] Initial support for per-character 3D
When per-character 3D is enabled, text properties can be animated in
3 dimensions.

 - position and scale become 3-value vectors
 - in addition to existing "r" (really rz), rotation gains "rx" and "ry"
 - instead of specializing for 3D, expand the existing structures to
   handle both 3D and 2D modes
 - also ensure that sksg::Transform does not flatten to SkMatrix

Change-Id: I426a7ee1ff38c1702deb85e9f1db80f6069f36d6
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272648
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-21 21:14:02 +00:00
Julia Lavrova
7dcb4d263d Bugs
Change-Id: Id26530bbd54626a74bfb4fccd4c066fa39346411
Bugs: skia:9892

getGlyphPositionAtCoordinate should return correct code point index

Change-Id: Id26530bbd54626a74bfb4fccd4c066fa39346411
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272347
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-02-21 18:46:42 +00:00
Mike Reed
46f5c5f08b Make SkM44 public
Need to migrate clients from private/ to core/ include
Unexperimentalize concat44() methods on SkCanvas

Change-Id: I64b8816722a9d93316cb8b8691d2d9a3e36f167f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272464
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-21 15:50:31 +00:00
Kevin Lubick
f8f9cd84fa [canvaskit] Expose bindings to particles uniforms.
Uniforms in the general case can be multiple floats, so
we expose a small struct to provide information about all
uniforms (including the built in ones like "dt") as well
as effectUniforms and particleUniforms which return Float32Arrays
bound to the WASM memory containing those unifroms.

Thus, by modifying the Float32Array, one can directly affect
the particle/effect properties.

This allows us to expose sliders on particles.skia.org
(https://skia-review.googlesource.com/c/buildbot/+/272398)

Change-Id: Ie390f3d2dc571ee4ebaab59a7fa1b7b2dc24d871
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272377
Reviewed-by: Brian Osman <brianosman@google.com>
2020-02-21 14:43:01 +00:00
Kevin Lubick
392846665c [canvaskit] Expose parseColorString
This is handy for interacting with <input type=color>

Change-Id: I7946c08ef10a2481016885d58cc52f76f5cd40e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272344
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-21 12:43:15 +00:00
Julia Lavrova
62076977a0 Bugs
Change-Id: I3d45c6c8cef0109377812de0a3aab5d457a29b86
Bugs: skia:9849, skia:9850

9849 is related to font resolution (we may have to try different fallback
fonts to resolve all codepoints)
9850 is related to finding a position inside a glyph ("ffi" is an example)

Change-Id: I3d45c6c8cef0109377812de0a3aab5d457a29b86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271745
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-02-20 18:35:23 +00:00
Florin Malita
0de01c05b7 [skottie] Clip overflowing paragraph lines
AE discards lines with baselines outside the paragraph box.

This aligns Skottie's behavior with AE for default/top-alignment
(but not for any of the custom vertical alignment modes).

Bug: skia:9933
Change-Id: Id0318f0744bf89580774e89494faf19bfb6f6d14
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272376
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-20 18:35:15 +00:00
Mike Reed
9d4e31d6cd rm Sk3D.h -- long live SkMat4
Change-Id: Ib83ee6567b1a32f34364b7ac66a659eaeced3249
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272037
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Reed <reed@google.com>
2020-02-20 13:15:33 +00:00
Florin Malita
a3e8266117 [skottie] Add warning for missing text/paragraph box
Text auto-scaling requires an explicit paragraph box.

Change-Id: If3ba91051cd5fa8456fc8530d7ed7ad4c663fff9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/272119
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-19 23:37:04 +00:00
Julia Lavrova
c7a9a074e1 Bug fixes
Change-Id: I2b4b210301584c23a3b9325ebfdfdd9e6c4712d1
Bug: skia:9881, skia:9882
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271865
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-02-19 19:01:21 +00:00
Julia Lavrova
212bf079de layout/relayout with different widths and justification
Change-Id: I2f6d9121a97d3dc12981e0aaf420c56a8f7e05eb
Bug: skia:9851, skia:9875
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271536
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-19 16:37:14 +00:00
Mike Klein
a9609ea8c5 turn on -Wreturn-std-move-in-c++11
This CL has a complicated back story, but it's concrete change is
simple, just turning the warning on and converting a bunch of

    return foo;

to

    return std::move(foo);

These changes are exclusively in places where RVO and NRVO do not apply,
so it should not conflict with warnings like -Wpessimizing-move.

Since C++11, when you return a named local and its type doesn't match
the declared return type exactly, there's an implicit std::move()
wrapped around the value (what I'm making explicit here) so the move
constructor gets an opportunity to take precedence over the copy
constructor.  You can read about this implicit move here under the
section "automatic move from local variables and parameters":
https://en.cppreference.com/w/cpp/language/return#Notes.

This situation comes up for us with smart pointers: a function declares
its return type as std::unique_ptr<Base> or sk_sp<Base>, and we return a
std::unique_ptr<Impl> or sk_sp<Impl>.  Those types don't match exactly,
so RVO and NRVO don't come into play.  They've always been going through
move constructors, and that's not changed here, just made explicit.

There was apparently once a bug in the C++11 standard and compilers
implementing that which made these copy instead of move, and then this
sort of code would do a little unnecessary ref/unref dance for sk_sp,
and would entirely fail to compile for uncopyable std::unique_ptr.
These explicit moves ostensibly will make our code more compatible with
those older compilers.

That compatibility alone is, I think, a terrible reason to land this CL.
Like, actively bad.  But... to balance that out, I think the explicit
std::move()s here actually help remind us that RVO/NRVO are not in play,
and remind us we're going to call the move constructor.  So that C++11
standard bug becomes kind of useful for us, in that Clang added this
warning to catch it, and its fix improves readability.

So really read this all as, "warn about implicit std::move() on return".
In the end I think it's just about readability.  I don't really hold any
hope out that we'll become compatible with those older compilers.

Bug: skia:9909
Change-Id: Id596e9261188b6f10e759906af6c95fe303f6ffe
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/271601
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
2020-02-18 23:55:35 +00:00
Robert Phillips
f6a0b45414 Store ProgramDesc on DDLs alongside the GrProgramInfo
We already have the program desc bc we uniquify the programs stored
on the DDL. This CL just preserves them on the snapped DDL to speed
up precompilation.

Bug: skia:9455
Change-Id: Ie0e0b607e2e96beca7128f4083386b34ad469072
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270998
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2020-02-18 20:35:55 +00:00
Florin Malita
2e941d00c8 [skottie] Store scalar keyframe values inline
Generally, keyframe values live in dedicated storage, and are tracked in
keyframes based on their index.

This separation is not necessary for float values, as their storage size
is the same as their index's:

  - update keyframes to store value records (VRecs), which can hold
    either external value indices or inline floats

  - introduce a scalar animator specialization which operates on float
    VRecs and doesn't require dedicated value storage

Change-Id: Icd8f1608c28c761303bdc44a23f562a2d2810d4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270844
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-18 17:31:15 +00:00
Florin Malita
f3f225443b Undo suspect gn format
[1] formatted modules/skottie/BUILD.gn, as prompted by git cl upload,
but that doesn't sit well with a bot [2].

Let's try reverting.

[1] https://skia-review.googlesource.com/c/skia/+/270450
[2] https://logs.chromium.org/logs/skia/4a5923ca1d5a5511/+/steps/compare_diffs/0/logs/python.inline/0

Change-Id: I6ee74f5038b4f62f978cfe2fa77e7214d34d8b63
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270836
Commit-Queue: Florin Malita <fmalita@chromium.org>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-13 22:17:23 +00:00
Florin Malita
b24f3b150c [skottie] Refactor keyframe encoding
For each Lottie keyframe, we currently store interpolation
*segments*:

 {
   t0, v0
   t1, v1
   cubic_mapper
 }

This is quite redundant:

 - kf(n).t1 == kf(n+1).t0 for all keyframes
 - kf(n).v1 == kf(n+1).v0 for all non-constant keyframes

Refactor to store single keyframe records:

  {
    t, v
    mapping
  }

To identify constant keyframes, since we no longer store
explicit hard stops, we now tag each record with a "mapping"
selector:

    0 -> constant keyframe
    1 -> linear keyframe
  > 1 -> cubic keyframe (adjusted cubic mapper index)


This reduces the storage size by 2/5, and yields overall cleaner
logic (as we're no longer back-filling info as we parse).

Also add a handful of unit tests to lock down limit semantics
(keyframe segments are left-inclusive/right-exclusive).

Change-Id: I3ab0e5568b83ab8536a7d326dbc07c4c455e978d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270450
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
2020-02-13 18:54:32 +00:00
Jason Simmons
886e8500a9 Apply fake bold and italic settings to the SkFont if the typeface needs them
The rules for setting fake bold and italic are based on the implementation
used in Minikin.

Change-Id: I9bbecdbd0198363db0296fa9c68046b4724fbded
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269429
Commit-Queue: Jason Simmons <jsimmons@google.com>
Reviewed-by: Julia Lavrova <jlavrova@google.com>
2020-02-12 22:17:26 +00:00
Shachar Langbeheim
be28d2e75e This change allows users of PropertyObserver to compose a full keypath for each of the modified properties.
Also this contains a demonstration of how to implement this in CustomPropertyManager.

Change-Id: If4770e47b87ed76c98a85de3c235ab27c913dbc0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269696
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-12 14:13:13 +00:00
Jason Simmons
d6ff6f7f12 Fix typo: widthWithGhostSpaces
Change-Id: I14b56069fc273e4b6fcb6d7b528716bf6dc38c00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269912
Reviewed-by: Julia Lavrova <jlavrova@google.com>
Commit-Queue: Jason Simmons <jsimmons@google.com>
2020-02-11 18:03:27 +00:00
Brian Osman
7b9524cb96 Fix crash when editing particle scripts
If the scripts fail to produce valid bytecode, don't overwrite the
interpreter.

Change-Id: Icd008a5188166ce086ff4df87dcb2b43d7f80820
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269487
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-10 15:08:00 +00:00
Florin Malita
8dad1ffd81 [sksg] Improved layer elision heuristic
We can skip effect layers when none of the child nodes overlap (treat as
atomic draws, with effects applied on their paint).

The initial heuristic was simply checking for more than one child.

This version relaxes the heuristic to check each child bounds against
the union of preceding siblings.

Change-Id: I2dc6d30d945697f410100db0c46a8a8377d5b569
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269482
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Klein <mtklein@google.com>
2020-02-07 23:20:34 +00:00
Brian Osman
7353dc5490 Change SkSL main() from (float x, float y) to (float2 p)
Change-Id: Id046199edd63535ef07e1dfa65fbc7c0f8cefd00
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269371
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-07 20:19:13 +00:00
Brian Osman
788b91678f Remove SkTMin and SkTMax
Use std::min and std::max everywhere.

SkTPin still exists. We can't use std::clamp yet, and even when
we can, it has undefined behavior with NaN. SkTPin is written
to ensure that we return a value in the [lo, hi] range.

Change-Id: I506852a36e024ae405358d5078a872e2c77fa71e
Docs-Preview: https://skia.org/?cl=269357
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269357
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
2020-02-07 18:40:09 +00:00
Julia Lavrova
c0360582d2 Cache should work with INF values
Change-Id: I1ae8d95bb85d28fdce9e0cf270583f0224e4dfed
Bug: skia:9874
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268938
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
2020-02-06 19:44:43 +00:00
Brian Osman
116b33e8ab Remove SkMaxScalar and SkMinScalar
Use std::max and std::min instead

Change-Id: Icf3796609e5cb511687fb50bd31229ae4b6b9b39
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268841
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-02-06 15:43:22 +00:00
Florin Malita
4a6a640299 [skottie] Add support for ADBE Pro Levels2 effect
Similar to existing ADBE Easy Levels2, but provides separate mapping
controls per channel.

Change-Id: Ibc58c58e1e8cb8793d6eb819998c1804ccbbf859
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268936
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2020-02-05 21:05:08 +00:00
Julia Lavrova
95a9e69c8c Make assert less sensitive to rounding errors
Change-Id: I64b28e0cdcb7f44c1ded9c8d23f3b9c9add09861
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268837
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-02-05 20:30:38 +00:00
Julia Lavrova
d3a32c5425 RTL fixes + few small bugs
1. Removed unnecessary iterators (use SkShaper iterators instead)
2. More careful hash function and comparison (ParagraphStyle)
3. computeEmptyMetrics should go after resolveStrut
4. longestLine for line with spaces only should not be 0
5. LTR/RTL * left/right align * latin/arabic * leading/trailing spaces positioning
6. Height for MaxHeight rect (to follow Gary's change)

Change-Id: I3507ff9fb93148e5ef882a2f514078fcea9cfef3
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268301
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Julia Lavrova <jlavrova@google.com>
2020-02-05 14:40:48 +00:00
Nathaniel Nifong
25cf469a11 Move Make functions for corner and discrete path effects into namespaces.
Deprecates MakeSkCornerPathEffect in favor of SkCornerPathEffect.Make
Deprecates MakeSkDiscretePathEffect in favor of SkDiscretePathEffect.Make

Bug: skia:9843
Change-Id: I5a5b79838d1212605c6cb0b124dc0eabde8a4b4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268629
Commit-Queue: Nathaniel Nifong <nifong@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
2020-02-04 19:48:04 +00:00