From 0b50b2ed462505c452de8b6d978c4e522e0f9fe1 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Tue, 8 Mar 2011 21:07:21 +0000 Subject: 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 --- gpu/src/GrGpu.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'gpu/src/GrGpu.cpp') diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp index 4a46e9887d..045dcd00b6 100644 --- a/gpu/src/GrGpu.cpp +++ b/gpu/src/GrGpu.cpp @@ -295,8 +295,8 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { 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 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { // 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 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { 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 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { } else { SET_RANDOM_COLOR getPathRenderer()->drawPath(this, 0, - clip.getPath(c), + clip.getPath(c), fill, NULL); } } else { -- cgit v1.2.3