Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Unified Diff: src/gpu/effects/GrDisableColorXP.cpp

Issue 860383007: Move GrXferProcessor subclasses into cpp files (Closed) Base URL: https://skia.googlesource.com/skia.git@playDstCpy
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.h ('k') | src/gpu/effects/GrPorterDuffXferProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.h ('k') | src/gpu/effects/GrPorterDuffXferProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698