| Index: src/effects/SkArithmeticMode.cpp
|
| diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
|
| index 7ee2a70f66b757ad11fec610807cd4c54d0c3758..84280baa5e9620631494a03ed37d0dd24107f639 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,14 +409,14 @@ void GrGLArithmeticEffect::emitCode(GrGLProgramBuilder* builder,
|
| }
|
| }
|
|
|
| -void GrGLArithmeticEffect::setData(const GrGLProgramDataManager& pdman, const GrEffect& effect) {
|
| +void GrGLArithmeticEffect::setData(const GrGLProgramDataManager& pdman, const GrProcessor& effect) {
|
| const GrArithmeticEffect& arith = effect.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) {
|
| +void GrGLArithmeticEffect::GenKey(const GrProcessor& effect,
|
| + const GrGLCaps&, GrProcessorKeyBuilder* b) {
|
| const GrArithmeticEffect& arith = effect.cast<GrArithmeticEffect>();
|
| uint32_t key = arith.enforcePMColor() ? 1 : 0;
|
| if (arith.backgroundTexture()) {
|
| @@ -424,7 +425,7 @@ void GrGLArithmeticEffect::GenKey(const GrEffect& effect,
|
| b->add32(key);
|
| }
|
|
|
| -GrEffect* GrArithmeticEffect::TestCreate(SkRandom* rand,
|
| +GrFragmentProcessor* GrArithmeticEffect::TestCreate(SkRandom* rand,
|
| GrContext*,
|
| const GrDrawTargetCaps&,
|
| GrTexture*[]) {
|
| @@ -437,11 +438,12 @@ GrEffect* GrArithmeticEffect::TestCreate(SkRandom* rand,
|
| return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, NULL));
|
| }
|
|
|
| -GR_DEFINE_EFFECT_TEST(GrArithmeticEffect);
|
| +GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticEffect);
|
|
|
| -bool SkArithmeticMode_scalar::asNewEffect(GrEffect** effect, GrTexture* background) const {
|
| - if (effect) {
|
| - *effect = GrArithmeticEffect::Create(SkScalarToFloat(fK[0]),
|
| +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]),
|
|
|