Chromium Code Reviews| Index: src/gpu/effects/GrDisableColorXP.h |
| diff --git a/src/gpu/effects/GrDisableColorXP.h b/src/gpu/effects/GrDisableColorXP.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ce3f41d261931e24b2ccdf2915b9cfbdfbf4a611 |
| --- /dev/null |
| +++ b/src/gpu/effects/GrDisableColorXP.h |
| @@ -0,0 +1,102 @@ |
| +/* |
| + * 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 GrDisableColorXP_DEFINED |
| +#define GrDisableColorXP_DEFINED |
| + |
| +#include "GrTypes.h" |
| +#include "GrXferProcessor.h" |
| + |
| +class GrProcOptInfo; |
| + |
| +/** |
| + * This xfer processor disables color writing. Thus color and coverage and ignored and no blending |
|
bsalomon
2014/12/19 16:40:34
and->are? stencilling->stenciling
egdaniel
2014/12/19 19:53:45
You don't the the CORRECT british way to spell it?
|
| + * occurs. This XP is usful for things like stencilling. |
| + */ |
| +class GrDisableColorXP : public GrXferProcessor { |
| +public: |
| + static GrXferProcessor* Create() { |
| + return SkNEW(GrDisableColorXP); |
| + } |
| + |
| + ~GrDisableColorXP() SK_OVERRIDE {}; |
| + |
| + virtual const char* name() const SK_OVERRIDE { return "Disable Color"; } |
|
bsalomon
2014/12/19 16:40:34
no need for virtual
egdaniel
2014/12/19 19:53:45
Done.
|
| + |
| + void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE; |
| + |
| + GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; |
| + |
| + bool hasSecondaryOutput() const SK_OVERRIDE { return false; } |
| + |
| + GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, |
| + const GrProcOptInfo& coveragePOI, |
| + bool doesStencilWrite, |
| + GrColor* color, |
| + const GrDrawTargetCaps& caps) SK_OVERRIDE { |
| + return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreCoverage_OptFlag; |
| + } |
| + |
| + void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; |
| + |
| +private: |
| + GrDisableColorXP(); |
| + |
| + bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { |
| + return true; |
| + } |
| + |
| + typedef GrXferProcessor INHERITED; |
| +}; |
| + |
| +/////////////////////////////////////////////////////////////////////////////// |
| + |
| +class GrDisableColorXPFactory : public GrXPFactory { |
| +public: |
| + static GrXPFactory* Create() { |
| + return SkNEW(GrDisableColorXPFactory); |
| + } |
| + |
| + GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, |
| + const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; |
| + |
| + bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE { |
| + return true; |
| + } |
| + |
| + bool canApplyCoverage(const GrProcOptInfo& colorPOI, |
| + const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { |
| + return true; |
| + } |
| + |
| + bool canTweakAlphaForCoverage() const SK_OVERRIDE { return false; } |
|
bsalomon
2014/12/19 16:40:34
why not? it gets ignored anyway.
egdaniel
2014/12/19 19:53:45
Sure. I guess my thought was if they installed thi
bsalomon
2014/12/22 14:06:57
Callers might decide they need to upload color and
|
| + |
| + void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, |
| + GrXPFactory::InvariantOutput* output) const SK_OVERRIDE { |
| + output->fBlendedColorFlags = 0; |
| + output->fWillBlendWithDst = 0; |
| + } |
| + |
| + bool willReadDst(const GrProcOptInfo& colorPOI, |
| + const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { |
| + return false; |
| + } |
| + |
| +private: |
| + GrDisableColorXPFactory(); |
| + |
| + bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { |
| + return true; |
| + } |
| + |
| + GR_DECLARE_XP_FACTORY_TEST; |
| + |
| + typedef GrXPFactory INHERITED; |
| +}; |
| + |
| +#endif |
| + |