| 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 "GrSimpleTextureEffect.h" | 9 #include "GrSimpleTextureEffect.h" |
| 10 #include "GrTBackendEffectFactory.h" | 10 #include "GrTBackendEffectFactory.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 const SkRect& domain, | 201 const SkRect& domain, |
| 202 GrTextureDomain::Mode mode, | 202 GrTextureDomain::Mode mode, |
| 203 GrTextureParams::FilterMode filterMod
e, | 203 GrTextureParams::FilterMode filterMod
e, |
| 204 GrCoordSet coordSet) { | 204 GrCoordSet coordSet) { |
| 205 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; | 205 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; |
| 206 if (GrTextureDomain::kIgnore_Mode == mode || | 206 if (GrTextureDomain::kIgnore_Mode == mode || |
| 207 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) { | 207 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) { |
| 208 return GrSimpleTextureEffect::Create(texture, matrix, filterMode); | 208 return GrSimpleTextureEffect::Create(texture, matrix, filterMode); |
| 209 } else { | 209 } else { |
| 210 | 210 |
| 211 AutoEffectUnref effect(SkNEW_ARGS(GrTextureDomainEffect, (texture, | 211 return SkNEW_ARGS(GrTextureDomainEffect, (texture, |
| 212 matrix, | 212 matrix, |
| 213 domain, | 213 domain, |
| 214 mode, | 214 mode, |
| 215 filterMode, | 215 filterMode, |
| 216 coordSet))); | 216 coordSet)); |
| 217 return CreateEffectRef(effect); | |
| 218 | |
| 219 } | 217 } |
| 220 } | 218 } |
| 221 | 219 |
| 222 GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture, | 220 GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture, |
| 223 const SkMatrix& matrix, | 221 const SkMatrix& matrix, |
| 224 const SkRect& domain, | 222 const SkRect& domain, |
| 225 GrTextureDomain::Mode mode, | 223 GrTextureDomain::Mode mode, |
| 226 GrTextureParams::FilterMode filterM
ode, | 224 GrTextureParams::FilterMode filterM
ode, |
| 227 GrCoordSet coordSet) | 225 GrCoordSet coordSet) |
| 228 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) | 226 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 269 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
| 272 bool bilerp = random->nextBool(); | 270 bool bilerp = random->nextBool(); |
| 273 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; | 271 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; |
| 274 return GrTextureDomainEffect::Create(textures[texIdx], | 272 return GrTextureDomainEffect::Create(textures[texIdx], |
| 275 matrix, | 273 matrix, |
| 276 domain, | 274 domain, |
| 277 mode, | 275 mode, |
| 278 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 276 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
| 279 coords); | 277 coords); |
| 280 } | 278 } |
| OLD | NEW |