Fix for clip assert in Chrome tests

http://codereview.appspot.com/6442063/



git-svn-id: http://skia.googlecode.com/svn/trunk@4834 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2012-07-30 17:10:51 +00:00
parent 48af8a0a6a
commit b0fe4c59e8

View File

@ -256,7 +256,20 @@ void GrClipData::getConservativeBounds(const GrSurface* surface,
GrIRect* result,
bool* isIntersectionOfRects) const {
const GrRect& conservativeBounds = fClipStack->getConservativeBounds();
// Until we switch to using the SkClipStack directly we need to take
// this belt and suspenders approach here. When the clip stack
// reduces to a single clip, GrClip uses that rect as the conservative
// bounds rather than SkClipStack's bounds and the reduced rect
// was never trimmed to the render target's bounds.
SkRect temp = SkRect::MakeLTRB(0, 0,
SkIntToScalar(surface->width()),
SkIntToScalar(surface->height()));
GrRect conservativeBounds = fClipStack->getConservativeBounds();
if (!conservativeBounds.intersect(temp)) {
conservativeBounds.setEmpty();
}
conservativeBounds.roundOut(result);
}