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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, | 191 void GrGLTextureDomainEffect::emitCode(GrGLFPBuilder* builder, |
192 const GrFragmentProcessor& fp, | 192 const GrFragmentProcessor& fp, |
193 const char* outputColor, | 193 const char* outputColor, |
194 const char* inputColor, | 194 const char* inputColor, |
195 const TransformedCoordsArray& coords, | 195 const TransformedCoordsArray& coords, |
196 const TextureSamplerArray& samplers) { | 196 const TextureSamplerArray& samplers) { |
197 const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEf
fect>(); | 197 const GrTextureDomainEffect& textureDomainEffect = fp.cast<GrTextureDomainEf
fect>(); |
198 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 198 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
199 | 199 |
200 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 200 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
201 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); | 201 SkString coords2D = fsBuilder->ensureFSCoords2D(coords, 0); |
202 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0
], inputColor); | 202 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, coords2D, samplers[0
], inputColor); |
203 } | 203 } |
204 | 204 |
205 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman, | 205 void GrGLTextureDomainEffect::setData(const GrGLProgramDataManager& pdman, |
206 const GrProcessor& processor) { | 206 const GrProcessor& processor) { |
207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD
omainEffect>(); | 207 const GrTextureDomainEffect& textureDomainEffect = processor.cast<GrTextureD
omainEffect>(); |
208 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); | 208 const GrTextureDomain& domain = textureDomainEffect.textureDomain(); |
209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); | 209 fGLDomain.setData(pdman, domain, processor.texture(0)->origin()); |
210 } | 210 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 const SkMatrix& matrix = GrTest::TestMatrix(random); | 302 const SkMatrix& matrix = GrTest::TestMatrix(random); |
303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; | 303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; |
304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord
Set; | 304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoord
Set; |
305 return GrTextureDomainEffect::Create(textures[texIdx], | 305 return GrTextureDomainEffect::Create(textures[texIdx], |
306 matrix, | 306 matrix, |
307 domain, | 307 domain, |
308 mode, | 308 mode, |
309 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 309 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
310 coords); | 310 coords); |
311 } | 311 } |
OLD | NEW |