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

Side by Side Diff: src/effects/SkArithmeticMode_gpu.cpp

Issue 1443743002: Rename some processor functions from GL to GLSL (Closed) Base URL: https://skia.googlesource.com/skia.git@primProcs
Patch Set: nits Created 5 years, 1 month 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/effects/SkArithmeticMode_gpu.h ('k') | src/effects/SkBlurMaskFilter.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 #include "SkArithmeticMode_gpu.h" 8 #include "SkArithmeticMode_gpu.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 GrArithmeticFP::GrArithmeticFP(float k1, float k2, float k3, float k4, bool enfo rcePMColor, 99 GrArithmeticFP::GrArithmeticFP(float k1, float k2, float k3, float k4, bool enfo rcePMColor,
100 const GrFragmentProcessor* dst) 100 const GrFragmentProcessor* dst)
101 : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) { 101 : fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) {
102 this->initClassID<GrArithmeticFP>(); 102 this->initClassID<GrArithmeticFP>();
103 103
104 SkASSERT(dst); 104 SkASSERT(dst);
105 SkDEBUGCODE(int dstIndex = )this->registerChildProcessor(dst); 105 SkDEBUGCODE(int dstIndex = )this->registerChildProcessor(dst);
106 SkASSERT(0 == dstIndex); 106 SkASSERT(0 == dstIndex);
107 } 107 }
108 108
109 void GrArithmeticFP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const { 109 void GrArithmeticFP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKe yBuilder* b) const {
110 GLArithmeticFP::GenKey(*this, caps, b); 110 GLArithmeticFP::GenKey(*this, caps, b);
111 } 111 }
112 112
113 GrGLSLFragmentProcessor* GrArithmeticFP::onCreateGLInstance() const { 113 GrGLSLFragmentProcessor* GrArithmeticFP::onCreateGLSLInstance() const {
114 return new GLArithmeticFP(*this); 114 return new GLArithmeticFP(*this);
115 } 115 }
116 116
117 bool GrArithmeticFP::onIsEqual(const GrFragmentProcessor& fpBase) const { 117 bool GrArithmeticFP::onIsEqual(const GrFragmentProcessor& fpBase) const {
118 const GrArithmeticFP& fp = fpBase.cast<GrArithmeticFP>(); 118 const GrArithmeticFP& fp = fpBase.cast<GrArithmeticFP>();
119 return fK1 == fp.fK1 && 119 return fK1 == fp.fK1 &&
120 fK2 == fp.fK2 && 120 fK2 == fp.fK2 &&
121 fK3 == fp.fK3 && 121 fK3 == fp.fK3 &&
122 fK4 == fp.fK4 && 122 fK4 == fp.fK4 &&
123 fEnforcePMColor == fp.fEnforcePMColor; 123 fEnforcePMColor == fp.fEnforcePMColor;
(...skipping 23 matching lines...) Expand all
147 // Xfer Processor 147 // Xfer Processor
148 /////////////////////////////////////////////////////////////////////////////// 148 ///////////////////////////////////////////////////////////////////////////////
149 149
150 class ArithmeticXP : public GrXferProcessor { 150 class ArithmeticXP : public GrXferProcessor {
151 public: 151 public:
152 ArithmeticXP(const DstTexture*, bool hasMixedSamples, 152 ArithmeticXP(const DstTexture*, bool hasMixedSamples,
153 float k1, float k2, float k3, float k4, bool enforcePMColor); 153 float k1, float k2, float k3, float k4, bool enforcePMColor);
154 154
155 const char* name() const override { return "Arithmetic"; } 155 const char* name() const override { return "Arithmetic"; }
156 156
157 GrGLSLXferProcessor* createGLInstance() const override; 157 GrGLSLXferProcessor* createGLSLInstance() const override;
158 158
159 float k1() const { return fK1; } 159 float k1() const { return fK1; }
160 float k2() const { return fK2; } 160 float k2() const { return fK2; }
161 float k3() const { return fK3; } 161 float k3() const { return fK3; }
162 float k4() const { return fK4; } 162 float k4() const { return fK4; }
163 bool enforcePMColor() const { return fEnforcePMColor; } 163 bool enforcePMColor() const { return fEnforcePMColor; }
164 164
165 private: 165 private:
166 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI, 166 GrXferProcessor::OptFlags onGetOptimizations(const GrProcOptInfo& colorPOI,
167 const GrProcOptInfo& coveragePO I, 167 const GrProcOptInfo& coveragePO I,
168 bool doesStencilWrite, 168 bool doesStencilWrite,
169 GrColor* overrideColor, 169 GrColor* overrideColor,
170 const GrCaps& caps) override; 170 const GrCaps& caps) override;
171 171
172 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c onst override; 172 void onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override;
173 173
174 bool onIsEqual(const GrXferProcessor& xpBase) const override { 174 bool onIsEqual(const GrXferProcessor& xpBase) const override {
175 const ArithmeticXP& xp = xpBase.cast<ArithmeticXP>(); 175 const ArithmeticXP& xp = xpBase.cast<ArithmeticXP>();
176 if (fK1 != xp.fK1 || 176 if (fK1 != xp.fK1 ||
177 fK2 != xp.fK2 || 177 fK2 != xp.fK2 ||
178 fK3 != xp.fK3 || 178 fK3 != xp.fK3 ||
179 fK4 != xp.fK4 || 179 fK4 != xp.fK4 ||
180 fEnforcePMColor != xp.fEnforcePMColor) { 180 fEnforcePMColor != xp.fEnforcePMColor) {
181 return false; 181 return false;
182 } 182 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 float k1, float k2, float k3, float k4, bool enforceP MColor) 238 float k1, float k2, float k3, float k4, bool enforceP MColor)
239 : INHERITED(dstTexture, true, hasMixedSamples) 239 : INHERITED(dstTexture, true, hasMixedSamples)
240 , fK1(k1) 240 , fK1(k1)
241 , fK2(k2) 241 , fK2(k2)
242 , fK3(k3) 242 , fK3(k3)
243 , fK4(k4) 243 , fK4(k4)
244 , fEnforcePMColor(enforcePMColor) { 244 , fEnforcePMColor(enforcePMColor) {
245 this->initClassID<ArithmeticXP>(); 245 this->initClassID<ArithmeticXP>();
246 } 246 }
247 247
248 void ArithmeticXP::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBui lder* b) const { 248 void ArithmeticXP::onGetGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyB uilder* b) const {
249 GLArithmeticXP::GenKey(*this, caps, b); 249 GLArithmeticXP::GenKey(*this, caps, b);
250 } 250 }
251 251
252 GrGLSLXferProcessor* ArithmeticXP::createGLInstance() const { return new GLArith meticXP(*this); } 252 GrGLSLXferProcessor* ArithmeticXP::createGLSLInstance() const { return new GLAri thmeticXP(*this); }
253 253
254 GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo& colorPOI, 254 GrXferProcessor::OptFlags ArithmeticXP::onGetOptimizations(const GrProcOptInfo& colorPOI,
255 const GrProcOptInfo& coveragePOI, 255 const GrProcOptInfo& coveragePOI,
256 bool doesStencilWrite , 256 bool doesStencilWrite ,
257 GrColor* overrideColo r, 257 GrColor* overrideColo r,
258 const GrCaps& caps) { 258 const GrCaps& caps) {
259 return GrXferProcessor::kNone_OptFlags; 259 return GrXferProcessor::kNone_OptFlags;
260 } 260 }
261 261
262 /////////////////////////////////////////////////////////////////////////////// 262 ///////////////////////////////////////////////////////////////////////////////
(...skipping 30 matching lines...) Expand all
293 float k1 = d->fRandom->nextF(); 293 float k1 = d->fRandom->nextF();
294 float k2 = d->fRandom->nextF(); 294 float k2 = d->fRandom->nextF();
295 float k3 = d->fRandom->nextF(); 295 float k3 = d->fRandom->nextF();
296 float k4 = d->fRandom->nextF(); 296 float k4 = d->fRandom->nextF();
297 bool enforcePMColor = d->fRandom->nextBool(); 297 bool enforcePMColor = d->fRandom->nextBool();
298 298
299 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor); 299 return GrArithmeticXPFactory::Create(k1, k2, k3, k4, enforcePMColor);
300 } 300 }
301 301
302 #endif 302 #endif
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode_gpu.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698