diff options
author | 2011-03-08 21:07:21 +0000 | |
---|---|---|
committer | 2011-03-08 21:07:21 +0000 | |
commit | 0b50b2ed462505c452de8b6d978c4e522e0f9fe1 (patch) | |
tree | 23e88cf6ddd3cc8ec9c25b8102ce10462ff91a14 /gpu/src/GrClip.cpp | |
parent | eb3828e29da07375dac4edb78eadd457a15fa874 (diff) |
If we compute an exact clip bounds prefer it over user passed bounds. Also clarify that bounds are conservative.
Review URL: http://codereview.appspot.com/4254063/
git-svn-id: http://skia.googlecode.com/svn/trunk@909 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrClip.cpp')
-rw-r--r-- | gpu/src/GrClip.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/gpu/src/GrClip.cpp b/gpu/src/GrClip.cpp index 5ba991bb1c..e8da3d19d9 100644 --- a/gpu/src/GrClip.cpp +++ b/gpu/src/GrClip.cpp @@ -19,8 +19,8 @@ GrClip::GrClip() : fList(fListMemory, kPreAllocElements) { - fBounds.setEmpty(); - fBoundsValid = true; + fConservativeBounds.setEmpty(); + fConservativeBoundsValid = true; } GrClip::GrClip(const GrClip& src) @@ -48,15 +48,15 @@ GrClip::~GrClip() {} GrClip& GrClip::operator=(const GrClip& src) { fList = src.fList; - fBounds = src.fBounds; - fBoundsValid = src.fBoundsValid; + fConservativeBounds = src.fConservativeBounds; + fConservativeBoundsValid = src.fConservativeBoundsValid; return *this; } void GrClip::setEmpty() { fList.reset(); - fBounds.setEmpty(); - fBoundsValid = true; + fConservativeBounds.setEmpty(); + fConservativeBoundsValid = true; } void GrClip::setFromRect(const GrRect& r) { @@ -68,8 +68,8 @@ void GrClip::setFromRect(const GrRect& r) { fList.push_back(); fList.back().fRect = r; fList.back().fType = kRect_ClipType; - fBounds = r; - fBoundsValid = true; + fConservativeBounds = r; + fConservativeBoundsValid = true; } } @@ -82,13 +82,13 @@ void GrClip::setFromIRect(const GrIRect& r) { fList.push_back(); fList.back().fRect.set(r); fList.back().fType = kRect_ClipType; - fBounds.set(r); - fBoundsValid = true; + fConservativeBounds.set(r); + fConservativeBoundsValid = true; } } void GrClip::setFromIterator(GrClipIterator* iter, GrScalar tx, GrScalar ty, - const GrRect* bounds) { + const GrRect* conservativeBounds) { fList.reset(); int rectCount = 0; @@ -138,18 +138,16 @@ void GrClip::setFromIterator(GrClipIterator* iter, GrScalar tx, GrScalar ty, } } } - fBoundsValid = false; - if (NULL == bounds) { - if (isectRectValid) { - fBoundsValid = true; - if (rectCount > 0) { - fBounds = fList[0].fRect; - } else { - fBounds.setEmpty(); - } + fConservativeBoundsValid = false; + if (isectRectValid) { + fConservativeBoundsValid = true; + if (rectCount > 0) { + fConservativeBounds = fList[0].fRect; + } else { + fConservativeBounds.setEmpty(); } - } else { - fBounds = *bounds; - fBoundsValid = true; + } else if (NULL != conservativeBounds) { + fConservativeBounds = *conservativeBounds; + fConservativeBoundsValid = true; } } |