diff options
author | 2011-08-02 14:19:11 +0000 | |
---|---|---|
committer | 2011-08-02 14:19:11 +0000 | |
commit | 4043ae20615c79298f190865665beeb6b86e14d0 (patch) | |
tree | 7c7785d1e110ab807417b48f7c1cdf5f337e82df /gpu/src/GrGpu.cpp | |
parent | a16d6506bde44f8528e681a49c412a1e87b74482 (diff) |
Revert r2026 due to bot failures
git-svn-id: http://skia.googlecode.com/svn/trunk@2027 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gpu/src/GrGpu.cpp')
-rw-r--r-- | gpu/src/GrGpu.cpp | 43 |
1 files changed, 9 insertions, 34 deletions
diff --git a/gpu/src/GrGpu.cpp b/gpu/src/GrGpu.cpp index be84e270d5..c89dd4e4bb 100644 --- a/gpu/src/GrGpu.cpp +++ b/gpu/src/GrGpu.cpp @@ -8,12 +8,12 @@ #include "GrGpu.h" -#include "GrBufferAllocPool.h" +#include "GrTextStrike.h" #include "GrClipIterator.h" #include "GrIndexBuffer.h" -#include "GrPathRenderer.h" -#include "GrGLStencilBuffer.h" #include "GrVertexBuffer.h" +#include "GrBufferAllocPool.h" +#include "GrPathRenderer.h" // probably makes no sense for this to be less than a page static const size_t VERTEX_POOL_VB_SIZE = 1 << 18; @@ -140,24 +140,7 @@ void GrGpu::unimpl(const char msg[]) { GrTexture* GrGpu::createTexture(const GrTextureDesc& desc, const void* srcData, size_t rowBytes) { this->handleDirtyContext(); - GrTexture* tex = this->onCreateTexture(desc, srcData, rowBytes); - if (NULL != tex && - (kRenderTarget_GrTextureFlagBit & desc.fFlags) && - !(kNoStencil_GrTextureFlagBit & desc.fFlags)) { - GrAssert(NULL != tex->asRenderTarget()); - // TODO: defer this and attach dynamically - if (!this->attachStencilBufferToRenderTarget(tex->asRenderTarget())) { - tex->unref(); - return NULL; - } - } - return tex; -} - -bool GrGpu::attachStencilBufferToRenderTarget(GrRenderTarget* rt) { - // TODO: use a cache of stencil buffers rather than create per-rt. - return this->createStencilBufferForRenderTarget(rt, rt->width(), - rt->height()); + return this->onCreateTexture(desc, srcData, rowBytes); } GrRenderTarget* GrGpu::createRenderTargetFrom3DApiState() { @@ -415,22 +398,14 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { fClipInStencil = !fClip.isRect() && !fClip.isEmpty() && !bounds.isEmpty(); - // TODO: dynamically attach a SB when needed. - GrStencilBuffer* stencilBuffer = rt.getStencilBuffer(); - if (fClipInStencil && NULL == stencilBuffer) { - return false; - } - if (fClipInStencil && - stencilBuffer->mustRenderClip(fClip, rt.width(), rt.height())) { - - stencilBuffer->setLastClip(fClip, rt.width(), rt.height()); + fClip != rt.fLastStencilClip) { + rt.fLastStencilClip = fClip; // 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 - // we just stashed on the SB to render from. We set it back after - // we finish drawing it into the stencil. - const GrClip& clip = stencilBuffer->getLastClip(); + // in the rt to render + const GrClip& clip = rt.fLastStencilClip; fClip.setFromRect(bounds); AutoStateRestore asr(this); @@ -445,7 +420,7 @@ bool GrGpu::setupClipAndFlushState(GrPrimitiveType type) { this->disableState(kNoColorWrites_StateBit); #endif int count = clip.getElementCount(); - int clipBit = stencilBuffer->bits(); + int clipBit = rt.stencilBits(); clipBit = (1 << (clipBit-1)); // often we'll see the first two elements of the clip are |