| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 SkDEBUGCODE(fMode = textureDomain.mode();) | 49 SkDEBUGCODE(fMode = textureDomain.mode();) |
| 50 | 50 |
| 51 GrGLProgramBuilder* program = builder->getProgramBuilder(); | 51 GrGLProgramBuilder* program = builder->getProgramBuilder(); |
| 52 | 52 |
| 53 if (textureDomain.mode() != kIgnore_Mode && !fDomainUni.isValid()) { | 53 if (textureDomain.mode() != kIgnore_Mode && !fDomainUni.isValid()) { |
| 54 const char* name; | 54 const char* name; |
| 55 SkString uniName("TexDom"); | 55 SkString uniName("TexDom"); |
| 56 if (textureDomain.fIndex >= 0) { | 56 if (textureDomain.fIndex >= 0) { |
| 57 uniName.appendS32(textureDomain.fIndex); | 57 uniName.appendS32(textureDomain.fIndex); |
| 58 } | 58 } |
| 59 fDomainUni = program->addUniform(GrGLProgramBuilder::kFragment_Visibilit
y, kVec4f_GrSLType, | 59 fDomainUni = program->addUniform(GrGLProgramBuilder::kFragment_Visibilit
y, |
| 60 uniName.c_str(), &name); | 60 kVec4f_GrSLType, kDefault_GrSLPrecision
, |
| 61 uniName.c_str(), &name); |
| 61 fDomainName = name; | 62 fDomainName = name; |
| 62 } | 63 } |
| 63 | 64 |
| 64 switch (textureDomain.mode()) { | 65 switch (textureDomain.mode()) { |
| 65 case kIgnore_Mode: { | 66 case kIgnore_Mode: { |
| 66 builder->codeAppendf("\t%s = ", outColor); | 67 builder->codeAppendf("\t%s = ", outColor); |
| 67 builder->appendTextureLookupAndModulate(inModulateColor, sampler, | 68 builder->appendTextureLookupAndModulate(inModulateColor, sampler, |
| 68 inCoords.c_str()); | 69 inCoords.c_str()); |
| 69 builder->codeAppend(";\n"); | 70 builder->codeAppend(";\n"); |
| 70 break; | 71 break; |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); | 302 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); |
| 302 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; | 303 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : f
alse; |
| 303 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; | 304 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; |
| 304 return GrTextureDomainEffect::Create(textures[texIdx], | 305 return GrTextureDomainEffect::Create(textures[texIdx], |
| 305 matrix, | 306 matrix, |
| 306 domain, | 307 domain, |
| 307 mode, | 308 mode, |
| 308 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 309 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
| 309 coords); | 310 coords); |
| 310 } | 311 } |
| OLD | NEW |