diff options
author | 2015-08-28 14:33:46 -0700 | |
---|---|---|
committer | 2015-08-28 14:33:47 -0700 | |
commit | ecfdc251be71f3d634e76afdd6375bf55fc061aa (patch) | |
tree | f76f15151f9687ec5f5a74ca9cd15830cf4b68fb /include/gpu/effects | |
parent | 264873d5a8b5b7777684e999aead1da75822e079 (diff) |
Change SkShader;asFragmentProcessor signature to no longer take skpaint\grcolor*
Review URL: https://codereview.chromium.org/1316513002
Diffstat (limited to 'include/gpu/effects')
-rw-r--r-- | include/gpu/effects/GrConstColorProcessor.h | 4 | ||||
-rw-r--r-- | include/gpu/effects/GrExtractAlphaFragmentProcessor.h | 45 |
2 files changed, 45 insertions, 4 deletions
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<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 |