aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGpuBlurUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkGpuBlurUtils.cpp')
-rw-r--r--src/core/SkGpuBlurUtils.cpp56
1 files changed, 39 insertions, 17 deletions
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index cfd14ee2f6..84cf8301a7 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -161,10 +161,11 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
Direction direction,
int radius,
float sigma,
- const SkIRect& srcBounds,
+ SkIRect* contentRect,
GrTextureDomain::Mode mode,
const SkImageInfo& dstII,
- SkBackingFit fit) {
+ SkBackingFit fit,
+ int radiusY /* temporarary*/) {
SkASSERT(srcRect.width() <= dstII.width() && srcRect.height() <= dstII.height());
GrPixelConfig config = get_blur_config(proxy.get(), dstII.colorSpace());
@@ -184,18 +185,25 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
int bounds[2] = { 0, 0 };
SkIRect dstRect = SkIRect::MakeWH(srcRect.width(), srcRect.height());
if (GrTextureDomain::kIgnore_Mode == mode) {
+#ifdef SK_IGNORE_BLUR_IMAGE_FILTER_FIX
+ if (Direction::kX == direction) {
+ *contentRect = dstRect;
+ }
+#else
+ *contentRect = dstRect;
+#endif
convolve_gaussian_1d(dstRenderTargetContext.get(), clip, dstRect, srcOffset,
std::move(proxy), direction, radius, sigma,
GrTextureDomain::kIgnore_Mode, bounds);
return dstRenderTargetContext;
}
- SkIRect midRect = srcBounds, leftRect, rightRect;
+ SkIRect midRect = *contentRect, leftRect, rightRect;
midRect.offset(srcOffset);
SkIRect topRect, bottomRect;
if (Direction::kX == direction) {
- bounds[0] = srcBounds.left();
- bounds[1] = srcBounds.right();
+ bounds[0] = contentRect->left();
+ bounds[1] = contentRect->right();
topRect = SkIRect::MakeLTRB(0, 0, dstRect.right(), midRect.top());
bottomRect = SkIRect::MakeLTRB(0, midRect.bottom(), dstRect.right(), dstRect.bottom());
midRect.inset(radius, 0);
@@ -204,9 +212,22 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
SkIRect::MakeLTRB(midRect.right(), midRect.top(), dstRect.width(), midRect.bottom());
dstRect.fTop = midRect.top();
dstRect.fBottom = midRect.bottom();
+
+#ifdef SK_IGNORE_BLUR_IMAGE_FILTER_FIX
+ *contentRect = SkIRect::MakeWH(srcRect.width(), srcRect.height());
+ if (GrTextureDomain::kClamp_Mode == mode) {
+ // We need to adjust bounds because we only fill part of the srcRect in x-pass.
+ contentRect->inset(0, radiusY);
+ }
+#else
+ contentRect->fLeft = dstRect.fLeft;
+ contentRect->fTop = midRect.fTop;
+ contentRect->fRight = dstRect.fRight;
+ contentRect->fBottom = midRect.fBottom;
+#endif
} else {
- bounds[0] = srcBounds.top();
- bounds[1] = srcBounds.bottom();
+ bounds[0] = contentRect->top();
+ bounds[1] = contentRect->bottom();
topRect = SkIRect::MakeLTRB(0, 0, midRect.left(), dstRect.bottom());
bottomRect = SkIRect::MakeLTRB(midRect.right(), 0, dstRect.right(), dstRect.bottom());
midRect.inset(0, radius);
@@ -215,6 +236,13 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
SkIRect::MakeLTRB(midRect.left(), midRect.bottom(), midRect.right(), dstRect.height());
dstRect.fLeft = midRect.left();
dstRect.fRight = midRect.right();
+
+#ifndef SK_IGNORE_BLUR_IMAGE_FILTER_FIX
+ contentRect->fLeft = midRect.fLeft;
+ contentRect->fTop = dstRect.fTop;
+ contentRect->fRight = midRect.fRight;
+ contentRect->fBottom = dstRect.fBottom;
+#endif
}
if (!topRect.isEmpty()) {
dstRenderTargetContext->clear(&topRect, 0, GrRenderTargetContext::CanClearFullscreen::kNo);
@@ -488,8 +516,8 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
scale_irect_roundout(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY);
if (sigmaX > 0.0f) {
dstRenderTargetContext = convolve_gaussian(context, std::move(srcProxy), srcRect, srcOffset,
- Direction::kX, radiusX, sigmaX, localSrcBounds,
- mode, finalDestII, xFit);
+ Direction::kX, radiusX, sigmaX, &localSrcBounds,
+ mode, finalDestII, xFit, radiusY);
if (!dstRenderTargetContext) {
return nullptr;
}
@@ -508,18 +536,13 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
}
srcRect.offsetTo(0, 0);
- localSrcBounds = srcRect;
- if (GrTextureDomain::kClamp_Mode == mode) {
- // We need to adjust bounds because we only fill part of the srcRect in x-pass.
- localSrcBounds.inset(0, radiusY);
- }
srcOffset.set(0, 0);
}
if (sigmaY > 0.0f) {
dstRenderTargetContext = convolve_gaussian(context, std::move(srcProxy), srcRect, srcOffset,
- Direction::kY, radiusY, sigmaY, localSrcBounds,
- mode, finalDestII, yFit);
+ Direction::kY, radiusY, sigmaY, &localSrcBounds,
+ mode, finalDestII, yFit, radiusY);
if (!dstRenderTargetContext) {
return nullptr;
}
@@ -548,4 +571,3 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
}
#endif
-