| 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" |
| 11 #include "gl/GrGLEffect.h" | 11 #include "gl/GrGLEffect.h" |
| 12 #include "SkFloatingPoint.h" | 12 #include "SkFloatingPoint.h" |
| 13 | 13 |
| 14 | 14 |
| 15 GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index) | 15 GrTextureDomain::GrTextureDomain(const SkRect& domain, Mode mode, int index) |
| 16 : fIndex(index) { | 16 : fIndex(index) { |
| 17 | 17 |
| 18 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; | 18 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; |
| 19 if (domain.contains(kFullRect)) { | 19 if (domain.contains(kFullRect) && kClamp_Mode == mode) { |
| 20 fMode = kIgnore_Mode; | 20 fMode = kIgnore_Mode; |
| 21 } else { | 21 } else { |
| 22 fMode = mode; | 22 fMode = mode; |
| 23 } | 23 } |
| 24 | 24 |
| 25 if (fMode != kIgnore_Mode) { | 25 if (fMode != kIgnore_Mode) { |
| 26 // We don't currently handle domains that are empty or don't intersect t
he texture. | 26 // We don't currently handle domains that are empty or don't intersect t
he texture. |
| 27 // It is OK if the domain rect is a line or point, but it should not be
inverted. We do not | 27 // It is OK if the domain rect is a line or point, but it should not be
inverted. We do not |
| 28 // handle rects that do not intersect the [0..1]x[0..1] rect. | 28 // handle rects that do not intersect the [0..1]x[0..1] rect. |
| 29 SkASSERT(domain.fLeft <= domain.fRight); | 29 SkASSERT(domain.fLeft <= domain.fRight); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 271 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
| 272 bool bilerp = random->nextBool(); | 272 bool bilerp = random->nextBool(); |
| 273 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; | 273 GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kPosition_GrCoo
rdSet; |
| 274 return GrTextureDomainEffect::Create(textures[texIdx], | 274 return GrTextureDomainEffect::Create(textures[texIdx], |
| 275 matrix, | 275 matrix, |
| 276 domain, | 276 domain, |
| 277 mode, | 277 mode, |
| 278 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, | 278 bilerp ? GrTextureParams::kBilerp_Filte
rMode : GrTextureParams::kNone_FilterMode, |
| 279 coords); | 279 coords); |
| 280 } | 280 } |
| OLD | NEW |