Index: src/effects/GrCircleBlurFragmentProcessor.h |
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h |
index 6dc599b7bb814f62bf337ea0c0c75817894eeba4..89c067c43b10a4786c27bbc47cdb3412e670f814 100644 |
--- a/src/effects/GrCircleBlurFragmentProcessor.h |
+++ b/src/effects/GrCircleBlurFragmentProcessor.h |
@@ -28,35 +28,41 @@ public: |
SkString dumpInfo() const override { |
SkString str; |
- str.appendf("Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], Sigma %.2f, Offset: %.2f", |
+ str.appendf("Rect [L: %.2f, T: %.2f, R: %.2f, B: %.2f], Sigma %.2f, solidR: %.2f, " |
+ "textureR: %.2f", |
fCircle.fLeft, fCircle.fTop, fCircle.fRight, fCircle.fBottom, |
- fSigma, fOffset); |
+ fSigma, fSolidRadius, fTextureRadius); |
return str; |
} |
static sk_sp<GrFragmentProcessor> Make(GrTextureProvider*textureProvider, |
const SkRect& circle, float sigma) { |
- float offset; |
- |
- SkAutoTUnref<GrTexture> blurProfile(CreateCircleBlurProfileTexture(textureProvider, |
- circle, |
- sigma, |
- &offset)); |
- if (!blurProfile) { |
+ float solidRadius; |
+ float textureRadius; |
+ |
+ SkAutoTUnref<GrTexture> profile(CreateCircleBlurProfileTexture(textureProvider, |
+ circle, |
+ sigma, |
+ &solidRadius, |
+ &textureRadius)); |
+ if (!profile) { |
return nullptr; |
} |
return sk_sp<GrFragmentProcessor>( |
- new GrCircleBlurFragmentProcessor(circle, sigma, offset, blurProfile)); |
+ new GrCircleBlurFragmentProcessor(circle, sigma, solidRadius, textureRadius, profile)); |
} |
- const SkRect& circle() const { return fCircle; } |
- float sigma() const { return fSigma; } |
- float offset() const { return fOffset; } |
- int profileSize() const { return fBlurProfileAccess.getTexture()->width(); } |
- |
private: |
+ // This nested GLSL processor implementation is defined in the cpp file. |
+ class GLSLProcessor; |
+ |
+ /** |
+ * Creates a profile texture for the circle and sigma. The texture will have a height of 1. |
+ * The x texture coord should map from 0 to 1 across the radius range of solidRadius to |
+ * solidRadius + textureRadius. |
+ */ |
GrCircleBlurFragmentProcessor(const SkRect& circle, float sigma, |
- float offset, GrTexture* blurProfile); |
+ float solidRadius, float textureRadius, GrTexture* blurProfile); |
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override; |
@@ -65,18 +71,21 @@ private: |
bool onIsEqual(const GrFragmentProcessor& other) const override { |
const GrCircleBlurFragmentProcessor& cbfp = other.cast<GrCircleBlurFragmentProcessor>(); |
// fOffset is computed from the circle width and the sigma |
- return this->circle() == cbfp.circle() && fSigma == cbfp.fSigma; |
+ return this->fCircle == cbfp.fCircle && fSigma == cbfp.fSigma; |
} |
void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
static GrTexture* CreateCircleBlurProfileTexture(GrTextureProvider*, |
const SkRect& circle, |
- float sigma, float* offset); |
+ float sigma, |
+ float* solidRadius, |
+ float* textureRadius); |
SkRect fCircle; |
float fSigma; |
- float fOffset; |
+ float fSolidRadius; |
+ float fTextureRadius; |
GrTextureAccess fBlurProfileAccess; |
GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |