Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: src/gpu/effects/GrDisableColorXP.h

Issue 900883002: Revert of Move DstCopy on gpu into the GrXferProcessor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrCustomXfermodePriv.h ('k') | src/gpu/effects/GrDisableColorXP.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDisableColorXP_DEFINED 8 #ifndef GrDisableColorXP_DEFINED
9 #define GrDisableColorXP_DEFINED 9 #define GrDisableColorXP_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "GrXferProcessor.h" 12 #include "GrXferProcessor.h"
13 13
14 class GrProcOptInfo; 14 class GrProcOptInfo;
15 15
16 /** 16 /**
17 * This xfer processor disables color writing. Thus color and coverage and ignor ed and no blending 17 * This xfer processor disables color writing. Thus color and coverage and ignor ed and no blending
18 * occurs. This XP is usful for things like stenciling. 18 * occurs. This XP is usful for things like stenciling.
19 */ 19 */
20 class GrDisableColorXP : public GrXferProcessor { 20 class GrDisableColorXP : public GrXferProcessor {
21 public: 21 public:
22 static GrXferProcessor* Create() { 22 static GrXferProcessor* Create() {
23 return SkNEW(GrDisableColorXP); 23 return SkNEW(GrDisableColorXP);
24 } 24 }
25 25
26 ~GrDisableColorXP() SK_OVERRIDE {}; 26 ~GrDisableColorXP() SK_OVERRIDE {};
27 27
28 const char* name() const SK_OVERRIDE { return "Disable Color"; } 28 const char* name() const SK_OVERRIDE { return "Disable Color"; }
29 29
30 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
31
30 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; 32 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
31 33
32 bool hasSecondaryOutput() const SK_OVERRIDE { return false; } 34 bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
33 35
34 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, 36 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
35 const GrProcOptInfo& coveragePOI, 37 const GrProcOptInfo& coveragePOI,
36 bool doesStencilWrite, 38 bool doesStencilWrite,
37 GrColor* color, 39 GrColor* color,
38 const GrDrawTargetCaps& caps) SK_ OVERRIDE { 40 const GrDrawTargetCaps& caps) SK_ OVERRIDE {
39 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC overage_OptFlag; 41 return GrXferProcessor::kIgnoreColor_OptFlag | GrXferProcessor::kIgnoreC overage_OptFlag;
40 } 42 }
41 43
42 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE; 44 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE;
43 45
44 private: 46 private:
45 GrDisableColorXP(); 47 GrDisableColorXP();
46 48
47 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con st SK_OVERRIDE;
48
49 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { 49 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
50 return true; 50 return true;
51 } 51 }
52 52
53 typedef GrXferProcessor INHERITED; 53 typedef GrXferProcessor INHERITED;
54 }; 54 };
55 55
56 /////////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////////
57 57
58 class GrDisableColorXPFactory : public GrXPFactory { 58 class GrDisableColorXPFactory : public GrXPFactory {
59 public: 59 public:
60 static GrXPFactory* Create() { 60 static GrXPFactory* Create() {
61 return SkNEW(GrDisableColorXPFactory); 61 return SkNEW(GrDisableColorXPFactory);
62 } 62 }
63 63
64 GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI,
65 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE;
66
64 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE { 67 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE {
65 return true; 68 return true;
66 } 69 }
67 70
68 bool canApplyCoverage(const GrProcOptInfo& colorPOI, 71 bool canApplyCoverage(const GrProcOptInfo& colorPOI,
69 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { 72 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
70 return true; 73 return true;
71 } 74 }
72 75
73 bool canTweakAlphaForCoverage() const SK_OVERRIDE { return true; } 76 bool canTweakAlphaForCoverage() const SK_OVERRIDE { return true; }
74 77
75 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, 78 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
76 GrXPFactory::InvariantOutput* output) const SK_OVERR IDE { 79 GrXPFactory::InvariantOutput* output) const SK_OVERR IDE {
77 output->fBlendedColorFlags = 0; 80 output->fBlendedColorFlags = 0;
78 output->fWillBlendWithDst = 0; 81 output->fWillBlendWithDst = 0;
79 } 82 }
80 83
84 bool willReadDst() const SK_OVERRIDE { return false; }
85
81 private: 86 private:
82 GrDisableColorXPFactory(); 87 GrDisableColorXPFactory();
83 88
84 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI,
85 const GrProcOptInfo& coveragePOI,
86 const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE;
87
88 bool willReadDstColor() const SK_OVERRIDE { return false; }
89
90 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { 89 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE {
91 return true; 90 return true;
92 } 91 }
93 92
94 GR_DECLARE_XP_FACTORY_TEST; 93 GR_DECLARE_XP_FACTORY_TEST;
95 94
96 typedef GrXPFactory INHERITED; 95 typedef GrXPFactory INHERITED;
97 }; 96 };
98 97
99 #endif 98 #endif
100 99
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomXfermodePriv.h ('k') | src/gpu/effects/GrDisableColorXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698