diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-08 20:32:13 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-11-08 20:32:13 +0000 |
commit | fe4e4916b37346ee7b4ca7a13d2eaee1fb3fc416 (patch) | |
tree | e12adce0ad4ee8162bbd8cfe708f2ef276fa0549 /src/gpu | |
parent | 6794a258e39358e8003b5106247db1b6812d8c84 (diff) |
Fix texture domain clipping assertion. It is OK to have a degenerate domain.
Review URL: https://codereview.appspot.com/6812101
git-svn-id: http://skia.googlecode.com/svn/trunk@6356 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/effects/GrTextureDomainEffect.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gpu/effects/GrTextureDomainEffect.cpp b/src/gpu/effects/GrTextureDomainEffect.cpp index e500fad4a8..6884682829 100644 --- a/src/gpu/effects/GrTextureDomainEffect.cpp +++ b/src/gpu/effects/GrTextureDomainEffect.cpp @@ -132,7 +132,16 @@ GrEffect* GrTextureDomainEffect::Create(GrTexture* texture, } else { SkRect clippedDomain; // We don't currently handle domains that are empty or don't intersect the texture. - SkAssertResult(clippedDomain.intersect(kFullRect, domain)); + // It is OK if the domain rect is a line or point, but it should not be inverted. We do not + // handle rects that do not intersect the [0..1]x[0..1] rect. + GrAssert(domain.fLeft <= domain.fRight); + GrAssert(domain.fTop <= domain.fBottom); + clippedDomain.fLeft = SkMaxScalar(domain.fLeft, kFullRect.fLeft); + clippedDomain.fRight = SkMinScalar(domain.fRight, kFullRect.fRight); + clippedDomain.fTop = SkMaxScalar(domain.fTop, kFullRect.fTop); + clippedDomain.fBottom = SkMinScalar(domain.fBottom, kFullRect.fBottom); + GrAssert(clippedDomain.fLeft <= clippedDomain.fRight); + GrAssert(clippedDomain.fTop <= clippedDomain.fBottom); return SkNEW_ARGS(GrTextureDomainEffect, (texture, matrix, clippedDomain, wrapMode, bilerp)); } |