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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 GrTextureDomain::GLDomain fGLDomain; | 185 GrTextureDomain::GLDomain fGLDomain; |
186 typedef GrGLSLFragmentProcessor INHERITED; | 186 typedef GrGLSLFragmentProcessor INHERITED; |
187 }; | 187 }; |
188 | 188 |
189 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { | 189 void GrGLTextureDomainEffect::emitCode(EmitArgs& args) { |
190 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo
mainEffect>(); | 190 const GrTextureDomainEffect& textureDomainEffect = args.fFp.cast<GrTextureDo
mainEffect>(); |
191 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 191 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
192 | 192 |
193 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; | 193 GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder; |
194 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); | 194 SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0); |
| 195 const GrGLSLSampler& sampler = args.fUniformHandler->getSampler(args.fTexSam
plers[0]); |
195 fGLDomain.sampleTexture(fragBuilder, | 196 fGLDomain.sampleTexture(fragBuilder, |
196 args.fUniformHandler, | 197 args.fUniformHandler, |
197 args.fGLSLCaps, | 198 args.fGLSLCaps, |
198 domain, | 199 domain, |
199 args.fOutputColor, | 200 args.fOutputColor, |
200 coords2D, | 201 coords2D, |
201 args.fTexSamplers[0], | 202 sampler, |
202 args.fInputColor); | 203 args.fInputColor); |
203 } | 204 } |
204 | 205 |
205 void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman, | 206 void GrGLTextureDomainEffect::onSetData(const GrGLSLProgramDataManager& pdman, |
206 const GrProcessor& processor) { | 207 const GrProcessor& processor) { |
207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD
omainEffect>(); | 208 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD
omainEffect>(); |
208 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 209 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); | 210 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); |
210 } | 211 } |
211 | 212 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; | 293 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; |
293 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; | 294 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; |
294 return GrTextureDomainEffect::Create( | 295 return GrTextureDomainEffect::Create( |
295 d->fTextures[texIdx], | 296 d->fTextures[texIdx], |
296 matrix, | 297 matrix, |
297 domain, | 298 domain, |
298 mode, | 299 mode, |
299 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, | 300 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, |
300 coords); | 301 coords); |
301 } | 302 } |
OLD | NEW |