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/GrGpu.cpp b/gpu/src/GrGpu.cpp
index 4a46e98..045dcd0 100644
--- a/gpu/src/GrGpu.cpp
+++ b/gpu/src/GrGpu.cpp
@@ -295,8 +295,8 @@
GrRect rtRect;
rtRect.setLTRB(0, 0,
GrIntToScalar(rt.width()), GrIntToScalar(rt.height()));
- if (fClip.hasBounds()) {
- bounds = fClip.getBounds();
+ if (fClip.hasConservativeBounds()) {
+ bounds = fClip.getConservativeBounds();
bounds.intersectWith(rtRect);
} else {
bounds = rtRect;
@@ -342,13 +342,13 @@
// the full rt size and another element intersected with it.
// We can skip the first full-size rect and save a big rect draw.
int firstElement = 0;
- if (clip.getElementCount() > 1 &&
+ if (clip.getElementCount() > 1 &&
kRect_ClipType == clip.getElementType(0) &&
kIntersect_SetOp == clip.getOp(1)&&
clip.getRect(0).contains(bounds)) {
firstElement = 1;
}
-
+
// walk through each clip element and perform its set op
// with the existing clip.
for (int c = firstElement; c < count; ++c) {
@@ -390,8 +390,8 @@
this->drawSimpleRect(clip.getRect(c), NULL, 0);
} else {
SET_RANDOM_COLOR
- getPathRenderer()->drawPathToStencil(this, clip.getPath(c),
- NonInvertedFill(fill),
+ getPathRenderer()->drawPathToStencil(this, clip.getPath(c),
+ NonInvertedFill(fill),
NULL);
}
}
@@ -408,7 +408,7 @@
} else {
SET_RANDOM_COLOR
getPathRenderer()->drawPath(this, 0,
- clip.getPath(c),
+ clip.getPath(c),
fill, NULL);
}
} else {