diff options
Diffstat (limited to 'src/gpu/effects/GrDitherEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrDitherEffect.cpp | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 438fe2c60a..799d970601 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -5,19 +5,16 @@ * found in the LICENSE file. */ -#include "gl/builders/GrGLProgramBuilder.h" #include "GrDitherEffect.h" +#include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" +#include "SkRect.h" #include "gl/GrGLProcessor.h" #include "gl/GrGLSL.h" -#include "GrTBackendProcessorFactory.h" - -#include "SkRect.h" +#include "gl/builders/GrGLProgramBuilder.h" ////////////////////////////////////////////////////////////////////////////// -class GLDitherEffect; - class DitherEffect : public GrFragmentProcessor { public: static GrFragmentProcessor* Create() { @@ -26,16 +23,16 @@ public: } virtual ~DitherEffect() {}; - static const char* Name() { return "Dither"; } - typedef GLDitherEffect GLProcessor; + virtual const char* name() const SK_OVERRIDE { return "Dither"; } - virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE { - return GrTBackendFragmentProcessorFactory<DitherEffect>::getInstance(); - } + virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVERRIDE; + + virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; private: DitherEffect() { + this->initClassID<DitherEffect>(); this->setWillReadFragmentPosition(); } @@ -68,7 +65,7 @@ GrFragmentProcessor* DitherEffect::TestCreate(SkRandom*, class GLDitherEffect : public GrGLFragmentProcessor { public: - GLDitherEffect(const GrBackendProcessorFactory&, const GrProcessor&); + GLDitherEffect(const GrProcessor&); virtual void emitCode(GrGLFPBuilder* builder, const GrFragmentProcessor& fp, @@ -81,9 +78,7 @@ private: typedef GrGLFragmentProcessor INHERITED; }; -GLDitherEffect::GLDitherEffect(const GrBackendProcessorFactory& factory, - const GrProcessor&) - : INHERITED (factory) { +GLDitherEffect::GLDitherEffect(const GrProcessor&) { } void GLDitherEffect::emitCode(GrGLFPBuilder* builder, @@ -111,4 +106,13 @@ void GLDitherEffect::emitCode(GrGLFPBuilder* builder, ////////////////////////////////////////////////////////////////////////////// +void DitherEffect::getGLProcessorKey(const GrGLCaps& caps, + GrProcessorKeyBuilder* b) const { + GLDitherEffect::GenKey(*this, caps, b); +} + +GrGLFragmentProcessor* DitherEffect::createGLInstance() const { + return SkNEW_ARGS(GLDitherEffect, (*this)); +} + GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); } |