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

Side by Side Diff: src/gpu/effects/GrTextureDomain.cpp

Issue 1666773002: Clean up GrGLSLFragmentProcessor-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 memcpy(fPrevDomain, values, kPrevDomainCount * sizeof(float)); 169 memcpy(fPrevDomain, values, kPrevDomainCount * sizeof(float));
170 } 170 }
171 } 171 }
172 } 172 }
173 173
174 174
175 ////////////////////////////////////////////////////////////////////////////// 175 //////////////////////////////////////////////////////////////////////////////
176 176
177 class GrGLTextureDomainEffect : public GrGLSLFragmentProcessor { 177 class GrGLTextureDomainEffect : public GrGLSLFragmentProcessor {
178 public: 178 public:
179 GrGLTextureDomainEffect(const GrProcessor&); 179 void emitCode(EmitArgs&) override;
180
181 virtual void emitCode(EmitArgs&) override;
182 180
183 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*); 181 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessor KeyBuilder*);
184 182
185 protected: 183 protected:
186 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ; 184 void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override ;
187 185
188 private: 186 private:
189 GrTextureDomain::GLDomain fGLDomain; 187 GrTextureDomain::GLDomain fGLDomain;
190 typedef GrGLSLFragmentProcessor INHERITED; 188 typedef GrGLSLFragmentProcessor INHERITED;
191 }; 189 };
192 190
193 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) {
194 }
195
196 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { 191 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) {
197 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>(); 192 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo mainEffect>();
198 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); 193 const GrTextureDomain& domain = textureDomainEffect.textureDomain();
199 194
200 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 195 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
201 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); 196 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
202 fGLDomain.sampleTexture(fragBuilder, 197 fGLDomain.sampleTexture(fragBuilder,
203 args.fUniformHandler, 198 args.fUniformHandler,
204 args.fGLSLCaps, 199 args.fGLSLCaps,
205 domain, 200 domain,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 249 }
255 250
256 GrTextureDomainEffect::~GrTextureDomainEffect() {} 251 GrTextureDomainEffect::~GrTextureDomainEffect() {}
257 252
258 void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, 253 void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
259 GrProcessorKeyBuilder* b) cons t { 254 GrProcessorKeyBuilder* b) cons t {
260 GrGLTextureDomainEffect::GenKey(*this, caps, b); 255 GrGLTextureDomainEffect::GenKey(*this, caps, b);
261 } 256 }
262 257
263 GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const { 258 GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
264 return new GrGLTextureDomainEffect(*this); 259 return new GrGLTextureDomainEffect;
265 } 260 }
266 261
267 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 262 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
268 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); 263 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
269 return this->fTextureDomain == s.fTextureDomain; 264 return this->fTextureDomain == s.fTextureDomain;
270 } 265 }
271 266
272 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst { 267 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c onst {
273 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper 268 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper
274 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) { 269 if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
(...skipping 24 matching lines...) Expand all
299 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
300 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
301 return GrTextureDomainEffect::Create( 296 return GrTextureDomainEffect::Create(
302 d->fTextures[texIdx], 297 d->fTextures[texIdx],
303 matrix, 298 matrix,
304 domain, 299 domain,
305 mode, 300 mode,
306 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode, 301 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode,
307 coords); 302 coords);
308 } 303 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrSimpleTextureEffect.cpp ('k') | src/gpu/effects/GrXfermodeFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698