Index: src/effects/SkColorFilters.cpp |
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp |
index 3d89d0b52a5971c388dcea3c89f36acd7ef0e2c0..bd0d2aa6c89cfe96e5306302ac8af3b8b09da265 100644 |
--- a/src/effects/SkColorFilters.cpp |
+++ b/src/effects/SkColorFilters.cpp |
@@ -74,7 +74,7 @@ public: |
#endif |
#if SK_SUPPORT_GPU |
- virtual GrEffect* asNewEffect(GrContext*) const SK_OVERRIDE; |
+ virtual GrFragmentProcessor* asFragmentProcessor(GrContext*) const SK_OVERRIDE; |
#endif |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkModeColorFilter) |
@@ -123,10 +123,10 @@ SkFlattenable* SkModeColorFilter::CreateProc(SkReadBuffer& buffer) { |
/////////////////////////////////////////////////////////////////////////////// |
#if SK_SUPPORT_GPU |
#include "GrBlend.h" |
-#include "GrEffect.h" |
-#include "GrEffectUnitTest.h" |
-#include "GrTBackendEffectFactory.h" |
-#include "gl/GrGLEffect.h" |
+#include "GrProcessor.h" |
+#include "GrProcessorUnitTest.h" |
+#include "GrTBackendProcessorFactory.h" |
+#include "gl/GrGLProcessor.h" |
#include "gl/builders/GrGLProgramBuilder.h" |
#include "SkGr.h" |
@@ -182,9 +182,9 @@ static inline ColorExpr color_filter_expression(const SkXfermode::Mode& mode, |
} |
-class ModeColorFilterEffect : public GrEffect { |
+class ModeColorFilterEffect : public GrFragmentProcessor { |
public: |
- static GrEffect* Create(const GrColor& c, SkXfermode::Mode mode) { |
+ static GrFragmentProcessor* Create(const GrColor& c, SkXfermode::Mode mode) { |
// TODO: Make the effect take the coeffs rather than mode since we already do the |
// conversion here. |
SkXfermode::Coeff srcCoeff, dstCoeff; |
@@ -207,8 +207,8 @@ public: |
return true; |
} |
- virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
- return GrTBackendEffectFactory<ModeColorFilterEffect>::getInstance(); |
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE { |
+ return GrTBackendFragmentProcessorFactory<ModeColorFilterEffect>::getInstance(); |
} |
static const char* Name() { return "ModeColorFilterEffect"; } |
@@ -216,24 +216,24 @@ public: |
SkXfermode::Mode mode() const { return fMode; } |
GrColor color() const { return fColor; } |
- class GLEffect : public GrGLEffect { |
+ class GLProcessor : public GrGLFragmentProcessor { |
public: |
- GLEffect(const GrBackendEffectFactory& factory, const GrEffect&) |
+ GLProcessor(const GrBackendProcessorFactory& factory, const GrProcessor&) |
: INHERITED(factory) { |
} |
virtual void emitCode(GrGLProgramBuilder* builder, |
- const GrEffect& effect, |
- const GrEffectKey& key, |
+ const GrFragmentProcessor& fp, |
+ const GrProcessorKey&, |
const char* outputColor, |
const char* inputColor, |
- const TransformedCoordsArray& coords, |
- const TextureSamplerArray& samplers) SK_OVERRIDE { |
- SkXfermode::Mode mode = effect.cast<ModeColorFilterEffect>().mode(); |
+ const TransformedCoordsArray&, |
+ const TextureSamplerArray&) SK_OVERRIDE { |
+ SkXfermode::Mode mode = fp.cast<ModeColorFilterEffect>().mode(); |
SkASSERT(SkXfermode::kDst_Mode != mode); |
const char* colorFilterColorUniName = NULL; |
- if (effect.cast<ModeColorFilterEffect>().willUseFilterColor()) { |
+ if (fp.cast<ModeColorFilterEffect>().willUseFilterColor()) { |
fFilterColorUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
kVec4f_GrSLType, "FilterColor", |
&colorFilterColorUniName); |
@@ -247,18 +247,18 @@ public: |
codeAppendf("\t%s = %s;\n", outputColor, filter.c_str()); |
} |
- static void GenKey(const GrEffect& effect, const GrGLCaps&, |
- GrEffectKeyBuilder* b) { |
- const ModeColorFilterEffect& colorModeFilter = effect.cast<ModeColorFilterEffect>(); |
+ static void GenKey(const GrProcessor& fp, const GrGLCaps&, |
+ GrProcessorKeyBuilder* b) { |
+ const ModeColorFilterEffect& colorModeFilter = fp.cast<ModeColorFilterEffect>(); |
// The SL code does not depend on filter color at the moment, so no need to represent it |
// in the key. |
b->add32(colorModeFilter.mode()); |
} |
virtual void setData(const GrGLProgramDataManager& pdman, |
- const GrEffect& effect) SK_OVERRIDE { |
+ const GrProcessor& fp) SK_OVERRIDE { |
if (fFilterColorUni.isValid()) { |
- const ModeColorFilterEffect& colorModeFilter = effect.cast<ModeColorFilterEffect>(); |
+ const ModeColorFilterEffect& colorModeFilter = fp.cast<ModeColorFilterEffect>(); |
GrGLfloat c[4]; |
GrColorToRGBAFloat(colorModeFilter.color(), c); |
pdman.set4fv(fFilterColorUni, 1, c); |
@@ -268,10 +268,10 @@ public: |
private: |
GrGLProgramDataManager::UniformHandle fFilterColorUni; |
- typedef GrGLEffect INHERITED; |
+ typedef GrGLFragmentProcessor INHERITED; |
}; |
- GR_DECLARE_EFFECT_TEST; |
+ GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
private: |
ModeColorFilterEffect(GrColor color, SkXfermode::Mode mode) |
@@ -288,7 +288,7 @@ private: |
} |
} |
- virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE { |
+ virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { |
const ModeColorFilterEffect& s = other.cast<ModeColorFilterEffect>(); |
return fMode == s.fMode && fColor == s.fColor; |
} |
@@ -296,7 +296,7 @@ private: |
SkXfermode::Mode fMode; |
GrColor fColor; |
- typedef GrEffect INHERITED; |
+ typedef GrFragmentProcessor INHERITED; |
}; |
namespace { |
@@ -396,11 +396,11 @@ void ModeColorFilterEffect::getConstantColorComponents(GrColor* color, uint32_t* |
*validFlags = result.getValidComponents(); |
} |
-GR_DEFINE_EFFECT_TEST(ModeColorFilterEffect); |
-GrEffect* ModeColorFilterEffect::TestCreate(SkRandom* rand, |
- GrContext*, |
- const GrDrawTargetCaps&, |
- GrTexture*[]) { |
+GR_DEFINE_FRAGMENT_PROCESSOR_TEST(ModeColorFilterEffect); |
+GrFragmentProcessor* ModeColorFilterEffect::TestCreate(SkRandom* rand, |
+ GrContext*, |
+ const GrDrawTargetCaps&, |
+ GrTexture*[]) { |
SkXfermode::Mode mode = SkXfermode::kDst_Mode; |
while (SkXfermode::kDst_Mode == mode) { |
mode = static_cast<SkXfermode::Mode>(rand->nextRangeU(0, SkXfermode::kLastCoeffMode)); |
@@ -409,7 +409,7 @@ GrEffect* ModeColorFilterEffect::TestCreate(SkRandom* rand, |
return ModeColorFilterEffect::Create(color, mode); |
} |
-GrEffect* SkModeColorFilter::asNewEffect(GrContext*) const { |
+GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*) const { |
if (SkXfermode::kDst_Mode != fMode) { |
return ModeColorFilterEffect::Create(SkColor2GrColor(fColor), fMode); |
} |