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

Side by Side Diff: src/effects/SkArithmeticMode_gpu.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 | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/effects/SkArithmeticMode_gpu.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 2015 Google Inc. 2 * Copyright 2015 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 SkArithmeticMode_gpu_DEFINED 8 #ifndef SkArithmeticMode_gpu_DEFINED
9 #define SkArithmeticMode_gpu_DEFINED 9 #define SkArithmeticMode_gpu_DEFINED
10 10
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 12
13 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 14
15 #include "GrCoordTransform.h" 15 #include "GrCoordTransform.h"
16 #include "GrDrawTargetCaps.h"
17 #include "GrFragmentProcessor.h" 16 #include "GrFragmentProcessor.h"
18 #include "GrTextureAccess.h" 17 #include "GrTextureAccess.h"
19 #include "GrTypes.h" 18 #include "GrTypes.h"
20 #include "GrXferProcessor.h" 19 #include "GrXferProcessor.h"
21 20
22 class GrInvariantOutput; 21 class GrInvariantOutput;
23 class GrProcOptInfo; 22 class GrProcOptInfo;
24 class GrTexture; 23 class GrTexture;
25 24
26 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////////
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 65 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
67 typedef GrFragmentProcessor INHERITED; 66 typedef GrFragmentProcessor INHERITED;
68 }; 67 };
69 68
70 /////////////////////////////////////////////////////////////////////////////// 69 ///////////////////////////////////////////////////////////////////////////////
71 // Xfer Processor 70 // Xfer Processor
72 /////////////////////////////////////////////////////////////////////////////// 71 ///////////////////////////////////////////////////////////////////////////////
73 72
74 class GrArithmeticXP : public GrXferProcessor { 73 class GrArithmeticXP : public GrXferProcessor {
75 public: 74 public:
76 static GrXferProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor, 75 static GrXferProcessor* Create(float k1, float k2, float k3, float k4, bool enforcePMColor) {
77 const GrDeviceCoordTexture* dstCopy, 76 return SkNEW_ARGS(GrArithmeticXP, (k1, k2, k3, k4, enforcePMColor));
78 bool willReadDstColor) {
79 return SkNEW_ARGS(GrArithmeticXP, (k1, k2, k3, k4, enforcePMColor, dstCo py,
80 willReadDstColor));
81 } 77 }
82 78
83 ~GrArithmeticXP() SK_OVERRIDE {}; 79 ~GrArithmeticXP() SK_OVERRIDE {};
84 80
85 const char* name() const SK_OVERRIDE { return "Arithmetic"; } 81 const char* name() const SK_OVERRIDE { return "Arithmetic"; }
86 82
83 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const SK_OVERRIDE;
84
87 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE; 85 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
88 86
89 bool hasSecondaryOutput() const SK_OVERRIDE { return false; } 87 bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
90 88
91 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI, 89 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
92 const GrProcOptInfo& coveragePOI, 90 const GrProcOptInfo& coveragePOI,
93 bool doesStencilWrite, 91 bool doesStencilWrite,
94 GrColor* overrideColor, 92 GrColor* overrideColor,
95 const GrDrawTargetCaps& caps) SK_ OVERRIDE; 93 const GrDrawTargetCaps& caps) SK_ OVERRIDE;
96 94
97 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE { 95 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
98 blendInfo->fSrcBlend = kOne_GrBlendCoeff; 96 blendInfo->fSrcBlend = kOne_GrBlendCoeff;
99 blendInfo->fDstBlend = kZero_GrBlendCoeff; 97 blendInfo->fDstBlend = kZero_GrBlendCoeff;
100 blendInfo->fBlendConstant = 0; 98 blendInfo->fBlendConstant = 0;
101 } 99 }
102 100
103 float k1() const { return fK1; } 101 float k1() const { return fK1; }
104 float k2() const { return fK2; } 102 float k2() const { return fK2; }
105 float k3() const { return fK3; } 103 float k3() const { return fK3; }
106 float k4() const { return fK4; } 104 float k4() const { return fK4; }
107 bool enforcePMColor() const { return fEnforcePMColor; } 105 bool enforcePMColor() const { return fEnforcePMColor; }
108 106
109 private: 107 private:
110 GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor, 108 GrArithmeticXP(float k1, float k2, float k3, float k4, bool enforcePMColor);
111 const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
112
113 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con st SK_OVERRIDE;
114 109
115 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE { 110 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE {
116 const GrArithmeticXP& xp = xpBase.cast<GrArithmeticXP>(); 111 const GrArithmeticXP& xp = xpBase.cast<GrArithmeticXP>();
117 if (fK1 != xp.fK1 || 112 if (fK1 != xp.fK1 ||
118 fK2 != xp.fK2 || 113 fK2 != xp.fK2 ||
119 fK3 != xp.fK3 || 114 fK3 != xp.fK3 ||
120 fK4 != xp.fK4 || 115 fK4 != xp.fK4 ||
121 fEnforcePMColor != xp.fEnforcePMColor) { 116 fEnforcePMColor != xp.fEnforcePMColor) {
122 return false; 117 return false;
123 } 118 }
124 return true; 119 return true;
125 } 120 }
126 121
127 float fK1, fK2, fK3, fK4; 122 float fK1, fK2, fK3, fK4;
128 bool fEnforcePMColor; 123 bool fEnforcePMColor;
129 124
130 typedef GrXferProcessor INHERITED; 125 typedef GrXferProcessor INHERITED;
131 }; 126 };
132 127
133 /////////////////////////////////////////////////////////////////////////////// 128 ///////////////////////////////////////////////////////////////////////////////
134 129
135 class GrArithmeticXPFactory : public GrXPFactory { 130 class GrArithmeticXPFactory : public GrXPFactory {
136 public: 131 public:
137 static GrXPFactory* Create(float k1, float k2, float k3, float k4, bool enfo rcePMColor) { 132 static GrXPFactory* Create(float k1, float k2, float k3, float k4, bool enfo rcePMColor) {
138 return SkNEW_ARGS(GrArithmeticXPFactory, (k1, k2, k3, k4, enforcePMColor )); 133 return SkNEW_ARGS(GrArithmeticXPFactory, (k1, k2, k3, k4, enforcePMColor ));
139 } 134 }
140 135
136 GrXferProcessor* createXferProcessor(const GrProcOptInfo& colorPOI,
137 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
138 return GrArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor);
139 }
140
141 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE { 141 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE {
142 return true; 142 return true;
143 } 143 }
144 144
145 bool canApplyCoverage(const GrProcOptInfo& colorPOI, 145 bool canApplyCoverage(const GrProcOptInfo& colorPOI,
146 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { 146 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
147 return true; 147 return true;
148 } 148 }
149 149
150 bool canTweakAlphaForCoverage() const SK_OVERRIDE { 150 bool canTweakAlphaForCoverage() const SK_OVERRIDE {
151 return false; 151 return false;
152 } 152 }
153 153
154 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, 154 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
155 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; 155 GrXPFactory::InvariantOutput*) const SK_OVERRIDE;
156 156
157 bool willReadDst() const SK_OVERRIDE { return true; }
158
157 private: 159 private:
158 GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePM Color); 160 GrArithmeticXPFactory(float k1, float k2, float k3, float k4, bool enforcePM Color);
159 161
160 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI,
161 const GrProcOptInfo& coveragePOI,
162 const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE {
163 return GrArithmeticXP::Create(fK1, fK2, fK3, fK4, fEnforcePMColor, dstCo py,
164 this->willReadDstColor());
165 }
166
167 bool willReadDstColor() const SK_OVERRIDE { return true; }
168
169 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { 162 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE {
170 const GrArithmeticXPFactory& xpf = xpfBase.cast<GrArithmeticXPFactory>() ; 163 const GrArithmeticXPFactory& xpf = xpfBase.cast<GrArithmeticXPFactory>() ;
171 if (fK1 != xpf.fK1 || 164 if (fK1 != xpf.fK1 ||
172 fK2 != xpf.fK2 || 165 fK2 != xpf.fK2 ||
173 fK3 != xpf.fK3 || 166 fK3 != xpf.fK3 ||
174 fK4 != xpf.fK4 || 167 fK4 != xpf.fK4 ||
175 fEnforcePMColor != xpf.fEnforcePMColor) { 168 fEnforcePMColor != xpf.fEnforcePMColor) {
176 return false; 169 return false;
177 } 170 }
178 return true; 171 return true;
179 } 172 }
180 173
181 GR_DECLARE_XP_FACTORY_TEST; 174 GR_DECLARE_XP_FACTORY_TEST;
182 175
183 float fK1, fK2, fK3, fK4; 176 float fK1, fK2, fK3, fK4;
184 bool fEnforcePMColor; 177 bool fEnforcePMColor;
185 178
186 typedef GrXPFactory INHERITED; 179 typedef GrXPFactory INHERITED;
187 }; 180 };
188 181
189 #endif 182 #endif
190 #endif 183 #endif
OLDNEW
« no previous file with comments | « include/gpu/effects/GrPorterDuffXferProcessor.h ('k') | src/effects/SkArithmeticMode_gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698