aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkGpuBlurUtils.cpp
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2018-05-03 20:57:04 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-03 20:57:13 +0000
commitd8a189fca3cdfa064de75a280d5af34cc5026bbe (patch)
tree040e4823edd7f032dac897f9516e9946151ef83a /src/core/SkGpuBlurUtils.cpp
parentd5e7b0b46e028abc4425f5c3bb085d6cbf110897 (diff)
Revert "Fix a bug in SkGpuBlurUtils::GaussianBlur"
This reverts commit 5d156ad01f1562b3ee9fde096b57ad1b2cbff20c. Reason for revert: Chrome roll failing on cc unit tests Original change's description: > Fix a bug in SkGpuBlurUtils::GaussianBlur > > This fixes the remaining imageblurclampmode bug and a preexisting un-reported error in the imageblurrepeatmode GM. > > Bug: skia:7765 > Change-Id: Ib7e8d21ea67e6b2d7088d5e57bec34e159a36fd2 > Reviewed-on: https://skia-review.googlesource.com/125383 > Reviewed-by: Greg Daniel <egdaniel@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> TBR=egdaniel@google.com,robertphillips@google.com Change-Id: I23a164a8f653ef32d7a19462eed0638d91c958e8 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia:7765 Reviewed-on: https://skia-review.googlesource.com/125840 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/core/SkGpuBlurUtils.cpp')
-rw-r--r--src/core/SkGpuBlurUtils.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index 696fb5443c..cfd14ee2f6 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -161,7 +161,7 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
Direction direction,
int radius,
float sigma,
- SkIRect* contentRect,
+ const SkIRect& srcBounds,
GrTextureDomain::Mode mode,
const SkImageInfo& dstII,
SkBackingFit fit) {
@@ -184,19 +184,18 @@ 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) {
- *contentRect = dstRect;
convolve_gaussian_1d(dstRenderTargetContext.get(), clip, dstRect, srcOffset,
std::move(proxy), direction, radius, sigma,
GrTextureDomain::kIgnore_Mode, bounds);
return dstRenderTargetContext;
}
- SkIRect midRect = *contentRect, leftRect, rightRect;
+ SkIRect midRect = srcBounds, leftRect, rightRect;
midRect.offset(srcOffset);
SkIRect topRect, bottomRect;
if (Direction::kX == direction) {
- bounds[0] = contentRect->left();
- bounds[1] = contentRect->right();
+ bounds[0] = srcBounds.left();
+ bounds[1] = srcBounds.right();
topRect = SkIRect::MakeLTRB(0, 0, dstRect.right(), midRect.top());
bottomRect = SkIRect::MakeLTRB(0, midRect.bottom(), dstRect.right(), dstRect.bottom());
midRect.inset(radius, 0);
@@ -205,14 +204,9 @@ 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();
-
- contentRect->fLeft = dstRect.fLeft;
- contentRect->fTop = midRect.fTop;
- contentRect->fRight = dstRect.fRight;
- contentRect->fBottom = midRect.fBottom;
} else {
- bounds[0] = contentRect->top();
- bounds[1] = contentRect->bottom();
+ bounds[0] = srcBounds.top();
+ bounds[1] = srcBounds.bottom();
topRect = SkIRect::MakeLTRB(0, 0, midRect.left(), dstRect.bottom());
bottomRect = SkIRect::MakeLTRB(midRect.right(), 0, dstRect.right(), dstRect.bottom());
midRect.inset(0, radius);
@@ -221,11 +215,6 @@ 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();
-
- contentRect->fLeft = midRect.fLeft;
- contentRect->fTop = dstRect.fTop;
- contentRect->fRight = midRect.fRight;
- contentRect->fBottom = dstRect.fBottom;
}
if (!topRect.isEmpty()) {
dstRenderTargetContext->clear(&topRect, 0, GrRenderTargetContext::CanClearFullscreen::kNo);
@@ -499,7 +488,7 @@ 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,
+ Direction::kX, radiusX, sigmaX, localSrcBounds,
mode, finalDestII, xFit);
if (!dstRenderTargetContext) {
return nullptr;
@@ -519,12 +508,17 @@ 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,
+ Direction::kY, radiusY, sigmaY, localSrcBounds,
mode, finalDestII, yFit);
if (!dstRenderTargetContext) {
return nullptr;