Move GrXferProcessor subclasses into cpp files
authoregdaniel <egdaniel@google.com>
Mon, 9 Feb 2015 15:51:00 +0000 (07:51 -0800)
committerCommit bot <commit-bot@chromium.org>
Mon, 9 Feb 2015 15:51:00 +0000 (07:51 -0800)
BUG=skia:

Review URL: https://codereview.chromium.org/860383007

include/gpu/effects/GrPorterDuffXferProcessor.h
src/effects/SkArithmeticMode_gpu.cpp
src/effects/SkArithmeticMode_gpu.h
src/gpu/effects/GrCoverageSetOpXP.cpp
src/gpu/effects/GrCoverageSetOpXP.h
src/gpu/effects/GrCustomXfermode.cpp
src/gpu/effects/GrCustomXfermodePriv.h
src/gpu/effects/GrDisableColorXP.cpp
src/gpu/effects/GrDisableColorXP.h
src/gpu/effects/GrPorterDuffXferProcessor.cpp
src/gpu/gl/GrGLXferProcessor.cpp

index e47ec1e9048b9d3cd4de3863362a69cdcfce7853..80e8ef65735ab48ff4913c719adc52f25fc35e7f 100644 (file)
 #include "GrXferProcessor.h"
 #include "SkXfermode.h"
 
-class GrDrawTargetCaps;
 class GrProcOptInfo;
 
-class GrPorterDuffXferProcessor : public GrXferProcessor {
-public:
-    static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend,
-                                   GrColor constant, const GrDeviceCoordTexture* dstCopy,
-                                   bool willReadDstColor) {
-        return SkNEW_ARGS(GrPorterDuffXferProcessor, (srcBlend, dstBlend, constant, dstCopy,
-                                                      willReadDstColor));
-    }
-
-    ~GrPorterDuffXferProcessor() SK_OVERRIDE;
-
-    const char* name() const SK_OVERRIDE { return "Porter Duff"; }
-
-    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
-
-    bool hasSecondaryOutput() const SK_OVERRIDE;
-
-    ///////////////////////////////////////////////////////////////////////////
-    /// @name Stage Output Types
-    ////
-
-    enum PrimaryOutputType {
-        kNone_PrimaryOutputType,
-        kColor_PrimaryOutputType,
-        kCoverage_PrimaryOutputType,
-        // Modulate color and coverage, write result as the color output.
-        kModulate_PrimaryOutputType,
-    };
-
-    enum SecondaryOutputType {
-        // There is no secondary output
-        kNone_SecondaryOutputType,
-        // Writes coverage as the secondary output. Only set if dual source blending is supported
-        // and primary output is kModulate.
-        kCoverage_SecondaryOutputType,
-        // Writes coverage * (1 - colorA) as the secondary output. Only set if dual source blending
-        // is supported and primary output is kModulate.
-        kCoverageISA_SecondaryOutputType,
-        // Writes coverage * (1 - colorRGBA) as the secondary output. Only set if dual source
-        // blending is supported and primary output is kModulate.
-        kCoverageISC_SecondaryOutputType,
-
-        kSecondaryOutputTypeCnt,
-    };
-
-    PrimaryOutputType primaryOutputType() const { return fPrimaryOutputType; }
-    SecondaryOutputType secondaryOutputType() const { return fSecondaryOutputType; }
-
-    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
-                                               const GrProcOptInfo& coveragePOI,
-                                               bool doesStencilWrite,
-                                               GrColor* overrideColor,
-                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
-
-    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
-        blendInfo->fSrcBlend = fSrcBlend;
-        blendInfo->fDstBlend = fDstBlend;
-        blendInfo->fBlendConstant = fBlendConstant;
-    }
-
-private:
-    GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrColor constant,
-                              const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
-
-    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
-
-    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
-        const GrPorterDuffXferProcessor& xp = xpBase.cast<GrPorterDuffXferProcessor>();
-        if (fSrcBlend != xp.fSrcBlend ||
-            fDstBlend != xp.fDstBlend ||
-            fBlendConstant != xp.fBlendConstant ||
-            fPrimaryOutputType != xp.fPrimaryOutputType || 
-            fSecondaryOutputType != xp.fSecondaryOutputType) {
-            return false;
-        }
-        return true;
-    }
-
-    GrXferProcessor::OptFlags internalGetOptimizations(const GrProcOptInfo& colorPOI,
-                                                       const GrProcOptInfo& coveragePOI,
-                                                       bool doesStencilWrite);
-
-    void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrDrawTargetCaps& caps,
-                         bool hasSolidCoverage);
-
-    GrBlendCoeff fSrcBlend;
-    GrBlendCoeff fDstBlend;
-    GrColor      fBlendConstant;
-    PrimaryOutputType fPrimaryOutputType;
-    SecondaryOutputType fSecondaryOutputType;
-
-    typedef GrXferProcessor INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
 class GrPorterDuffXPFactory : public GrXPFactory {
 public:
     static GrXPFactory* Create(SkXfermode::Mode mode); 
index 6379b8dc822fba2f3bdf1c7bac49baef068b1469..219b5652988c6c8be746a6d274933fa73aa6a6e1 100644 (file)
@@ -158,6 +158,67 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP);
 // Xfer Processor
 ///////////////////////////////////////////////////////////////////////////////
 
