| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrCircleBlurFragmentProcessor.h" | 9 #include "GrCircleBlurFragmentProcessor.h" |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 GrTexture* blurProf
ile) | 86 GrTexture* blurProf
ile) |
| 87 : fCircle(circle) | 87 : fCircle(circle) |
| 88 , fSigma(sigma) | 88 , fSigma(sigma) |
| 89 , fOffset(offset) | 89 , fOffset(offset) |
| 90 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { | 90 , fBlurProfileAccess(blurProfile, GrTextureParams::kBilerp_FilterMode) { |
| 91 this->initClassID<GrCircleBlurFragmentProcessor>(); | 91 this->initClassID<GrCircleBlurFragmentProcessor>(); |
| 92 this->addTextureAccess(&fBlurProfileAccess); | 92 this->addTextureAccess(&fBlurProfileAccess); |
| 93 this->setWillReadFragmentPosition(); | 93 this->setWillReadFragmentPosition(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 GrGLSLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLInstance() con
st { | 96 GrGLSLFragmentProcessor* GrCircleBlurFragmentProcessor::onCreateGLSLInstance() c
onst { |
| 97 return new GrGLCircleBlurFragmentProcessor(*this); | 97 return new GrGLCircleBlurFragmentProcessor(*this); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void GrCircleBlurFragmentProcessor::onGetGLProcessorKey(const GrGLSLCaps& caps, | 100 void GrCircleBlurFragmentProcessor::onGetGLSLProcessorKey(const GrGLSLCaps& caps
, |
| 101 GrProcessorKeyBuilder* b
) const { | 101 GrProcessorKeyBuilder*
b) const { |
| 102 GrGLCircleBlurFragmentProcessor::GenKey(*this, caps, b); | 102 GrGLCircleBlurFragmentProcessor::GenKey(*this, caps, b); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput*
inout) const { | 105 void GrCircleBlurFragmentProcessor::onComputeInvariantOutput(GrInvariantOutput*
inout) const { |
| 106 inout->mulByUnknownSingleComponent(); | 106 inout->mulByUnknownSingleComponent(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Evaluate an AA circle function centered at the origin with 'radius' at (x,y) | 109 // Evaluate an AA circle function centered at the origin with 'radius' at (x,y) |
| 110 static inline float disk(float x, float y, float radius) { | 110 static inline float disk(float x, float y, float radius) { |
| 111 float distSq = x*x + y*y; | 111 float distSq = x*x + y*y; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); | 252 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCircleBlurFragmentProcessor); |
| 253 | 253 |
| 254 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { | 254 const GrFragmentProcessor* GrCircleBlurFragmentProcessor::TestCreate(GrProcessor
TestData* d) { |
| 255 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); | 255 SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f); |
| 256 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); | 256 SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f); |
| 257 SkRect circle = SkRect::MakeWH(wh, wh); | 257 SkRect circle = SkRect::MakeWH(wh, wh); |
| 258 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); | 258 return GrCircleBlurFragmentProcessor::Create(d->fContext->textureProvider(),
circle, sigma); |
| 259 } | 259 } |
| 260 | 260 |
| 261 #endif | 261 #endif |
| OLD | NEW |