From ecfdc251be71f3d634e76afdd6375bf55fc061aa Mon Sep 17 00:00:00 2001 From: bsalomon Date: Fri, 28 Aug 2015 14:33:46 -0700 Subject: Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor* Review URL: https://codereview.chromium.org/1316513002 --- include/gpu/effects/GrConstColorProcessor.h | 4 -- .../gpu/effects/GrExtractAlphaFragmentProcessor.h | 45 ++++++++++++++++++++++ 2 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 include/gpu/effects/GrExtractAlphaFragmentProcessor.h (limited to 'include/gpu/effects') diff --git a/include/gpu/effects/GrConstColorProcessor.h b/include/gpu/effects/GrConstColorProcessor.h index ccd28684a5..f5fdb7e35c 100644 --- a/include/gpu/effects/GrConstColorProcessor.h +++ b/include/gpu/effects/GrConstColorProcessor.h @@ -10,8 +10,6 @@ #include "GrFragmentProcessor.h" -class GrInvariantOutput; - /** * This is a simple GrFragmentProcessor that outputs a constant color. It may do one of the * following with its input color: ignore it, or multiply it by the constant color, multiply its @@ -32,8 +30,6 @@ public: return new GrConstColorProcessor(color, mode); } - ~GrConstColorProcessor() override {} - const char* name() const override { return "Color"; } GrColor color() const { return fColor; } diff --git a/include/gpu/effects/GrExtractAlphaFragmentProcessor.h b/include/gpu/effects/GrExtractAlphaFragmentProcessor.h new file mode 100644 index 0000000000..d26f00f9a9 --- /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(); + 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 -- cgit v1.2.3