+class ArithmeticXP : public GrXferProcessor {
+public:
+    static GrXferProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor,
+                                   const GrDeviceCoordTexture* dstCopy,
+                                   bool willReadDstColor) {
+        return SkNEW_ARGS(ArithmeticXP, (k1, k2, k3, k4, enforcePMColor, dstCopy,
+                                         willReadDstColor));
+    }
+
+    ~ArithmeticXP() SK_OVERRIDE {};
+
+    const char* name() const SK_OVERRIDE { return "Arithmetic"; }
+
+    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
+
+    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
+
+    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
+                                               const GrProcOptInfo& coveragePOI,
+                                               bool doesStencilWrite,
+                                               GrColor* overrideColor,
+                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
+
+    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
+        blendInfo->fSrcBlend = kOne_GrBlendCoeff;
+        blendInfo->fDstBlend = kZero_GrBlendCoeff;
+        blendInfo->fBlendConstant = 0;
+    }
+
+    float k1() const { return fK1; }
+    float k2() const { return fK2; }
+    float k3() const { return fK3; }
+    float k4() const { return fK4; }
+    bool enforcePMColor() const { return fEnforcePMColor; }
+
+private:
+    ArithmeticXP(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 ArithmeticXP& xp = xpBase.cast<ArithmeticXP>();
+        if (fK1 != xp.fK1 ||
+            fK2 != xp.fK2 ||
+            fK3 != xp.fK3 ||
+            fK4 != xp.fK4 ||
+            fEnforcePMColor != xp.fEnforcePMColor) {
+            return false;
+        }
+        return true;
+    }
+
+    float                       fK1, fK2, fK3, fK4;
+    bool                        fEnforcePMColor;
+
+    typedef GrXferProcessor INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
 class GLArithmeticXP : public GrGLXferProcessor {
 public:
     GLArithmeticXP(const GrProcessor&)
@@ -168,7 +229,7 @@ public:
 
     static void GenKey(const GrProcessor& processor, const GrGLCaps& caps,
                        GrProcessorKeyBuilder* b) {
-        const GrArithmeticXP& arith = processor.cast<GrArithmeticXP>();
+        const ArithmeticXP& arith = processor.cast<ArithmeticXP>();
         uint32_t key = arith.enforcePMColor() ? 1 : 0;
         b->add32(key);
     }
@@ -194,7 +255,7 @@ private:
 
     void onSetData(const GrGLProgramDataManager& pdman,
                    const GrXferProcessor& processor) SK_OVERRIDE {
-        const GrArithmeticXP& arith = processor.cast<GrArithmeticXP>();
+        const ArithmeticXP& arith = processor.cast<ArithmeticXP>();
         pdman.set4f(fKUni, arith.k1(), arith.k2(), arith.k3(), arith.k4());
         fEnforcePMColor = arith.enforcePMColor();
     };
@@ -207,30 +268,30 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrArithmeticXP::GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor,
-                               const GrDeviceCoordTexture* dstCopy, bool willReadDstColor)
+ArithmeticXP::ArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor,
+                           const GrDeviceCoordTexture* dstCopy, bool willReadDstColor)
     : INHERITED(dstCopy, willReadDstColor)
     , fK1(k1)
     , fK2(k2)
     , fK3(k3)
     , fK4(k4)
     , fEnforcePMColor(enforcePMColor) {
-    this->initClassID<GrArithmeticXP>();
+    this->initClassID<ArithmeticXP>();
 }
 
-void GrArithmeticXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
+void ArithmeticXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
     GLArithmeticXP::GenKey(*this, caps, b);
 }
 
-GrGLXferProcessor* GrArithmeticXP::createGLInstance() const {
+GrGLXferProcessor* ArithmeticXP::createGLInstance() const {
     return SkNEW_ARGS(GLArithmeticXP, (*this));
 }
 
-GrXferProcessor::OptFlags GrArithmeticXP::getOptimizations(const GrProcOptInfo& colorPOI,
-                                                           const GrProcOptInfo& coveragePOI,
-                                                           bool doesStencilWrite,
-                                                           GrColor* overrideColor,
-                                                           const GrDrawTargetCaps& caps) {
+GrXferProcessor::OptFlags ArithmeticXP::getOptimizations(const GrProcOptInfo& colorPOI,
+                                                         const GrProcOptInfo& coveragePOI,
+                                                         bool doesStencilWrite,
+                                                         GrColor* overrideColor,
+                                                         const GrDrawTargetCaps& caps) {
    return GrXferProcessor::kNone_Opt;
 }
 
@@ -242,6 +303,15 @@ GrArithmeticXPFactory::GrArithmeticXPFactory(float k1, float k2, float k3, float
     this->initClassID<GrArithmeticXPFactory>();
 }
 
+GrXferProcessor*
+GrArithmeticXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
+                                             const GrProcOptInfo& coveragePOI,
+                                             const GrDeviceCoordTexture* dstCopy) const {
+    return ArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor, dstCopy,
+                                  this->willReadDstColor());
+}
+
+
 void GrArithmeticXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
                                                const GrProcOptInfo& coveragePOI,
                                                GrXPFactory::InvariantOutput* output) const {
index b282e224276e35a08c450088695f07520f6afc6d..ddcfb0b2f4c646bea6f08e1b464c9b6b8bc23af2 100644 (file)
@@ -71,67 +71,6 @@ private:
 // Xfer Processor
 ///////////////////////////////////////////////////////////////////////////////
 
-class GrArithmeticXP : public GrXferProcessor {
-public:
-    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"; }
-
-    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
-
-    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
-
-    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
-                                               const GrProcOptInfo& coveragePOI,
-                                               bool doesStencilWrite,
-                                               GrColor* overrideColor,
-                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
-
-    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
-        blendInfo->fSrcBlend = kOne_GrBlendCoeff;
-        blendInfo->fDstBlend = kZero_GrBlendCoeff;
-        blendInfo->fBlendConstant = 0;
-    }
-
-    float k1() const { return fK1; }
-    float k2() const { return fK2; }
-    float k3() const { return fK3; }
-    float k4() const { return fK4; }
-    bool enforcePMColor() const { return fEnforcePMColor; }
-
-private:
-    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>();
-        if (fK1 != xp.fK1 ||
-            fK2 != xp.fK2 ||
-            fK3 != xp.fK3 ||
-            fK4 != xp.fK4 ||
-            fEnforcePMColor != xp.fEnforcePMColor) {
-            return false;
-        }
-        return true;
-    }
-
-    float                       fK1, fK2, fK3, fK4;
-    bool                        fEnforcePMColor;
-
-    typedef GrXferProcessor INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
 class GrArithmeticXPFactory : public GrXPFactory {
 public:
     static GrXPFactory* Create(float k1, float k2, float k3, float k4, bool enforcePMColor) {
@@ -159,10 +98,7 @@ private:
 
     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());
-    }
+                                           const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE; 
 
     bool willReadDstColor() const SK_OVERRIDE { return true; }
 
