skia2/include
Michael Ludwig 7712db9c24 Reland "Draw image filters directly under non-axis-aligned transforms"
This reverts commit 6cafdc069b.

Reason for revert: Fixes unit test failure in Android

In the original version, this internalSaveLayer() returned early if the
strategy was kNoLayer. This diverged from the old code that updated the
canvas' clip bounds and then returned before making the layer. A comment
had suggested this was maybe okay to switch to this early out, but it
turns out that's not the case.

In Android's unit tests, it queries the clip bounds on a recording canvas
which always uses a no-layer strategy. However, we do need to set the
clip bounds of these types of canvas' (or virtual wrappers of a real
canvas) so that they stay consistent with a real canvas.

The unit tests had two failures, first the bounds and second a color
mismatch after reading back. However, the bounds test was an ASSERT_EQ
inside an SkDrawable function. ASSERT_EQ aborts the current function, so
it never ran the drawRect that sets the color to green. The later
readback is outside the drawable function, so that test still happened
and failed. The only real issue to fix is the clip bounds tracking; once
that unit test succeeds, the color readback will work properly.

Original change's description:
> Revert "Draw image filters directly under non-axis-aligned transforms"
>
> This reverts commit f8f23b2030.
>
> Reason for revert: b/172617382 is creating issues for Android's Webview
>
> Original change's description:
> > Draw image filters directly under non-axis-aligned transforms
> >
> > This removes hacking the canvas CTM and wrapping the paint's image
> > filter in a special MatrixTransform that computed a post-transform
> > instead of its documented pre-transform effect. Performance-wise, the
> > computed layer sizes should be about the same, but we avoid one less
> > render target switch because we apply the transformation while drawing
> > to the dst device, vs. transforming into another temporary layer and
> > then drawing that to the dst device.
> >
> > Several important changes in behavior here:
> > 1. The DeviceCM record no longer has a stashed matrix to restore and
> >    holds its restoration paint directly.
> > 2. Devices for image filter inputs can now have device-to-global
> >    transforms that are not integer translates.
> > 3. The MatrixTransform hack punted when there was perspective because it
> >    could produce excessively large temporary images, but the new version
> >    appears to work around that. We now impose a maximum layer size to
> >    protect against that and automatically scale the layer to prevent it.
> >    Perspective image filters otherwise now draw correctly.
> > 6. Updated layer sizing code to use the new image filter APIs
> > 7. Updated backdrop filter and restore filters to go through the same
> >    code paths, although restore filters skip the intermediate image
> >    transform.
> >     - layer bounds and transforms now go through the updated skif API
> >       and is hopefully more straight forward to understand.
> > 8. Now we can optimize root color filter nodes of a filter DAG, even if
> >    the entire DAG can't be represented as a color filter. The last node
> >    is pulled off and composed with the restoration paint instead.
> >
> > Bug: skia:9074,skia:9283
> > Change-Id: I1fa1d50135b9d6d453b02f89aa3cc3b54deab678
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/328376
> > Commit-Queue: Michael Ludwig <michaelludwig@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
>
> TBR=bsalomon@google.com,robertphillips@google.com,fmalita@google.com,reed@google.com,michaelludwig@google.com
>
> Change-Id: I098d0e4b8ee067b436400eb9fea047e629544eec
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:9074
> Bug: skia:9283
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/332737
> Reviewed-by: Michael Ludwig <michaelludwig@google.com>
> Reviewed-by: Derek Sollenberger <djsollen@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>

TBR=djsollen@google.com,bsalomon@google.com,robertphillips@google.com,fmalita@google.com,reed@google.com,michaelludwig@google.com

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

Bug: skia:9074
Bug: skia:9283
Change-Id: Ifd5fed708d05a64ddccbd096fbf29896a44ef9f5
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/333123
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
2020-11-10 19:04:39 +00:00
..
android Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
c remove unimplemented sk_data_new_empty() 2020-10-29 16:20:06 +00:00
codec Reland "Add idea of DataType to SkYUVAPixmapInfo." 2020-09-03 18:05:17 +00:00
config Track vulkan memory allocations in UMA. 2020-10-29 15:24:23 +00:00
core Reland "Draw image filters directly under non-axis-aligned transforms" 2020-11-10 19:04:39 +00:00
docs Add appendNodeIdArray to avoid code duplication. 2020-06-23 14:25:33 +00:00
effects Move GrShaderCaps from Program::Settings to Compiler 2020-11-04 19:38:33 +00:00
encode Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
gpu Have DDLs honor the reduceOpsTaskSplittingFlag 2020-11-06 20:20:44 +00:00
pathops rm SkPreConfig.h and SkPostConfig.h 2020-02-06 19:16:43 +00:00
ports Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
private refactor Sk[S]TArray methods 2020-11-09 22:28:48 +00:00
svg [svgcanvas] Add flag to suppress newlines and tabs in XML 2019-08-21 20:17:37 +00:00
third_party Roll skcms from c21106442079 to f73242142ce5 (1 revision) 2020-07-16 21:50:37 +00:00
utils Remove SkCanvas::getGrContext & GrRecordingContext::backdoor 2020-09-21 16:46:21 +00:00