OLD | NEW |
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 GrCoordSet coordSet) | 240 GrCoordSet coordSet) |
241 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) | 241 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) |
242 , fTextureDomain(domain, mode) { | 242 , fTextureDomain(domain, mode) { |
243 SkASSERT(mode != GrTextureDomain::kRepeat_Mode || | 243 SkASSERT(mode != GrTextureDomain::kRepeat_Mode || |
244 filterMode == GrTextureParams::kNone_FilterMode); | 244 filterMode == GrTextureParams::kNone_FilterMode); |
245 this->initClassID<GrTextureDomainEffect>(); | 245 this->initClassID<GrTextureDomainEffect>(); |
246 } | 246 } |
247 | 247 |
248 GrTextureDomainEffect::~GrTextureDomainEffect() {} | 248 GrTextureDomainEffect::~GrTextureDomainEffect() {} |
249 | 249 |
250 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 250 void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
251 GrProcessorKeyBuilder* b) const
{ | 251 GrProcessorKeyBuilder* b) cons
t { |
252 GrGLTextureDomainEffect::GenKey(*this, caps, b); | 252 GrGLTextureDomainEffect::GenKey(*this, caps, b); |
253 } | 253 } |
254 | 254 |
255 GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const { | 255 GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const { |
256 return new GrGLTextureDomainEffect(*this); | 256 return new GrGLTextureDomainEffect(*this); |
257 } | 257 } |
258 | 258 |
259 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 259 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
260 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); | 260 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); |
261 return this->fTextureDomain == s.fTextureDomain; | 261 return this->fTextureDomain == s.fTextureDomain; |
262 } | 262 } |
263 | 263 |
264 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { | 264 void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c
onst { |
265 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper | 265 if (GrTextureDomain::kDecal_Mode == fTextureDomain.mode()) { // TODO: helper |
(...skipping 25 matching lines...) Expand all Loading... |
291 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; | 291 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; |
292 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; | 292 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; |
293 return GrTextureDomainEffect::Create( | 293 return GrTextureDomainEffect::Create( |
294 d->fTextures[texIdx], | 294 d->fTextures[texIdx], |
295 matrix, | 295 matrix, |
296 domain, | 296 domain, |
297 mode, | 297 mode, |
298 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, | 298 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, |
299 coords); | 299 coords); |
300 } | 300 } |
OLD | NEW |