skia2/include/core
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
..
SkAnnotation.h
SkBBHFactory.h Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SkBitmap.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkBlendMode.h remove enum docs 2020-02-11 21:43:07 +00:00
SkBlurTypes.h
SkCanvas.h Reland "Draw image filters directly under non-axis-aligned transforms" 2020-11-10 19:04:39 +00:00
SkCanvasVirtualEnforcer.h remove legacy virtual from enforcer 2020-03-13 14:57:03 +00:00
SkClipOp.h Update SkClipOp::kMax_EnumValue to match non-deprecated values 2020-09-28 15:30:33 +00:00
SkColor.h Add getter for channels to GrBackendFormat 2020-04-08 19:54:27 +00:00
SkColorFilter.h [skottie] Add support for invert/YIQ 2020-09-11 14:55:44 +00:00
SkColorPriv.h move SkTPin to include/private 2020-10-16 19:45:11 +00:00
SkColorSpace.h Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SkContourMeasure.h [canvaskit] Flesh out remaining docs for core CanvasKit. 2020-10-05 11:47:40 +00:00
SkCoverageMode.h
SkCubicMap.h [skottie] De-dupe sequential cubic mappers 2019-07-17 17:14:46 +00:00
SkData.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkDataTable.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkDeferredDisplayList.h Require a direct context to precompile a DDL's programs 2020-08-14 14:35:41 +00:00
SkDeferredDisplayListRecorder.h Simplify promise image callbacks. 2020-11-10 02:47:56 +00:00
SkDocument.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkDrawable.h
SkDrawLooper.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkEncodedImageFormat.h Reland "heif: Add AVIF type and AVIF sniffing" 2020-11-05 15:25:52 +00:00
SkExecutor.h Allow SkThreadPool to be non-borrowing 2020-04-23 16:11:28 +00:00
SkFilterQuality.h
SkFlattenable.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkFont.h move concrete subruns to .cpp 2020-11-06 19:49:14 +00:00
SkFontArguments.h Remove SkFontArguments::Axis. 2020-07-15 20:59:22 +00:00
SkFontMetrics.h SkCustomTypefaceBuilder to set SkFontStyle 2020-08-19 00:09:55 +00:00
SkFontMgr.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkFontParameters.h
SkFontStyle.h move SkTPin to include/private 2020-10-16 19:45:11 +00:00
SkFontTypes.h
SkGraphics.h add SkGraphics::AllowJIT() 2020-08-06 14:38:26 +00:00
SkICC.h
SkImage.h Move image sampling options into their own header 2020-11-06 17:30:44 +00:00
SkImageEncoder.h
SkImageFilter.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkImageGenerator.h Remove legacy SkImageGenerator YUV planes interface 2020-10-20 13:44:11 +00:00
SkImageInfo.h Add several more values to SkYUVColorSpace 2020-07-24 18:49:10 +00:00
SkM44.h Add rc accessor method to SkMatrix. 2020-09-22 21:32:20 +00:00
SkMallocPixelRef.h Enable ClangTidy check llvm-namespace-comment. 2020-08-06 19:07:52 +00:00
SkMaskFilter.h remove unused maskfilter helpers: Combine, Compose 2020-05-05 19:10:00 +00:00
SkMath.h impl SkMulDiv255Round with SkMul16ShiftRound 2020-09-09 17:01:17 +00:00
SkMatrix44.h Revert "transition matrix44 to opt-in only" 2020-04-16 10:01:29 +00:00
SkMatrix.h Reland "Allow rect and circle blur fast cases to be used with rotation matrices." 2020-09-24 21:33:44 +00:00
SkMilestone.h Update Skia milestone to 88 2020-10-01 21:26:03 +00:00
SkOverdrawCanvas.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkPaint.h [canvaskit] Add docs/types for Paint and Filters/Effects 2020-10-05 11:46:38 +00:00
SkPath.h test lineTo after addRect 2020-10-31 15:10:48 +00:00
SkPathBuilder.h use pathbuilder 2020-09-09 12:43:00 +00:00
SkPathEffect.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkPathMeasure.h [canvaskit] Flesh out remaining docs for core CanvasKit. 2020-10-05 11:47:40 +00:00
SkPathTypes.h Move convexity enum out of public 2020-08-30 13:04:22 +00:00
SkPicture.h pass 'nested' bool to approximateOpCount 2020-08-19 16:45:53 +00:00
SkPictureRecorder.h Almost remove GrContext 2020-10-20 15:52:01 +00:00
SkPixelRef.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkPixmap.h Wsign-conversion for public headers 2020-06-02 12:34:54 +00:00
SkPngChunkReader.h
SkPoint3.h Add clipping for perspective triangles 2019-12-17 23:24:18 +00:00
SkPoint.h Test texture domain effect with local matrix. 2019-11-22 22:37:33 +00:00
SkPromiseImageTexture.h Simplify promise image callbacks. 2020-11-10 02:47:56 +00:00
SkRasterHandleAllocator.h use std::make_unique 2019-12-12 22:32:45 +00:00
SkRect.h Remove SkMin32/SkMax32 2020-02-06 17:31:51 +00:00
SkRefCnt.h Make GrSurfaceProxy ref counts thread safe. 2019-10-24 19:55:23 +00:00
SkRegion.h remove enum docs 2020-02-11 21:43:07 +00:00
SkRRect.h Fix special case in SkRRect::setOval where the oval devolves to a rect 2020-10-14 17:44:51 +00:00
SkRSXform.h
SkRWBuffer.h Fix clang 12 Wsuggest-override and Wsuggest-destructor-override 2020-07-22 01:11:36 +00:00
SkSamplingOptions.h Move image sampling options into their own header 2020-11-06 17:30:44 +00:00
SkScalar.h Format and comment SkScalarInterpFunc 2020-08-26 20:50:34 +00:00
SkSerialProcs.h
SkShader.h Almost remove GrContext 2020-10-20 15:52:01 +00:00
SkSize.h Remove GrSurfaceDesc 2020-02-07 19:48:13 +00:00
SkStream.h Add SkFILEStream constructor which takes a size. 2020-09-11 19:50:24 +00:00
SkString.h Use SkScalar type where appropriate. 2020-07-28 20:13:37 +00:00
SkStrokeRec.h Relax SkStrokeRec::hasEqualEffect 2020-09-15 20:05:40 +00:00
SkSurface.h Update DDL testing harness to support drawing DDL w/ integer offsets 2020-11-10 14:34:46 +00:00
SkSurfaceCharacterization.h Add GrInternalSurfaceFlag for vulkan input attachment. 2020-08-27 20:05:29 +00:00
SkSurfaceProps.h Remove code guarded by SK_LEGACY_SURFACE_PROPS. 2020-10-23 22:41:36 +00:00
SkSwizzle.h
SkTextBlob.h Replace 'typedef xxxxx INHERITED' with 'using INHERITED = xxxx;'. 2020-09-03 03:41:26 +00:00
SkTileMode.h
SkTime.h Remove SK_REQUIRE_LOCAL_VAR macro. 2020-07-31 02:32:01 +00:00
SkTraceMemoryDump.h
SkTypeface.h Add SkTypeface::getPostScriptName. 2020-10-06 15:35:06 +00:00
SkTypes.h Track vulkan memory allocations in UMA. 2020-10-29 15:24:23 +00:00
SkUnPreMultiply.h
SkVertices.h Enable ClangTidy check readability-const-return-type. 2020-08-07 17:42:38 +00:00
SkYUVAIndex.h Remove SkTMin and SkTMax 2020-02-07 18:40:09 +00:00
SkYUVAInfo.h Revert "Revert "New variant of SkImage::MakeFromYUVATextures."" 2020-10-19 15:37:29 +00:00
SkYUVAPixmaps.h Revert "Revert changes to unbreak bots." 2020-11-05 14:35:23 +00:00
SkYUVASizeInfo.h A new way to specify YUVA planar data from SkCodec to SkImage_Lazy 2020-08-24 14:25:32 +00:00