index 7025d20395f2af1b71327506e6b64bbc50756178..f0ec1f9b00b4d7c74ce4431cb6dd551ab54c811e 100644 (file)
 #include "gl/builders/GrGLFragmentShaderBuilder.h"
 #include "gl/builders/GrGLProgramBuilder.h"
 
-class GrGLCoverageSetOpXP : public GrGLXferProcessor {
+/**
+ * This xfer processor directly blends the the src coverage with the dst using a set operator. It is
+ * useful for rendering coverage masks using CSG. It can optionally invert the src coverage before
+ * applying the set operator.
+ * */
+class CoverageSetOpXP : public GrXferProcessor {
 public:
-    GrGLCoverageSetOpXP(const GrProcessor&) {}
+    static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) {
+        return SkNEW_ARGS(CoverageSetOpXP, (regionOp, invertCoverage));
+    }
+
+    ~CoverageSetOpXP() SK_OVERRIDE;
+
+    const char* name() const SK_OVERRIDE { return "Coverage Set Op"; }
+
+    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
+
+    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
+
+    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
+                                               const GrProcOptInfo& coveragePOI,
+                                               bool doesStencilWrite,
+                                               GrColor* color,
+                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
+
+    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE;
+
+    bool invertCoverage() const { return fInvertCoverage; }
+
+private:
+    CoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage);
+
+    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
+
+    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
+        const CoverageSetOpXP& xp = xpBase.cast<CoverageSetOpXP>();
+        return (fRegionOp == xp.fRegionOp &&
+                fInvertCoverage == xp.fInvertCoverage);
+    }
+
+    SkRegion::Op fRegionOp;
+    bool         fInvertCoverage;
+
+    typedef GrXferProcessor INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class GLCoverageSetOpXP : public GrGLXferProcessor {
+public:
+    GLCoverageSetOpXP(const GrProcessor&) {}
 
-    ~GrGLCoverageSetOpXP() SK_OVERRIDE {}
+    ~GLCoverageSetOpXP() SK_OVERRIDE {}
 
     static void GenKey(const GrProcessor& processor, const GrGLCaps& caps,
                        GrProcessorKeyBuilder* b) {
-        const GrCoverageSetOpXP& xp = processor.cast<GrCoverageSetOpXP>();
+        const CoverageSetOpXP& xp = processor.cast<CoverageSetOpXP>();
         uint32_t key = xp.invertCoverage() ?  0x0 : 0x1;
         b->add32(key);
     };
 
 private:
     void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
-        const GrCoverageSetOpXP& xp = args.fXP.cast<GrCoverageSetOpXP>();
+        const CoverageSetOpXP& xp = args.fXP.cast<CoverageSetOpXP>();
         GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
 
         if (xp.invertCoverage()) {
@@ -47,34 +95,34 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrCoverageSetOpXP::GrCoverageSetOpXP(SkRegion::Op regionOp, bool invertCoverage)
+CoverageSetOpXP::CoverageSetOpXP(SkRegion::Op regionOp, bool invertCoverage)
     : fRegionOp(regionOp)
     , fInvertCoverage(invertCoverage) {
-    this->initClassID<GrCoverageSetOpXP>();
+    this->initClassID<CoverageSetOpXP>();
 }
 
-GrCoverageSetOpXP::~GrCoverageSetOpXP() {
+CoverageSetOpXP::~CoverageSetOpXP() {
 }
 
-void GrCoverageSetOpXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
-    GrGLCoverageSetOpXP::GenKey(*this, caps, b);
+void CoverageSetOpXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
+    GLCoverageSetOpXP::GenKey(*this, caps, b);
 }
 
-GrGLXferProcessor* GrCoverageSetOpXP::createGLInstance() const {
-    return SkNEW_ARGS(GrGLCoverageSetOpXP, (*this));
+GrGLXferProcessor* CoverageSetOpXP::createGLInstance() const {
+    return SkNEW_ARGS(GLCoverageSetOpXP, (*this));
 }
 
 GrXferProcessor::OptFlags
-GrCoverageSetOpXP::getOptimizations(const GrProcOptInfo& colorPOI,
-                                    const GrProcOptInfo& coveragePOI,
-                                    bool doesStencilWrite,
-                                    GrColor* color,
-                                    const GrDrawTargetCaps& caps) {
+CoverageSetOpXP::getOptimizations(const GrProcOptInfo& colorPOI,
+                                  const GrProcOptInfo& coveragePOI,
+                                  bool doesStencilWrite,
+                                  GrColor* color,
+                                  const GrDrawTargetCaps& caps) {
     // We never look at the color input
     return GrXferProcessor::kIgnoreColor_OptFlag; 
 }
 
-void GrCoverageSetOpXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
+void CoverageSetOpXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
     switch (fRegionOp) {
         case SkRegion::kReplace_Op:
             blendInfo->fSrcBlend = kOne_GrBlendCoeff;
@@ -183,7 +231,7 @@ GrXferProcessor*
 GrCoverageSetOpXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
                                                 const GrProcOptInfo& covPOI,
                                                 const GrDeviceCoordTexture* dstCopy) const {
-    return GrCoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
+    return CoverageSetOpXP::Create(fRegionOp, fInvertCoverage);
 }
 
 void GrCoverageSetOpXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
index 0bc9e9117028bc3d7bcba4e07c38beea24b8a73b..730d549b74f67cfedf574c15e6641bd49adb0623 100644 (file)
 
 class GrProcOptInfo;
 
-/**
- * This xfer processor directly blends the the src coverage with the dst using a set operator. It is
- * useful for rendering coverage masks using CSG. It can optionally invert the src coverage before
- * applying the set operator.
- * */
-class GrCoverageSetOpXP : public GrXferProcessor {
-public:
-    static GrXferProcessor* Create(SkRegion::Op regionOp, bool invertCoverage) {
-        return SkNEW_ARGS(GrCoverageSetOpXP, (regionOp, invertCoverage));
-    }
-
-    ~GrCoverageSetOpXP() SK_OVERRIDE;
-
-    const char* name() const SK_OVERRIDE { return "Coverage Set Op"; }
-
-    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
-
-    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
-
-    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
-                                               const GrProcOptInfo& coveragePOI,
-                                               bool doesStencilWrite,
-                                               GrColor* color,
-                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
-
-    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE;
-
-    bool invertCoverage() const { return fInvertCoverage; }
-
-private:
-    GrCoverageSetOpXP(SkRegion::Op regionOp, bool fInvertCoverage);
-
-    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
-
-    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
-        const GrCoverageSetOpXP& xp = xpBase.cast<GrCoverageSetOpXP>();
-        return (fRegionOp == xp.fRegionOp &&
-                fInvertCoverage == xp.fInvertCoverage);
-    }
-
-    SkRegion::Op fRegionOp;
-    bool         fInvertCoverage;
-
-    typedef GrXferProcessor INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
 class GrCoverageSetOpXPFactory : public GrXPFactory {
 public:
     static GrXPFactory* Create(SkRegion::Op regionOp, bool invertCoverage = false);
index b77bf2fad174771a22f24ae2c00db09a50fed260..c7b82be3a6ade13c92021182a40a7d5785f98ef4 100644 (file)
@@ -484,6 +484,53 @@ GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand,
 // Xfer Processor
 ///////////////////////////////////////////////////////////////////////////////
 
+class CustomXP : public GrXferProcessor {
+public:
+    static GrXferProcessor* Create(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy,
+                                   bool willReadDstColor) {
+        if (!GrCustomXfermode::IsSupportedMode(mode)) {
+            return NULL;
+        } else {
+            return SkNEW_ARGS(CustomXP, (mode, dstCopy, willReadDstColor));
+        }
+    }
+
+    ~CustomXP() SK_OVERRIDE {};
+
+    const char* name() const SK_OVERRIDE { return "Custom Xfermode"; }
+
+    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
+
+    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
+
+    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
+                                               const GrProcOptInfo& coveragePOI,
+                                               bool doesStencilWrite,
+                                               GrColor* overrideColor,
+                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
+
+    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
+        blendInfo->fSrcBlend = kOne_GrBlendCoeff;
+        blendInfo->fDstBlend = kZero_GrBlendCoeff;
+        blendInfo->fBlendConstant = 0;
+    }
+
+    SkXfermode::Mode mode() const { return fMode; }
+
+private:
+    CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
+
+    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
+
+    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE;
+
+    SkXfermode::Mode fMode;
+
+    typedef GrXferProcessor INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
 GrXPFactory* GrCustomXfermode::CreateXPFactory(SkXfermode::Mode mode) {
     if (!GrCustomXfermode::IsSupportedMode(mode)) {
         return NULL;
@@ -502,13 +549,13 @@ public:
     static void GenKey(const GrXferProcessor& proc, const GrGLCaps&, GrProcessorKeyBuilder* b) {
         uint32_t key = proc.numTextures();
         SkASSERT(key <= 1);
-        key |= proc.cast<GrCustomXP>().mode() << 1;
+        key |= proc.cast<CustomXP>().mode() << 1;
         b->add32(key);
     }
 
 private:
     void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
-        SkXfermode::Mode mode = args.fXP.cast<GrCustomXP>().mode();
+        SkXfermode::Mode mode = args.fXP.cast<CustomXP>().mode();
         GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
         const char* dstColor = fsBuilder->dstColor();
 
@@ -526,26 +573,26 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrCustomXP::GrCustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy,
-                       bool willReadDstColor)
+CustomXP::CustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy,
+                   bool willReadDstColor)
     : INHERITED(dstCopy, willReadDstColor), fMode(mode) {
-    this->initClassID<GrCustomXP>();
+    this->initClassID<CustomXP>();
 }
 
-void GrCustomXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
+void CustomXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
     GLCustomXP::GenKey(*this, caps, b);
 }
 
-GrGLXferProcessor* GrCustomXP::createGLInstance() const {
+GrGLXferProcessor* CustomXP::createGLInstance() const {
     return SkNEW_ARGS(GLCustomXP, (*this));
 }
 
-bool GrCustomXP::onIsEqual(const GrXferProcessor& other) const {
-    const GrCustomXP& s = other.cast<GrCustomXP>();
+bool CustomXP::onIsEqual(const GrXferProcessor& other) const {
+    const CustomXP& s = other.cast<CustomXP>();
     return fMode == s.fMode;
 }
 
-GrXferProcessor::OptFlags GrCustomXP::getOptimizations(const GrProcOptInfo& colorPOI,
+GrXferProcessor::OptFlags CustomXP::getOptimizations(const GrProcOptInfo& colorPOI,
                                                        const GrProcOptInfo& coveragePOI,
                                                        bool doesStencilWrite,
                                                        GrColor* overrideColor,
@@ -560,6 +607,14 @@ GrCustomXPFactory::GrCustomXPFactory(SkXfermode::Mode mode)
     this->initClassID<GrCustomXPFactory>();
 }
 
+GrXferProcessor*
+GrCustomXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
+                                         const GrProcOptInfo& coveragePOI,
+                                         const GrDeviceCoordTexture* dstCopy) const {
+    return CustomXP::Create(fMode, dstCopy, this->willReadDstColor());
+}
+
+
 void GrCustomXPFactory::getInvariantOutput(const GrProcOptInfo& colorPOI,
                                                const GrProcOptInfo& coveragePOI,
                                                GrXPFactory::InvariantOutput* output) const {
index 681c805ba7034c9eea960f5bee88c596cd98a32e..2a2f69f69eff099083331abd0e64dbec66e9a952 100644 (file)
@@ -56,53 +56,6 @@ private:
 // Xfer Processor
 ///////////////////////////////////////////////////////////////////////////////
 
-class GrCustomXP : public GrXferProcessor {
-public:
-    static GrXferProcessor* Create(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy,
-                                   bool willReadDstColor) {
-        if (!GrCustomXfermode::IsSupportedMode(mode)) {
-            return NULL;
-        } else {
-            return SkNEW_ARGS(GrCustomXP, (mode, dstCopy, willReadDstColor));
-        }
-    }
-
-    ~GrCustomXP() SK_OVERRIDE {};
-
-    const char* name() const SK_OVERRIDE { return "Custom Xfermode"; }
-
-    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
-
-    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
-
-    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
-                                               const GrProcOptInfo& coveragePOI,
-                                               bool doesStencilWrite,
-                                               GrColor* overrideColor,
-                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
-
-    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
-        blendInfo->fSrcBlend = kOne_GrBlendCoeff;
-        blendInfo->fDstBlend = kZero_GrBlendCoeff;
-        blendInfo->fBlendConstant = 0;
-    }
-
-    SkXfermode::Mode mode() const { return fMode; }
-
-private:
-    GrCustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
-
-    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
-
-    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE;
-
-    SkXfermode::Mode fMode;
-
-    typedef GrXferProcessor INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
 class GrCustomXPFactory : public GrXPFactory {
 public:
     GrCustomXPFactory(SkXfermode::Mode mode); 
@@ -126,9 +79,7 @@ public:
 private:
     GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI,
                                            const GrProcOptInfo& coveragePOI,
-                                           const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE {
-        return GrCustomXP::Create(fMode, dstCopy, this->willReadDstColor());
-    }
+                                           const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE; 
 
     bool willReadDstColor() const SK_OVERRIDE { return true; }
 
index 83b6d231194b513c38e639ae43f1fd402550f1d1..637f99baf111fc0fb7f87efaaa4a7a866580d470 100644 (file)
 #include "gl/builders/GrGLFragmentShaderBuilder.h"
 #include "gl/builders/GrGLProgramBuilder.h"
 
-class GrGLDisableColorXP : public GrGLXferProcessor {
+/**
+ * This xfer processor disables color writing. Thus color and coverage and ignored and no blending
+ * occurs. This XP is usful for things like stenciling.
+ */
+class DisableColorXP : public GrXferProcessor {
+public:
+    static GrXferProcessor* Create() {
+        return SkNEW(DisableColorXP);
+    }
+
+    ~DisableColorXP() SK_OVERRIDE {};
+
+    const char* name() const SK_OVERRIDE { return "Disable Color"; }
+
+    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
+
+    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
+
+    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
+                                               const GrProcOptInfo& coveragePOI,
+                                               bool doesStencilWrite,
+                                               GrColor* color,
+                                               const GrDrawTargetCaps& caps) SK_OVERRIDE {
+        return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreCoverage_OptFlag;
+    }
+
+    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE;
+
+private:
+    DisableColorXP();
+
+    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
+
+    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
+        return true;
+    }
+
+    typedef GrXferProcessor INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class GLDisableColorXP : public GrGLXferProcessor {
 public:
-    GrGLDisableColorXP(const GrProcessor&) {}
+    GLDisableColorXP(const GrProcessor&) {}
 
-    ~GrGLDisableColorXP() SK_OVERRIDE {}
+    ~GLDisableColorXP() SK_OVERRIDE {}
 
     static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*) {}
 
@@ -35,19 +77,19 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrDisableColorXP::GrDisableColorXP() {
-    this->initClassID<GrDisableColorXP>();
+DisableColorXP::DisableColorXP() {
+    this->initClassID<DisableColorXP>();
 }
 
-void GrDisableColorXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
-    GrGLDisableColorXP::GenKey(*this, caps, b);
+void DisableColorXP::onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const {
+    GLDisableColorXP::GenKey(*this, caps, b);
 }
 
-GrGLXferProcessor* GrDisableColorXP::createGLInstance() const {
-    return SkNEW_ARGS(GrGLDisableColorXP, (*this));
+GrGLXferProcessor* DisableColorXP::createGLInstance() const {
+    return SkNEW_ARGS(GLDisableColorXP, (*this));
 }
 
-void GrDisableColorXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
+void DisableColorXP::getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const {
     blendInfo->fWriteColor = false;
 }
 
@@ -61,7 +103,7 @@ GrXferProcessor*
 GrDisableColorXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
                                                const GrProcOptInfo& covPOI,
                                                const GrDeviceCoordTexture* dstCopy) const {
-    return GrDisableColorXP::Create();
+    return DisableColorXP::Create();
 }
 
 GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory);
index da6fa4523b9f24b778c9997ef7f5d9a0806094a2..fef0f1ee3b2a8a272e76e823dd484ed6285c6579 100644 (file)
 
 class GrProcOptInfo;
 
-/**
- * This xfer processor disables color writing. Thus color and coverage and ignored and no blending
- * occurs. This XP is usful for things like stenciling.
- */
-class GrDisableColorXP : public GrXferProcessor {
-public:
-    static GrXferProcessor* Create() {
-        return SkNEW(GrDisableColorXP);
-    }
-
-    ~GrDisableColorXP() SK_OVERRIDE {};
-
-    const char* name() const SK_OVERRIDE { return "Disable Color"; }
-
-    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
-
-    bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
-
-    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
-                                               const GrProcOptInfo& coveragePOI,
-                                               bool doesStencilWrite,
-                                               GrColor* color,
-                                               const GrDrawTargetCaps& caps) SK_OVERRIDE {
-        return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreCoverage_OptFlag;
-    }
-
-    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE;
-
-private:
-    GrDisableColorXP();
-
-    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
-
-    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
-        return true;
-    }
-
-    typedef GrXferProcessor INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
 class GrDisableColorXPFactory : public GrXPFactory {
 public:
     static GrXPFactory* Create() {
index 320d943392898fcb4f1a6d4490841fe44567282c..09ccf4eecc732c1530ac58e6832661c01da9792d 100644 (file)
@@ -32,34 +32,130 @@ static bool can_tweak_alpha_for_coverage(GrBlendCoeff dstCoeff) {
            kISC_GrBlendCoeff == dstCoeff;
 }
 
-class GrGLPorterDuffXferProcessor : public GrGLXferProcessor {
+class PorterDuffXferProcessor : public GrXferProcessor {
 public:
-    GrGLPorterDuffXferProcessor(const GrProcessor&) {}
+    static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend,
+                                   GrColor constant, const GrDeviceCoordTexture* dstCopy,
+                                   bool willReadDstColor) {
+        return SkNEW_ARGS(PorterDuffXferProcessor, (srcBlend, dstBlend, constant, dstCopy,
+                                                    willReadDstColor));
+    }
+
+    ~PorterDuffXferProcessor() SK_OVERRIDE;
+
+    const char* name() const SK_OVERRIDE { return "Porter Duff"; }
+
+    GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
+
+    bool hasSecondaryOutput() const SK_OVERRIDE;
+
+    ///////////////////////////////////////////////////////////////////////////
+    /// @name Stage Output Types
+    ////
+
+    enum PrimaryOutputType {
+        kNone_PrimaryOutputType,
+        kColor_PrimaryOutputType,
+        kCoverage_PrimaryOutputType,
+        // Modulate color and coverage, write result as the color output.
+        kModulate_PrimaryOutputType,
+    };
+
+    enum SecondaryOutputType {
+        // There is no secondary output
+        kNone_SecondaryOutputType,
+        // Writes coverage as the secondary output. Only set if dual source blending is supported
+        // and primary output is kModulate.
+        kCoverage_SecondaryOutputType,
+        // Writes coverage * (1 - colorA) as the secondary output. Only set if dual source blending
+        // is supported and primary output is kModulate.
+        kCoverageISA_SecondaryOutputType,
+        // Writes coverage * (1 - colorRGBA) as the secondary output. Only set if dual source
+        // blending is supported and primary output is kModulate.
+        kCoverageISC_SecondaryOutputType,
+
+        kSecondaryOutputTypeCnt,
+    };
+
+    PrimaryOutputType primaryOutputType() const { return fPrimaryOutputType; }
+    SecondaryOutputType secondaryOutputType() const { return fSecondaryOutputType; }
+
+    GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
+                                               const GrProcOptInfo& coveragePOI,
+                                               bool doesStencilWrite,
+                                               GrColor* overrideColor,
+                                               const GrDrawTargetCaps& caps) SK_OVERRIDE;
+
+    void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
+        blendInfo->fSrcBlend = fSrcBlend;
+        blendInfo->fDstBlend = fDstBlend;
+        blendInfo->fBlendConstant = fBlendConstant;
+    }
+
+private:
+    PorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend, GrColor constant,
+                            const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
+
+    void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
+
+    bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
+        const PorterDuffXferProcessor& xp = xpBase.cast<PorterDuffXferProcessor>();
+        if (fSrcBlend != xp.fSrcBlend ||
+            fDstBlend != xp.fDstBlend ||
+            fBlendConstant != xp.fBlendConstant ||
+            fPrimaryOutputType != xp.fPrimaryOutputType || 
+            fSecondaryOutputType != xp.fSecondaryOutputType) {
+            return false;
+        }
+        return true;
+    }
+
+    GrXferProcessor::OptFlags internalGetOptimizations(const GrProcOptInfo& colorPOI,
+                                                       const GrProcOptInfo& coveragePOI,
+                                                       bool doesStencilWrite);
+
+    void calcOutputTypes(GrXferProcessor::OptFlags blendOpts, const GrDrawTargetCaps& caps,
+                         bool hasSolidCoverage);
+
+    GrBlendCoeff fSrcBlend;
+    GrBlendCoeff fDstBlend;
+    GrColor      fBlendConstant;
+    PrimaryOutputType fPrimaryOutputType;
+    SecondaryOutputType fSecondaryOutputType;
+
+    typedef GrXferProcessor INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class GLPorterDuffXferProcessor : public GrGLXferProcessor {
+public:
+    GLPorterDuffXferProcessor(const GrProcessor&) {}
 
-    virtual ~GrGLPorterDuffXferProcessor() {}
+    virtual ~GLPorterDuffXferProcessor() {}
 
     static void GenKey(const GrProcessor& processor, const GrGLCaps& caps,
                        GrProcessorKeyBuilder* b) {
-        const GrPorterDuffXferProcessor& xp = processor.cast<GrPorterDuffXferProcessor>();
+        const PorterDuffXferProcessor& xp = processor.cast<PorterDuffXferProcessor>();
         b->add32(xp.primaryOutputType());
         b->add32(xp.secondaryOutputType());
     };
 
 private:
     void onEmitCode(const EmitArgs& args) SK_OVERRIDE {
-        const GrPorterDuffXferProcessor& xp = args.fXP.cast<GrPorterDuffXferProcessor>();
+        const PorterDuffXferProcessor& xp = args.fXP.cast<PorterDuffXferProcessor>();
         GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
         if (xp.hasSecondaryOutput()) {
             switch(xp.secondaryOutputType()) {
-                case GrPorterDuffXferProcessor::kCoverage_SecondaryOutputType:
+                case PorterDuffXferProcessor::kCoverage_SecondaryOutputType:
                     fsBuilder->codeAppendf("%s = %s;", args.fOutputSecondary, args.fInputCoverage);
                     break;
-                case GrPorterDuffXferProcessor::kCoverageISA_SecondaryOutputType:
+                case PorterDuffXferProcessor::kCoverageISA_SecondaryOutputType:
                     fsBuilder->codeAppendf("%s = (1.0 - %s.a) * %s;",
                                            args.fOutputSecondary, args.fInputColor,
                                            args.fInputCoverage);
                     break;
-                case GrPorterDuffXferProcessor::kCoverageISC_SecondaryOutputType:
+                case PorterDuffXferProcessor::kCoverageISC_SecondaryOutputType:
                     fsBuilder->codeAppendf("%s = (vec4(1.0) - %s) * %s;",
                                            args.fOutputSecondary, args.fInputColor,
                                            args.fInputCoverage);
@@ -70,16 +166,16 @@ private:
         }
         
         switch (xp.primaryOutputType()) {
-            case GrPorterDuffXferProcessor::kNone_PrimaryOutputType:
+            case PorterDuffXferProcessor::kNone_PrimaryOutputType:
                 fsBuilder->codeAppendf("%s = vec4(0);", args.fOutputPrimary);
                 break;
-            case GrPorterDuffXferProcessor::kColor_PrimaryOutputType:
+            case PorterDuffXferProcessor::kColor_PrimaryOutputType:
                 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputColor);
                 break;
-            case GrPorterDuffXferProcessor::kCoverage_PrimaryOutputType:
+            case PorterDuffXferProcessor::kCoverage_PrimaryOutputType:
                 fsBuilder->codeAppendf("%s = %s;", args.fOutputPrimary, args.fInputCoverage);
                 break;
-            case GrPorterDuffXferProcessor::kModulate_PrimaryOutputType:
+            case PorterDuffXferProcessor::kModulate_PrimaryOutputType:
                 fsBuilder->codeAppendf("%s = %s * %s;", args.fOutputPrimary, args.fInputColor,
                                        args.fInputCoverage);
                 break;
@@ -95,37 +191,37 @@ private:
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrPorterDuffXferProcessor::GrPorterDuffXferProcessor(GrBlendCoeff srcBlend,
-                                                     GrBlendCoeff dstBlend,
-                                                     GrColor constant,
-                                                     const GrDeviceCoordTexture* dstCopy,
-                                                     bool willReadDstColor)
+PorterDuffXferProcessor::PorterDuffXferProcessor(GrBlendCoeff srcBlend,
+                                                 GrBlendCoeff dstBlend,
+                                                 GrColor constant,
+                                                 const GrDeviceCoordTexture* dstCopy,
+                                                 bool willReadDstColor)
     : fSrcBlend(srcBlend)
     , fDstBlend(dstBlend)
     , fBlendConstant(constant)
     , fPrimaryOutputType(kModulate_PrimaryOutputType) 
     , fSecondaryOutputType(kNone_SecondaryOutputType) {
-    this->initClassID<GrPorterDuffXferProcessor>();
+    this->initClassID<PorterDuffXferProcessor>();
 }
 
-GrPorterDuffXferProcessor::~GrPorterDuffXferProcessor() {
+PorterDuffXferProcessor::~PorterDuffXferProcessor() {
 }
 
-void GrPorterDuffXferProcessor::onGetGLProcessorKey(const GrGLCaps& caps,
-                                                    GrProcessorKeyBuilder* b) const {
-    GrGLPorterDuffXferProcessor::GenKey(*this, caps, b);
+void PorterDuffXferProcessor::onGetGLProcessorKey(const GrGLCaps& caps,
+                                                  GrProcessorKeyBuilder* b) const {
+    GLPorterDuffXferProcessor::GenKey(*this, caps, b);
 }
 
-GrGLXferProcessor* GrPorterDuffXferProcessor::createGLInstance() const {
-    return SkNEW_ARGS(GrGLPorterDuffXferProcessor, (*this));
+GrGLXferProcessor* PorterDuffXferProcessor::createGLInstance() const {
+    return SkNEW_ARGS(GLPorterDuffXferProcessor, (*this));
 }
 
 GrXferProcessor::OptFlags
-GrPorterDuffXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
-                                            const GrProcOptInfo& coveragePOI,
-                                            bool doesStencilWrite,
-                                            GrColor* overrideColor,
-                                            const GrDrawTargetCaps& caps) {
+PorterDuffXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
+                                          const GrProcOptInfo& coveragePOI,
+                                          bool doesStencilWrite,
+                                          GrColor* overrideColor,
+                                          const GrDrawTargetCaps& caps) {
     GrXferProcessor::OptFlags optFlags;
     // Optimizations when doing RGB Coverage
     if (coveragePOI.isFourChannelOutput()) {
@@ -145,9 +241,9 @@ GrPorterDuffXferProcessor::getOptimizations(const GrProcOptInfo& colorPOI,
     return optFlags;
 }
 
-void GrPorterDuffXferProcessor::calcOutputTypes(GrXferProcessor::OptFlags optFlags,
-                                                const GrDrawTargetCaps& caps,
-                                                bool hasSolidCoverage) {
+void PorterDuffXferProcessor::calcOutputTypes(GrXferProcessor::OptFlags optFlags,
+                                              const GrDrawTargetCaps& caps,
+                                              bool hasSolidCoverage) {
     if (optFlags & kIgnoreColor_OptFlag) {
         if (optFlags & kIgnoreCoverage_OptFlag) {
             fPrimaryOutputType = kNone_PrimaryOutputType;
@@ -185,9 +281,9 @@ void GrPorterDuffXferProcessor::calcOutputTypes(GrXferProcessor::OptFlags optFla
 }
 
 GrXferProcessor::OptFlags
-GrPorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
-                                                    const GrProcOptInfo& coveragePOI,
-                                                    bool doesStencilWrite) {
+PorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPOI,
+                                                  const GrProcOptInfo& coveragePOI,
+                                                  bool doesStencilWrite) {
     bool srcAIsOne;
     bool hasCoverage;
 
@@ -263,7 +359,7 @@ GrPorterDuffXferProcessor::internalGetOptimizations(const GrProcOptInfo& colorPO
     return GrXferProcessor::kNone_Opt;
 }
 
-bool GrPorterDuffXferProcessor::hasSecondaryOutput() const {
+bool PorterDuffXferProcessor::hasSecondaryOutput() const {
     return kNone_SecondaryOutputType != fSecondaryOutputType;
 }
 
@@ -361,15 +457,15 @@ GrPorterDuffXPFactory::onCreateXferProcessor(const GrProcOptInfo& colorPOI,
                                              const GrProcOptInfo& covPOI,
                                              const GrDeviceCoordTexture* dstCopy) const {
     if (!covPOI.isFourChannelOutput()) {
-        return GrPorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff, 0, dstCopy,
-                                                 this->willReadDstColor());
+        return PorterDuffXferProcessor::Create(fSrcCoeff, fDstCoeff, 0, dstCopy,
+                                               this->willReadDstColor());
     } else {
         if (this->supportsRGBCoverage(colorPOI.color(), colorPOI.validFlags())) {
             SkASSERT(kRGBA_GrColorComponentFlags == colorPOI.validFlags());
             GrColor blendConstant = GrUnPreMulColor(colorPOI.color());
-            return GrPorterDuffXferProcessor::Create(kConstC_GrBlendCoeff, kISC_GrBlendCoeff,
-                                                     blendConstant, dstCopy,
-                                                     this->willReadDstColor());
+            return PorterDuffXferProcessor::Create(kConstC_GrBlendCoeff, kISC_GrBlendCoeff,
+                                                   blendConstant, dstCopy,
+                                                   this->willReadDstColor());
         } else {
             return NULL;
         }
index 20ec60d5ec1318a463c3205e3b78ff192ba7dde3..4aac11d3354c53533e0ec128f1be55488078dd1b 100644 (file)
@@ -13,7 +13,6 @@
 
 void GrGLXferProcessor::emitCode(const EmitArgs& args) {
     if (args.fXP.getDstCopyTexture()) {
-
         bool topDown = kTopLeft_GrSurfaceOrigin == args.fXP.getDstCopyTexture()->origin();
 
         GrGLFPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();