| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const char* inModulateColor) { | 53 const char* inModulateColor) { |
| 54 SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode); | 54 SkASSERT((Mode)-1 == fMode || textureDomain.mode() == fMode); |
| 55 SkDEBUGCODE(fMode = textureDomain.mode();) | 55 SkDEBUGCODE(fMode = textureDomain.mode();) |
| 56 | 56 |
| 57 if (textureDomain.mode() != kIgnore_Mode && !fDomainUni.isValid()) { | 57 if (textureDomain.mode() != kIgnore_Mode && !fDomainUni.isValid()) { |
| 58 const char* name; | 58 const char* name; |
| 59 SkString uniName("TexDom"); | 59 SkString uniName("TexDom"); |
| 60 if (textureDomain.fIndex >= 0) { | 60 if (textureDomain.fIndex >= 0) { |
| 61 uniName.appendS32(textureDomain.fIndex); | 61 uniName.appendS32(textureDomain.fIndex); |
| 62 } | 62 } |
| 63 fDomainUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragment_
Visibility, | 63 fDomainUni = uniformHandler->addUniform(kFragment_GrShaderFlag, |
| 64 kVec4f_GrSLType, kDefault_GrSLPr
ecision, | 64 kVec4f_GrSLType, kDefault_GrSLPr
ecision, |
| 65 uniName.c_str(), &name); | 65 uniName.c_str(), &name); |
| 66 fDomainName = name; | 66 fDomainName = name; |
| 67 } | 67 } |
| 68 | 68 |
| 69 switch (textureDomain.mode()) { | 69 switch (textureDomain.mode()) { |
| 70 case kIgnore_Mode: { | 70 case kIgnore_Mode: { |
| 71 builder->codeAppendf("%s = ", outColor); | 71 builder->codeAppendf("%s = ", outColor); |
| 72 builder->appendTextureLookupAndModulate(inModulateColor, sampler, | 72 builder->appendTextureLookupAndModulate(inModulateColor, sampler, |
| 73 inCoords.c_str()); | 73 inCoords.c_str()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; | 294 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool()
: false; |
| 295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; | 295 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC
oordSet; |
| 296 return GrTextureDomainEffect::Create( | 296 return GrTextureDomainEffect::Create( |
| 297 d->fTextures[texIdx], | 297 d->fTextures[texIdx], |
| 298 matrix, | 298 matrix, |
| 299 domain, | 299 domain, |
| 300 mode, | 300 mode, |
| 301 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, | 301 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi
lterMode, |
| 302 coords); | 302 coords); |
| 303 } | 303 } |
| OLD | NEW |