From 237a461ec96918eef9bd9f61d4d63fc43968b3e8 Mon Sep 17 00:00:00 2001 From: "tomhudson@google.com" Date: Tue, 19 Jul 2011 15:44:00 +0000 Subject: [PATCH] Instead of turning clipping off during AA, clip to the offscreen tile when we're writing to it, then restore the onscreen clip when copying it back to screen. Speeds up rendering of web pages with paths >> tile size. git-svn-id: http://skia.googlecode.com/svn/trunk@1899 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gpu/src/GrContext.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gpu/src/GrContext.cpp b/gpu/src/GrContext.cpp index dcaba1d..ef5ad11 100644 --- a/gpu/src/GrContext.cpp +++ b/gpu/src/GrContext.cpp @@ -545,6 +545,7 @@ struct GrContext::OffscreenRecord { GrTextureEntry* fEntry0; GrTextureEntry* fEntry1; GrDrawTarget::SavedDrawState fSavedState; + GrClip fClip; }; bool GrContext::doOffscreenAA(GrDrawTarget* target, @@ -658,6 +659,8 @@ bool GrContext::prepareForOffscreenAA(GrDrawTarget* target, record->fTileCountX = GrIDivRoundUp(boundW, record->fTileSizeX); record->fTileCountY = GrIDivRoundUp(boundH, record->fTileSizeY); + record->fClip = target->getClip(); + target->saveCurrentDrawState(&record->fSavedState); return true; } @@ -684,15 +687,13 @@ void GrContext::setupOffscreenAAPass1(GrDrawTarget* target, scaleM.setScale(record->fScale * GR_Scalar1, record->fScale * GR_Scalar1); target->postConcatViewMatrix(scaleM); - // clip gets applied in second pass - target->disableState(GrDrawTarget::kClip_StateBit); - int w = (tileX == record->fTileCountX-1) ? boundRect.fRight - left : record->fTileSizeX; int h = (tileY == record->fTileCountY-1) ? boundRect.fBottom - top : record->fTileSizeY; GrIRect clear = SkIRect::MakeWH(record->fScale * w, record->fScale * h); + target->setClip(GrClip(clear)); #if 0 // visualize tile boundaries by setting edges of offscreen to white // and interior to tranparent. black. @@ -779,6 +780,7 @@ void GrContext::doOffscreenAAPass2(GrDrawTarget* target, int stageMask = paint.getActiveStageMask(); target->restoreDrawState(record->fSavedState); + target->setClip(record->fClip); if (stageMask) { GrMatrix invVM; -- 2.7.4