| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 typedef GrGLSLFragmentProcessor INHERITED; | 188 typedef GrGLSLFragmentProcessor INHERITED; |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) { | 191 GrGLTextureDomainEffect::GrGLTextureDomainEffect(const GrProcessor&) { |
| 192 } | 192 } |
| 193 | 193 |
| 194 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { | 194 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { |
| 195 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo
mainEffect>(); | 195 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo
mainEffect>(); |
| 196 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 196 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
| 197 | 197 |
| 198 GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder()
; | 198 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 199 SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0); | 199 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); |
| 200 fGLDomain.sampleTexture(fsBuilder, domain, args.fOutputColor, coords2D, args
.fSamplers[0], | 200 fGLDomain.sampleTexture(fragBuilder, domain, args.fOutputColor, coords2D, ar
gs.fSamplers[0], |
| 201 args.fInputColor); | 201 args.fInputColor); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman, | 204 void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman, |
| 205 const GrProcessor& processor) { | 205 const GrProcessor& processor) { |
| 206 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD
omainEffect>(); | 206 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD
omainEffect>(); |
| 207 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 207 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
| 208 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); | 208 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); |
| 209 } | 209 } |
| 210 | 210 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |