Chromium Code Reviews| Index: src/effects/SkArithmeticMode_gpu.h |
| diff --git a/src/effects/SkArithmeticMode_gpu.h b/src/effects/SkArithmeticMode_gpu.h |
| index 2998eabc3b48ecdd11411941a150331845f04793..b282e224276e35a08c450088695f07520f6afc6d 100644 |
| --- a/src/effects/SkArithmeticMode_gpu.h |
| +++ b/src/effects/SkArithmeticMode_gpu.h |
| @@ -13,6 +13,7 @@ |
| #if SK_SUPPORT_GPU |
| #include "GrCoordTransform.h" |
| +#include "GrDrawTargetCaps.h" |
| #include "GrFragmentProcessor.h" |
| #include "GrTextureAccess.h" |
| #include "GrTypes.h" |
| @@ -72,16 +73,17 @@ private: |
| class GrArithmeticXP : public GrXferProcessor { |
|
bsalomon
2015/02/03 17:28:24
Curious, can the XP be moved to a cpp, seems like
egdaniel
2015/02/03 19:50:57
Yeah you are right and this is the case with all t
|
| public: |
| - static GrXferProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor) { |
| - return SkNEW_ARGS(GrArithmeticXP, (k1, k2, k3, k4, enforcePMColor)); |
| + static GrXferProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor, |
| + const GrDeviceCoordTexture* dstCopy, |
| + bool willReadDstColor) { |
| + return SkNEW_ARGS(GrArithmeticXP, (k1, k2, k3, k4, enforcePMColor, dstCopy, |
| + willReadDstColor)); |
| } |
| ~GrArithmeticXP() SK_OVERRIDE {}; |
| const char* name() const SK_OVERRIDE { return "Arithmetic"; } |
| - void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| - |
| GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; |
| bool hasSecondaryOutput() const SK_OVERRIDE { return false; } |
| @@ -105,7 +107,10 @@ public: |
| bool enforcePMColor() const { return fEnforcePMColor; } |
| private: |
| - GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor); |
| + GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor, |
| + const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); |
| + |
| + void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { |
| const GrArithmeticXP& xp = xpBase.cast<GrArithmeticXP>(); |
| @@ -133,11 +138,6 @@ public: |
| return SkNEW_ARGS(GrArithmeticXPFactory, (k1, k2, k3, k4, enforcePMColor)); |
| } |
| - GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, |
| - const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { |
| - return GrArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor); |
| - } |
| - |
| bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE { |
| return true; |
| } |
| @@ -154,11 +154,18 @@ public: |
| void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, |
| GrXPFactory::InvariantOutput*) const SK_OVERRIDE; |
| - bool willReadDst() const SK_OVERRIDE { return true; } |
| - |
| private: |
| GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePMColor); |
| + GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI, |
| + const GrProcOptInfo& coveragePOI, |
| + const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE { |
| + return GrArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor, dstCopy, |
| + this->willReadDstColor()); |
| + } |
| + |
| + bool willReadDstColor() const SK_OVERRIDE { return true; } |
| + |
| bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { |
| const GrArithmeticXPFactory& xpf = xpfBase.cast<GrArithmeticXPFactory>(); |
| if (fK1 != xpf.fK1 || |