| Index: include/gpu/effects/GrColorProcessor.h
|
| diff --git a/include/gpu/effects/GrColorProcessor.h b/include/gpu/effects/GrColorProcessor.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..86bb58196ca7161a919989dffa6d50e24a41436a
|
| --- /dev/null
|
| +++ b/include/gpu/effects/GrColorProcessor.h
|
| @@ -0,0 +1,64 @@
|
| +/*
|
| + * 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 GrColorProcessor_DEFINED
|
| +#define GrColorProcessor_DEFINED
|
| +
|
| +#include "GrFragmentProcessor.h"
|
| +
|
| +class GrInvariantOutput;
|
| +
|
| +/**
|
| + * This is a simple GrFragmentProcessor that simply outputs a constant color. It may do one of the
|
| + * following with its input color: ignore it, multiply it by the constant color, multiply its alpha
|
| + * by the constant color and ignore the input color's r, g, and b.
|
| + */
|
| +class GrColorProcessor : public GrFragmentProcessor {
|
| +public:
|
| + enum InputMode {
|
| + kIgnore_InputMode,
|
| + kModulateRGBA_InputMode,
|
| + kModulateA_InputMode,
|
| +
|
| + kLastInputMode = kModulateA_InputMode
|
| + };
|
| + static const int kInputModeCnt = kLastInputMode + 1;
|
| +
|
| + static GrFragmentProcessor* Create(GrColor color, InputMode mode) {
|
| + return SkNEW_ARGS(GrColorProcessor, (color, mode));
|
| + }
|
| +
|
| + ~GrColorProcessor() SK_OVERRIDE {}
|
| +
|
| + const char* name() const SK_OVERRIDE { return "Color"; }
|
| +
|
| + void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVERRIDE;
|
| +
|
| + GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE;
|
| +
|
| + GrColor color() const { return fColor; }
|
| +
|
| + InputMode inputMode() const { return fMode; }
|
| +
|
| +private:
|
| + GrColorProcessor(GrColor color, InputMode mode) : fColor(color), fMode(mode) {
|
| + this->initClassID<GrColorProcessor>();
|
| + }
|
| +
|
| + bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE;
|
| +
|
| + void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
|
| +
|
| + GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
|
| +
|
| + GrColor fColor;
|
| + InputMode fMode;
|
| +
|
| + typedef GrFragmentProcessor INHERITED;
|
| +};
|
| +
|
| +#endif
|
|
|