Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d8a189f

Browse files
brianosmanSkia Commit-Bot
authored and
Skia Commit-Bot
committed
Revert "Fix a bug in SkGpuBlurUtils::GaussianBlur"
This reverts commit 5d156ad. 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 <[email protected]> > Commit-Queue: Robert Phillips <[email protected]> [email protected],[email protected] 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 <[email protected]> Commit-Queue: Brian Osman <[email protected]>
1 parent d5e7b0b commit d8a189f

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

src/core/SkGpuBlurUtils.cpp

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
161161
Direction direction,
162162
int radius,
163163
float sigma,
164-
SkIRect* contentRect,
164+
const SkIRect& srcBounds,
165165
GrTextureDomain::Mode mode,
166166
const SkImageInfo& dstII,
167167
SkBackingFit fit) {
@@ -184,19 +184,18 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
184184
int bounds[2] = { 0, 0 };
185185
SkIRect dstRect = SkIRect::MakeWH(srcRect.width(), srcRect.height());
186186
if (GrTextureDomain::kIgnore_Mode == mode) {
187-
*contentRect = dstRect;
188187
convolve_gaussian_1d(dstRenderTargetContext.get(), clip, dstRect, srcOffset,
189188
std::move(proxy), direction, radius, sigma,
190189
GrTextureDomain::kIgnore_Mode, bounds);
191190
return dstRenderTargetContext;
192191
}
193192

194-
SkIRect midRect = *contentRect, leftRect, rightRect;
193+
SkIRect midRect = srcBounds, leftRect, rightRect;
195194
midRect.offset(srcOffset);
196195
SkIRect topRect, bottomRect;
197196
if (Direction::kX == direction) {
198-
bounds[0] = contentRect->left();
199-
bounds[1] = contentRect->right();
197+
bounds[0] = srcBounds.left();
198+
bounds[1] = srcBounds.right();
200199
topRect = SkIRect::MakeLTRB(0, 0, dstRect.right(), midRect.top());
201200
bottomRect = SkIRect::MakeLTRB(0, midRect.bottom(), dstRect.right(), dstRect.bottom());
202201
midRect.inset(radius, 0);
@@ -205,14 +204,9 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
205204
SkIRect::MakeLTRB(midRect.right(), midRect.top(), dstRect.width(), midRect.bottom());
206205
dstRect.fTop = midRect.top();
207206
dstRect.fBottom = midRect.bottom();
208-
209-
contentRect->fLeft = dstRect.fLeft;
210-
contentRect->fTop = midRect.fTop;
211-
contentRect->fRight = dstRect.fRight;
212-
contentRect->fBottom = midRect.fBottom;
213207
} else {
214-
bounds[0] = contentRect->top();
215-
bounds[1] = contentRect->bottom();
208+
bounds[0] = srcBounds.top();
209+
bounds[1] = srcBounds.bottom();
216210
topRect = SkIRect::MakeLTRB(0, 0, midRect.left(), dstRect.bottom());
217211
bottomRect = SkIRect::MakeLTRB(midRect.right(), 0, dstRect.right(), dstRect.bottom());
218212
midRect.inset(0, radius);
@@ -221,11 +215,6 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
221215
SkIRect::MakeLTRB(midRect.left(), midRect.bottom(), midRect.right(), dstRect.height());
222216
dstRect.fLeft = midRect.left();
223217
dstRect.fRight = midRect.right();
224-
225-
contentRect->fLeft = midRect.fLeft;
226-
contentRect->fTop = dstRect.fTop;
227-
contentRect->fRight = midRect.fRight;
228-
contentRect->fBottom = dstRect.fBottom;
229218
}
230219
if (!topRect.isEmpty()) {
231220
dstRenderTargetContext->clear(&topRect, 0, GrRenderTargetContext::CanClearFullscreen::kNo);
@@ -499,7 +488,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
499488
scale_irect_roundout(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY);
500489
if (sigmaX > 0.0f) {
501490
dstRenderTargetContext = convolve_gaussian(context, std::move(srcProxy), srcRect, srcOffset,
502-
Direction::kX, radiusX, sigmaX, &localSrcBounds,
491+
Direction::kX, radiusX, sigmaX, localSrcBounds,
503492
mode, finalDestII, xFit);
504493
if (!dstRenderTargetContext) {
505494
return nullptr;
@@ -519,12 +508,17 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
519508
}
520509

521510
srcRect.offsetTo(0, 0);
511+
localSrcBounds = srcRect;
512+
if (GrTextureDomain::kClamp_Mode == mode) {
513+
// We need to adjust bounds because we only fill part of the srcRect in x-pass.
514+
localSrcBounds.inset(0, radiusY);
515+
}
522516
srcOffset.set(0, 0);
523517
}
524518

525519
if (sigmaY > 0.0f) {
526520
dstRenderTargetContext = convolve_gaussian(context, std::move(srcProxy), srcRect, srcOffset,
527-
Direction::kY, radiusY, sigmaY, &localSrcBounds,
521+
Direction::kY, radiusY, sigmaY, localSrcBounds,
528522
mode, finalDestII, yFit);
529523
if (!dstRenderTargetContext) {
530524
return nullptr;

0 commit comments

Comments
 (0)