diff options
author | Robert Phillips <robertphillips@google.com> | 2017-01-30 15:58:27 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-30 15:58:33 +0000 |
commit | 877b15b301d798a0eb7aeb9ad36db383ef63ace9 (patch) | |
tree | d49796db4929d53f13987ac3b4828eb824c8138d /src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp | |
parent | d0dc05b98b71af43b44f13beba1292db52b75539 (diff) |
Revert "Make blur utils take GrTextureProxies"
This reverts commit d0dc05b98b71af43b44f13beba1292db52b75539.
Reason for revert: assertion failure on N7
Original change's description:
> Make blur utils take GrTextureProxies
>
> Change-Id: I1c5054de6d9827eece2f73c4c78818b4db0bc611
> Reviewed-on: https://skia-review.googlesource.com/7738
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
>
TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I82d9385e23279db4c7a6757f1224e603e231354c
Reviewed-on: https://skia-review.googlesource.com/7744
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp')
-rw-r--r-- | src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp index 66aba13438..c5f554fc69 100644 --- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp +++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp @@ -115,17 +115,12 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman, } pdman.set2fv(fImageIncrementUni, 1, imageIncrement); if (conv.useBounds()) { - const int* bounds = conv.bounds(); - if (Gr1DKernelEffect::kX_Direction == conv.direction()) { - SkScalar inv = SkScalarInvert(SkIntToScalar(texture.width())); - pdman.set2f(fBoundsUni, inv * bounds[0], inv * bounds[1]); + const float* bounds = conv.bounds(); + if (Gr1DKernelEffect::kY_Direction == conv.direction() && + texture.origin() != kTopLeft_GrSurfaceOrigin) { + pdman.set2f(fBoundsUni, 1.0f - bounds[1], 1.0f - bounds[0]); } else { - SkScalar inv = SkScalarInvert(SkIntToScalar(texture.height())); - if (texture.origin() != kTopLeft_GrSurfaceOrigin) { - pdman.set2f(fBoundsUni, 1.0f - (inv * bounds[1]), 1.0f - (inv * bounds[0])); - } else { - pdman.set2f(fBoundsUni, inv * bounds[1], inv * bounds[0]); - } + pdman.set2f(fBoundsUni, bounds[0], bounds[1]); } } int width = Gr1DKernelEffect::WidthFromRadius(conv.radius()); @@ -149,6 +144,8 @@ void GrGLConvolutionEffect::GenKey(const GrProcessor& processor, const GrShaderC } /////////////////////////////////////////////////////////////////////////////// + + static void fill_in_1D_guassian_kernel(float* kernel, int width, float gaussianSigma, int radius) { const float denom = 1.0f / (2.0f * gaussianSigma * gaussianSigma); @@ -172,7 +169,7 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(G int radius, float gaussianSigma, bool useBounds, - int bounds[2]) + float bounds[2]) : INHERITED(texture, direction, radius, ModulationFlags(texture->config())) , fUseBounds(useBounds) { this->initClassID<GrGaussianConvolutionFragmentProcessor>(); @@ -190,7 +187,7 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor( int radius, float gaussianSigma, bool useBounds, - int bounds[2]) + float bounds[2]) : INHERITED{context, ModulationFlags(proxy->config()), GR_PROXY_MOVE(proxy), @@ -233,25 +230,16 @@ sk_sp<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::TestCreate( GrProcessorTestData* d) { int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : GrProcessorUnitTest::kAlphaTextureIdx; - sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx); + Direction dir = d->fRandom->nextBool() ? kX_Direction : kY_Direction; + int radius = d->fRandom->nextRangeU(1, kMaxKernelRadius); bool useBounds = d->fRandom->nextBool(); - int bounds[2]; - - Direction dir; - if (d->fRandom->nextBool()) { - dir = kX_Direction; - bounds[0] = d->fRandom->nextRangeU(0, proxy->width()-1); - bounds[1] = d->fRandom->nextRangeU(bounds[0], proxy->width()-1); - } else { - dir = kY_Direction; - bounds[0] = d->fRandom->nextRangeU(0, proxy->height()-1); - bounds[1] = d->fRandom->nextRangeU(bounds[0], proxy->height()-1); + float bounds[2]; + for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { + bounds[i] = d->fRandom->nextF(); } - int radius = d->fRandom->nextRangeU(1, kMaxKernelRadius); float sigma = radius / 3.f; - return GrGaussianConvolutionFragmentProcessor::Make( d->context(), d->textureProxy(texIdx), dir, radius, sigma, useBounds, bounds); } |