Index: include/gpu/effects/GrExtractAlphaFragmentProcessor.h |
diff --git a/include/gpu/effects/GrExtractAlphaFragmentProcessor.h b/include/gpu/effects/GrExtractAlphaFragmentProcessor.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d26f00f9a9cdb89ef60a499a256cd963494991c8 |
--- /dev/null |
+++ b/include/gpu/effects/GrExtractAlphaFragmentProcessor.h |
@@ -0,0 +1,45 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef GrExtractAlphaFragmentProcessor_DEFINED |
+#define GrExtractAlphaFragmentProcessor_DEFINED |
+ |
+#include "GrFragmentProcessor.h" |
+ |
+/** This processor extracts the incoming color's alpha, ignores r, g, and b, and feeds |
+ the replicated alpha to it's inner processor. */ |
+class GrExtractAlphaFragmentProcessor : public GrFragmentProcessor { |
+public: |
+ static GrFragmentProcessor* Create(const GrFragmentProcessor* processor) { |
+ if (!processor) { |
+ return nullptr; |
+ } |
+ return SkNEW_ARGS(GrExtractAlphaFragmentProcessor, (processor)); |
+ } |
+ |
+ ~GrExtractAlphaFragmentProcessor() override {} |
+ |
+ const char* name() const override { return "Extract Alpha"; } |
+ |
+private: |
+ GrExtractAlphaFragmentProcessor(const GrFragmentProcessor* processor) { |
+ this->initClassID<GrExtractAlphaFragmentProcessor>(); |
+ this->registerChildProcessor(processor); |
+ } |
+ |
+ GrGLFragmentProcessor* onCreateGLInstance() const override; |
+ |
+ void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const override; |
+ |
+ bool onIsEqual(const GrFragmentProcessor&) const override; |
+ |
+ void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
+ |
+ typedef GrFragmentProcessor INHERITED; |
+}; |
+ |
+#endif |