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

Unified Diff: src/gpu/effects/GrPorterDuffXferProcessor.h

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update gyp Created 6 years, 1 month 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
Index: src/gpu/effects/GrPorterDuffXferProcessor.h
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.h b/src/gpu/effects/GrPorterDuffXferProcessor.h
new file mode 100644
index 0000000000000000000000000000000000000000..53339ea907aef8baeff1e7da75b21c072fe2b641
--- /dev/null
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrPorterDuffXferProcessor_DEFINED
+#define GrPorterDuffXferProcessor_DEFINED
+
+#include "GrTypes.h"
+#include "GrXferProcessor.h"
+#include "SkXfermode.h"
+
+class GrBackendFragmentProcessorFactory;
+class GrDrawState;
+class GrGLPorterDuffXferProcessor;
+class GrInvariantOutput;
+
+class GrPorterDuffXferProcessor : public GrXferProcessor {
+public:
+ static GrXferProcessor* Create(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend) {
+ return SkNEW_ARGS(GrPorterDuffXferProcessor, (srcBlend, dstBlend));
+ }
+
+ virtual ~GrPorterDuffXferProcessor();
+
+ virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERRIDE;
+
+ typedef GrGLPorterDuffXferProcessor GLProcessor;
+ static const char* Name() { return "Porter Duff"; }
+
+ virtual bool isValidColorStage() const SK_OVERRIDE { return false; }
bsalomon 2014/11/26 21:02:45 no need for virtual keyword w/ override. where is
egdaniel 2014/12/01 18:18:25 Old code that somehow didn't get deleted in clean
+
+private:
+ GrPorterDuffXferProcessor(GrBlendCoeff srcBlend, GrBlendCoeff dstBlend);
+
+ virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE { return true; }
+
+ virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
+
+ typedef GrXferProcessor INHERITED;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+
+class GrPorterDuffXPFactory : public GrXPFactory {
+public:
+ static GrXPFactory* Create(SkXfermode::Coeff src, SkXfermode::Coeff dst) {
+ return SkNEW_ARGS(GrPorterDuffXPFactory, (src, dst));
+ }
+
+ virtual const GrXferProcessor* createXferProcessor() const SK_OVERRIDE;
+
+ virtual bool supportsLCDText(const GrDrawState&) const SK_OVERRIDE;
+
+protected:
+ GrPorterDuffXPFactory(SkXfermode::Coeff src, SkXfermode::Coeff dst)
+ : INHERITED((GrBlendCoeff)(src), (GrBlendCoeff)(dst)) {}
+
+private:
+ typedef GrXPFactory INHERITED;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698