Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef GrDisableColorXP_DEFINED | |
| 9 #define GrDisableColorXP_DEFINED | |
| 10 | |
| 11 #include "GrTypes.h" | |
| 12 #include "GrXferProcessor.h" | |
| 13 | |
| 14 class GrProcOptInfo; | |
| 15 | |
| 16 /** | |
| 17 * This xfer processor disables color writing. Thus color and coverage and ignor ed 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?
| |
| 18 * occurs. This XP is usful for things like stencilling. | |
| 19 */ | |
| 20 class GrDisableColorXP : public GrXferProcessor { | |
| 21 public: | |
| 22 static GrXferProcessor* Create() { | |
| 23 return SkNEW(GrDisableColorXP); | |
| 24 } | |
| 25 | |
| 26 ~GrDisableColorXP() SK_OVERRIDE {}; | |
| 27 | |
| 28 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.
| |
| 29 | |
| 30 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE; | |
| 31 | |
| 32 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; | |
| 33 | |
| 34 bool hasSecondaryOutput() const SK_OVERRIDE { return false; } | |
| 35 | |
| 36 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | |
| 37 const GrProcOptInfo& coveragePOI, | |
| 38 bool doesStencilWrite, | |
| 39 GrColor* color, | |
| 40 const GrDrawTargetCaps& caps) SK_ OVERRIDE { | |
| 41 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC overage_OptFlag; | |
| 42 } | |
| 43 | |
| 44 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; | |
| 45 | |
| 46 private: | |
| 47 GrDisableColorXP(); | |
| 48 | |
| 49 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { | |
| 50 return true; | |
| 51 } | |
| 52 | |
| 53 typedef GrXferProcessor INHERITED; | |
| 54 }; | |
| 55 | |
| 56 /////////////////////////////////////////////////////////////////////////////// | |
| 57 | |
| 58 class GrDisableColorXPFactory : public GrXPFactory { | |
| 59 public: | |
| 60 static GrXPFactory* Create() { | |
| 61 return SkNEW(GrDisableColorXPFactory); | |
| 62 } | |
| 63 | |
| 64 GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI, | |
| 65 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE; | |
| 66 | |
| 67 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE { | |
| 68 return true; | |
| 69 } | |
| 70 | |
| 71 bool canApplyCoverage(const GrProcOptInfo& colorPOI, | |
| 72 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | |
| 73 return true; | |
| 74 } | |
| 75 | |
| 76 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
| |
| 77 | |
| 78 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, | |
| 79 GrXPFactory::InvariantOutput* output) const SK_OVERR IDE { | |
| 80 output->fBlendedColorFlags = 0; | |
| 81 output->fWillBlendWithDst = 0; | |
| 82 } | |
| 83 | |
| 84 bool willReadDst(const GrProcOptInfo& colorPOI, | |
| 85 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | |
| 86 return false; | |
| 87 } | |
| 88 | |
| 89 private: | |
| 90 GrDisableColorXPFactory(); | |
| 91 | |
| 92 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | |
| 93 return true; | |
| 94 } | |
| 95 | |
| 96 GR_DECLARE_XP_FACTORY_TEST; | |
| 97 | |
| 98 typedef GrXPFactory INHERITED; | |
| 99 }; | |
| 100 | |
| 101 #endif | |
| 102 | |
| OLD | NEW |