Index: src/effects/SkArithmeticMode.cpp |
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp |
index 7ee2a70f66b757ad11fec610807cd4c54d0c3758..85af19cf551fd636f31c13d01ce680e8b3394b00 100644 |
--- a/src/effects/SkArithmeticMode.cpp |
+++ b/src/effects/SkArithmeticMode.cpp |
@@ -14,9 +14,9 @@ |
#if SK_SUPPORT_GPU |
#include "GrContext.h" |
#include "GrCoordTransform.h" |
-#include "gl/GrGLEffect.h" |
+#include "gl/GrGLProcessor.h" |
#include "gl/builders/GrGLProgramBuilder.h" |
-#include "GrTBackendEffectFactory.h" |
+#include "GrTBackendProcessorFactory.h" |
#endif |
static const bool gUseUnpremul = false; |
@@ -35,7 +35,8 @@ public: |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) |
#if SK_SUPPORT_GPU |
- virtual bool asNewEffect(GrEffect** effect, GrTexture* background) const SK_OVERRIDE; |
+ virtual bool asFragmentProcessor(GrFragmentProcessor**, |
+ GrTexture* background) const SK_OVERRIDE; |
#endif |
private: |
@@ -247,44 +248,44 @@ SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2, |
#if SK_SUPPORT_GPU |
-class GrGLArithmeticEffect : public GrGLEffect { |
+class GrGLArithmeticEffect : public GrGLFragmentProcessor { |
public: |
- GrGLArithmeticEffect(const GrBackendEffectFactory&, const GrEffect&); |
+ GrGLArithmeticEffect(const GrBackendProcessorFactory&, const GrProcessor&); |
virtual ~GrGLArithmeticEffect(); |
virtual void emitCode(GrGLProgramBuilder*, |
- const GrEffect&, |
- const GrEffectKey&, |
+ const GrFragmentProcessor&, |
+ const GrProcessorKey&, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray&, |
const TextureSamplerArray&) SK_OVERRIDE; |
- virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVERRIDE; |
+ virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; |
- static void GenKey(const GrEffect&, const GrGLCaps& caps, GrEffectKeyBuilder* b); |
+ static void GenKey(const GrProcessor&, const GrGLCaps& caps, GrProcessorKeyBuilder* b); |
private: |
GrGLProgramDataManager::UniformHandle fKUni; |
bool fEnforcePMColor; |
- typedef GrGLEffect INHERITED; |
+ typedef GrGLFragmentProcessor INHERITED; |
}; |
/////////////////////////////////////////////////////////////////////////////// |
-class GrArithmeticEffect : public GrEffect { |
+class GrArithmeticEffect : public GrFragmentProcessor { |
public: |
- static GrEffect* Create(float k1, float k2, float k3, float k4, bool enforcePMColor, |
+ static GrFragmentProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor, |
GrTexture* background) { |
return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, background)); |
} |
virtual ~GrArithmeticEffect(); |
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; |
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE; |
- typedef GrGLArithmeticEffect GLEffect; |
+ typedef GrGLArithmeticEffect GLProcessor; |
static const char* Name() { return "Arithmetic"; } |
GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture(); } |
@@ -297,7 +298,7 @@ public: |
bool enforcePMColor() const { return fEnforcePMColor; } |
private: |
- virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
+ virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMColor, |
GrTexture* background); |
@@ -306,8 +307,8 @@ private: |
GrCoordTransform fBackgroundTransform; |
GrTextureAccess fBackgroundAccess; |
- GR_DECLARE_EFFECT_TEST; |
- typedef GrEffect INHERITED; |
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
+ typedef GrFragmentProcessor INHERITED; |
}; |
@@ -329,7 +330,7 @@ GrArithmeticEffect::GrArithmeticEffect(float k1, float k2, float k3, float k4, |
GrArithmeticEffect::~GrArithmeticEffect() { |
} |
-bool GrArithmeticEffect::onIsEqual(const GrEffect& sBase) const { |
+bool GrArithmeticEffect::onIsEqual(const GrProcessor& sBase) const { |
const GrArithmeticEffect& s = sBase.cast<GrArithmeticEffect>(); |
return fK1 == s.fK1 && |
fK2 == s.fK2 && |
@@ -339,8 +340,8 @@ bool GrArithmeticEffect::onIsEqual(const GrEffect& sBase) const { |
backgroundTexture() == s.backgroundTexture(); |
} |
-const GrBackendEffectFactory& GrArithmeticEffect::getFactory() const { |
- return GrTBackendEffectFactory<GrArithmeticEffect>::getInstance(); |
+const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const { |
+ return GrTBackendFragmentProcessorFactory<GrArithmeticEffect>::getInstance(); |
} |
void GrArithmeticEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const { |
@@ -350,8 +351,8 @@ void GrArithmeticEffect::getConstantColorComponents(GrColor* color, uint32_t* va |
/////////////////////////////////////////////////////////////////////////////// |
-GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendEffectFactory& factory, |
- const GrEffect& effect) |
+GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendProcessorFactory& factory, |
+ const GrProcessor&) |
: INHERITED(factory), |
fEnforcePMColor(true) { |
} |
@@ -360,14 +361,14 @@ GrGLArithmeticEffect::~GrGLArithmeticEffect() { |
} |
void GrGLArithmeticEffect::emitCode(GrGLProgramBuilder* builder, |
- const GrEffect& effect, |
- const GrEffectKey& key, |
+ const GrFragmentProcessor& fp, |
+ const GrProcessorKey& key, |
const char* outputColor, |
const char* inputColor, |
const TransformedCoordsArray& coords, |
const TextureSamplerArray& samplers) { |
- GrTexture* backgroundTex = effect.cast<GrArithmeticEffect>().backgroundTexture(); |
+ GrTexture* backgroundTex = fp.cast<GrArithmeticEffect>().backgroundTexture(); |
GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
const char* dstColor; |
if (backgroundTex) { |
@@ -408,15 +409,16 @@ void GrGLArithmeticEffect::emitCode(GrGLProgramBuilder* builder, |
} |
} |
-void GrGLArithmeticEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) { |
- const GrArithmeticEffect& arith = effect.cast<GrArithmeticEffect>(); |
+void GrGLArithmeticEffect::setData(const GrGLProgramDataManager& pdman, |
+ const GrProcessor& processor) { |
+ const GrArithmeticEffect& arith = processor.cast<GrArithmeticEffect>(); |
pdman.set4f(fKUni, arith.k1(), arith.k2(), arith.k3(), arith.k4()); |
fEnforcePMColor = arith.enforcePMColor(); |
} |
-void GrGLArithmeticEffect::GenKey(const GrEffect& effect, |
- const GrGLCaps&, GrEffectKeyBuilder* b) { |
- const GrArithmeticEffect& arith = effect.cast<GrArithmeticEffect>(); |
+void GrGLArithmeticEffect::GenKey(const GrProcessor& processor, |
+ const GrGLCaps&, GrProcessorKeyBuilder* b) { |
+ const GrArithmeticEffect& arith = processor.cast<GrArithmeticEffect>(); |
uint32_t key = arith.enforcePMColor() ? 1 : 0; |
if (arith.backgroundTexture()) { |
key |= 2; |
@@ -424,10 +426,10 @@ void GrGLArithmeticEffect::GenKey(const GrEffect& effect, |
b->add32(key); |
} |
-GrEffect* GrArithmeticEffect::TestCreate(SkRandom* rand, |
- GrContext*, |
- const GrDrawTargetCaps&, |
- GrTexture*[]) { |
+GrFragmentProcessor* GrArithmeticEffect::TestCreate(SkRandom* rand, |
+ GrContext*, |
+ const GrDrawTargetCaps&, |
+ GrTexture*[]) { |
float k1 = rand->nextF(); |
float k2 = rand->nextF(); |
float k3 = rand->nextF(); |
@@ -437,16 +439,17 @@ GrEffect* GrArithmeticEffect::TestCreate(SkRandom* rand, |
return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, NULL)); |
} |
-GR_DEFINE_EFFECT_TEST(GrArithmeticEffect); |
- |
-bool SkArithmeticMode_scalar::asNewEffect(GrEffect** effect, GrTexture* background) const { |
- if (effect) { |
- *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]), |
- SkScalarToFloat(fK[1]), |
- SkScalarToFloat(fK[2]), |
- SkScalarToFloat(fK[3]), |
- fEnforcePMColor, |
- background); |
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticEffect); |
+ |
+bool SkArithmeticMode_scalar::asFragmentProcessor(GrFragmentProcessor** fp, |
+ GrTexture* background) const { |
+ if (fp) { |
+ *fp = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]), |
+ SkScalarToFloat(fK[1]), |
+ SkScalarToFloat(fK[2]), |
+ SkScalarToFloat(fK[3]), |
+ fEnforcePMColor, |
+ background); |
} |
return true; |
} |