diff options
author | Robert Phillips <robertphillips@google.com> | 2018-05-01 15:17:50 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-02 11:47:17 +0000 |
commit | eaded9d09c310f96715d1691dbd1c56d73bb2043 (patch) | |
tree | 8a383864c38e12d13f44a94c28c2b5edfaf0a142 | |
parent | 3fef39d94d2a81e44289721dc332b6475de60d7f (diff) |
Fix DDL blur image filter
This fixes on of the DDL render problems in the imageblurclampmode GM.
Bug: skia:7765
Change-Id: I2d6779183cd47b63b47f9f071c2266643d222feb
Reviewed-on: https://skia-review.googlesource.com/125000
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
-rw-r--r-- | src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp index fdd4990328..c546f8c9c8 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp @@ -147,15 +147,22 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman, } if (Direction::kX == conv.direction()) { SkScalar inv = SkScalarInvert(SkIntToScalar(texture.width())); - pdman.set2f(fBoundsUni, inv * bounds[0], inv * bounds[1]); + bounds[0] *= inv; + bounds[1] *= inv; } else { SkScalar inv = SkScalarInvert(SkIntToScalar(texture.height())); if (proxy->origin() != kTopLeft_GrSurfaceOrigin) { - pdman.set2f(fBoundsUni, 1.0f - (inv * bounds[1]), 1.0f - (inv * bounds[0])); + float tmp = bounds[0]; + bounds[0] = 1.0f - (inv * bounds[1]); + bounds[1] = 1.0f - (inv * tmp); } else { - pdman.set2f(fBoundsUni, inv * bounds[1], inv * bounds[0]); + bounds[0] *= inv; + bounds[1] *= inv; } } + + SkASSERT(bounds[0] <= bounds[1]); + pdman.set2f(fBoundsUni, bounds[0], bounds[1]); } int width = conv.width(); @@ -274,12 +281,12 @@ std::unique_ptr<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::Tes Direction dir; if (d->fRandom->nextBool()) { dir = Direction::kX; - bounds[0] = d->fRandom->nextRangeU(0, proxy->width()-1); - bounds[1] = d->fRandom->nextRangeU(bounds[0], proxy->width()-1); + bounds[0] = d->fRandom->nextRangeU(0, proxy->width()-2); + bounds[1] = d->fRandom->nextRangeU(bounds[0]+1, proxy->width()-1); } else { dir = Direction::kY; - bounds[0] = d->fRandom->nextRangeU(0, proxy->height()-1); - bounds[1] = d->fRandom->nextRangeU(bounds[0], proxy->height()-1); + bounds[0] = d->fRandom->nextRangeU(0, proxy->height()-2); + bounds[1] = d->fRandom->nextRangeU(bounds[0]+1, proxy->height()-1); } int radius = d->fRandom->nextRangeU(1, kMaxKernelRadius); |