Index: src/gpu/effects/GrDisableColorXP.cpp |
diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp |
index 83b6d231194b513c38e639ae43f1fd402550f1d1..637f99baf111fc0fb7f87efaaa4a7a866580d470 100644 |
--- a/src/gpu/effects/GrDisableColorXP.cpp |
+++ b/src/gpu/effects/GrDisableColorXP.cpp |
@@ -11,11 +11,53 @@ |
#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); |