diff options
author | 2011-12-09 15:55:34 +0000 | |
---|---|---|
committer | 2011-12-09 15:55:34 +0000 | |
commit | 8f9cbd62ec108d410b91155dcf6a4789c641246f (patch) | |
tree | fea9c8067a3d1bcc6b7c6c25f13b5644100db42e /src/gpu/GrGpu.cpp | |
parent | b6e161937bc890f0aa12ac5e27415d4d260ea6e0 (diff) |
Cleanup of r2830.
git-svn-id: http://skia.googlecode.com/svn/trunk@2841 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrGpu.cpp')
-rw-r--r-- | src/gpu/GrGpu.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index 1583630ecd..eb96c57b43 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -185,10 +185,8 @@ bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { // We used to clear down in the GL subclass using a special purpose // FBO. But iOS doesn't allow a stencil-only FBO. It reports unsupported // FBO status. - GrRenderTarget* oldRT = fCurrDrawState.fRenderTarget; - fCurrDrawState.fRenderTarget = rt; + GrDrawState::AutoRenderTargetRestore artr(this->drawState(), rt); this->clearStencil(); - fCurrDrawState.fRenderTarget = oldRT; return true; } else { return false; @@ -230,7 +228,7 @@ GrIndexBuffer* GrGpu::createIndexBuffer(uint32_t size, bool dynamic) { } void GrGpu::clear(const GrIRect* rect, GrColor color) { - if (NULL == this->getRenderTarget()) { + if (NULL == this->getDrawState().getRenderTarget()) { return; } this->handleDirtyContext(); @@ -530,16 +528,18 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { const GrIRect* r = NULL; GrIRect clipRect; + GrDrawState* drawState = this->drawState(); + const GrRenderTarget* rt = drawState->getRenderTarget(); + // GrDrawTarget should have filtered this for us - GrAssert(NULL != fCurrDrawState.fRenderTarget); + GrAssert(NULL != rt); - if (fCurrDrawState.fFlagBits & kClip_StateBit) { - GrRenderTarget& rt = *fCurrDrawState.fRenderTarget; + if (drawState->isClipState()) { GrRect bounds; GrRect rtRect; rtRect.setLTRB(0, 0, - GrIntToScalar(rt.width()), GrIntToScalar(rt.height())); + GrIntToScalar(rt->width()), GrIntToScalar(rt->height())); if (fClip.hasConservativeBounds()) { bounds = fClip.getConservativeBounds(); if (!bounds.intersect(rtRect)) { @@ -560,15 +560,15 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { !bounds.isEmpty(); // TODO: dynamically attach a SB when needed. - GrStencilBuffer* stencilBuffer = rt.getStencilBuffer(); + GrStencilBuffer* stencilBuffer = rt->getStencilBuffer(); if (fClipInStencil && NULL == stencilBuffer) { return false; } if (fClipInStencil && - stencilBuffer->mustRenderClip(fClip, rt.width(), rt.height())) { + stencilBuffer->mustRenderClip(fClip, rt->width(), rt->height())) { - stencilBuffer->setLastClip(fClip, rt.width(), rt.height()); + stencilBuffer->setLastClip(fClip, rt->width(), rt->height()); // we set the current clip to the bounds so that our recursive // draws are scissored to them. We use the copy of the complex clip @@ -580,12 +580,12 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { AutoStateRestore asr(this); AutoGeometryPush agp(this); - this->setViewMatrix(GrMatrix::I()); + drawState->setViewMatrix(GrMatrix::I()); this->flushScissor(NULL); #if !VISUALIZE_COMPLEX_CLIP - this->enableState(kNoColorWrites_StateBit); + drawState->enableState(GrDrawState::kNoColorWrites_StateBit); #else - this->disableState(kNoColorWrites_StateBit); + drawState->disableState(GrDrawState::kNoColorWrites_StateBit); #endif int count = clip.getElementCount(); int clipBit = stencilBuffer->bits(); @@ -606,7 +606,7 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { GrPathFill fill; bool fillInverted; // enabled at bottom of loop - this->disableState(kModifyStencilClip_StateBit); + drawState->disableState(kModifyStencilClip_StateBit); bool canRenderDirectToStencil; // can the clip element be drawn // directly to the stencil buffer @@ -664,11 +664,11 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { }; SET_RANDOM_COLOR if (kRect_ClipType == clip.getElementType(c)) { - this->setStencil(gDrawToStencil); + *drawState->stencil() = gDrawToStencil; this->drawSimpleRect(clip.getRect(c), NULL, 0); } else { if (canRenderDirectToStencil) { - this->setStencil(gDrawToStencil); + *drawState->stencil() = gDrawToStencil; pr->drawPath(0); } else { pr->drawPathToStencil(); @@ -678,9 +678,9 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { // now we modify the clip bit by rendering either the clip // element directly or a bounding rect of the entire clip. - this->enableState(kModifyStencilClip_StateBit); + drawState->enableState(kModifyStencilClip_StateBit); for (int p = 0; p < passes; ++p) { - this->setStencil(stencilSettings[p]); + *drawState->stencil() = stencilSettings[p]; if (canDrawDirectToClip) { if (kRect_ClipType == clip.getElementType(c)) { SET_RANDOM_COLOR |