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
diff --git a/gpu/src/GrClip.cpp b/gpu/src/GrClip.cpp
index 5ba991b..e8da3d1 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::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 @@
fList.push_back();
fList.back().fRect = r;
fList.back().fType = kRect_ClipType;
- fBounds = r;
- fBoundsValid = true;
+ fConservativeBounds = r;
+ fConservativeBoundsValid = true;
}
}
@@ -82,13 +82,13 @@
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 @@
}
}
}
- 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;
}
}