Use a "decal" domain for filterMaskGPU
In addition to requiring absClear, the old approach yielded
asymmetrical blurs where the top and left edges got a "clamp" mode,
and the right and bottom edges effectively got a "decal" mode.
Bug: skia:
Change-Id: If72da4374eb2f0475acae59e269d44cb72c5ce95
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/240759
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
diff --git a/src/core/SkBlurMF.cpp b/src/core/SkBlurMF.cpp
index 8a6abe7..64d1383 100644
--- a/src/core/SkBlurMF.cpp
+++ b/src/core/SkBlurMF.cpp
@@ -879,15 +879,16 @@
// If we're doing a normal blur, we can clobber the pathTexture in the
// gaussianBlur. Otherwise, we need to save it for later compositing.
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
+ SkIRect srcRect = SkIRect::MakeWH(srcProxy->width(), srcProxy->height());
auto renderTargetContext = SkGpuBlurUtils::GaussianBlur(context,
srcProxy,
SkIPoint::Make(0, 0),
nullptr,
clipRect,
- SkIRect::EmptyIRect(),
+ srcRect,
xformedSigma,
xformedSigma,
- GrTextureDomain::kIgnore_Mode,
+ GrTextureDomain::kDecal_Mode,
kPremul_SkAlphaType);
if (!renderTargetContext) {
return nullptr;
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index c8fdc0b..74844fc 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -181,7 +181,7 @@
return nullptr;
}
- rtContext->priv().absClear(nullptr);
+ rtContext->clear(SK_PMColor4fTRANSPARENT);
GrPaint maskPaint;
maskPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
diff --git a/src/gpu/GrRenderTargetContext.h b/src/gpu/GrRenderTargetContext.h
index 83c20f7..1bc8165 100644
--- a/src/gpu/GrRenderTargetContext.h
+++ b/src/gpu/GrRenderTargetContext.h
@@ -81,6 +81,10 @@
*/
void clear(const SkIRect* rect, const SkPMColor4f& color, CanClearFullscreen);
+ void clear(const SkPMColor4f& color) {
+ return this->clear(nullptr, color, CanClearFullscreen::kYes);
+ }
+
/**
* Draw everywhere (respecting the clip) with the paint.
*/
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index 6a39777..6ace1dd 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -53,11 +53,12 @@
sk_sp<GrTextureProxy> mask(proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kBottomLeft_GrSurfaceOrigin));
if (!mask) {
- // TODO: this could be approx but the texture coords will need to be updated
- auto rtc =
- context->priv().makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kExact, size.fWidth,
- size.fHeight, GrColorType::kAlpha_8, nullptr);
+ // TODO: this could be SkBackingFit::kApprox, but:
+ // 1) The texture coords would need to be updated.
+ // 2) We would have to use GrTextureDomain::kClamp_Mode for the GaussianBlur.
+ auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(
+ SkBackingFit::kExact, size.fWidth, size.fHeight, GrColorType::kAlpha_8,
+ nullptr);
if (!rtc) {
return nullptr;
}
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index aaff4d3..6a362cf 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -54,7 +54,9 @@
sk_sp<GrTextureProxy> mask(proxyProvider->findOrCreateProxyByUniqueKey(
key, GrColorType::kAlpha_8, kBottomLeft_GrSurfaceOrigin));
if (!mask) {
- // TODO: this could be approx but the texture coords will need to be updated
+ // TODO: this could be SkBackingFit::kApprox, but:
+ // 1) The texture coords would need to be updated.
+ // 2) We would have to use GrTextureDomain::kClamp_Mode for the GaussianBlur.
auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(
SkBackingFit::kExact, size.fWidth, size.fHeight, GrColorType::kAlpha_8,
nullptr);