GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { this->reset(); // This must be called by before the GrDrawTarget destructor this->releaseGeometry(); GrSafeUnref(fQuadIndexBuffer); GrSafeUnref(fAutoFlushTarget); }
GrGpu::~GrGpu() { GrSafeUnref(fQuadIndexBuffer); GrSafeUnref(fUnitSquareVertexBuffer); delete fVertexPool; delete fIndexPool; delete fPathRenderer; }
void GrInOrderDrawBuffer::reset() { GrAssert(1 == fGeoPoolStateStack.count()); this->resetVertexSource(); this->resetIndexSource(); uint32_t numStates = fStates.count(); for (uint32_t i = 0; i < numStates; ++i) { for (int s = 0; s < GrDrawState::kNumStages; ++s) { GrSafeUnref(fStates[i].getTexture(s)); } GrSafeUnref(fStates[i].getRenderTarget()); // GrInOrderDrawBuffer is no longer managing the refs/unrefs // for the stored GrDrawStates fStates[i].disableBehavior(GrDrawState::kTexturesNeedRef_BehaviorBit); } int numDraws = fDraws.count(); for (int d = 0; d < numDraws; ++d) { // we always have a VB, but not always an IB GrAssert(NULL != fDraws[d].fVertexBuffer); fDraws[d].fVertexBuffer->unref(); GrSafeUnref(fDraws[d].fIndexBuffer); } fDraws.reset(); fStates.reset(); fClears.reset(); fVertexPool.reset(); fIndexPool.reset(); fClips.reset(); this->resetDrawTracking(); }
void GrInOrderDrawBuffer::reset() { GrAssert(1 == fGeoPoolStateStack.count()); this->resetVertexSource(); this->resetIndexSource(); uint32_t numStates = fStates.count(); for (uint32_t i = 0; i < numStates; ++i) { const DrState& dstate = this->accessSavedDrawState(fStates[i]); for (int s = 0; s < kNumStages; ++s) { GrSafeUnref(dstate.fTextures[s]); } GrSafeUnref(dstate.fRenderTarget); } int numDraws = fDraws.count(); for (int d = 0; d < numDraws; ++d) { // we always have a VB, but not always an IB GrAssert(NULL != fDraws[d].fVertexBuffer); fDraws[d].fVertexBuffer->unref(); GrSafeUnref(fDraws[d].fIndexBuffer); } fDraws.reset(); fStates.reset(); fClears.reset(); fVertexPool.reset(); fIndexPool.reset(); fClips.reset(); fCurrQuad = 0; }
void GrInOrderDrawBuffer::reset() { GrAssert(1 == fGeoPoolStateStack.count()); this->resetVertexSource(); this->resetIndexSource(); int numDraws = fDraws.count(); for (int d = 0; d < numDraws; ++d) { // we always have a VB, but not always an IB GrAssert(NULL != fDraws[d].fVertexBuffer); fDraws[d].fVertexBuffer->unref(); GrSafeUnref(fDraws[d].fIndexBuffer); } fCmds.reset(); fDraws.reset(); fStencilPaths.reset(); fStates.reset(); fClears.reset(); fVertexPool.reset(); fIndexPool.reset(); fClips.reset(); fClipOrigins.reset(); fClipSet = true; this->resetDrawTracking(); // we start off with a default clip and state so that we don't have // to do count checks on fClips, fStates, or fCmds before checking their // last entry. this->recordDefaultState(); this->recordDefaultClip(); }
GrAtlasMgr::~GrAtlasMgr() { for (size_t i = 0; i < GR_ARRAY_COUNT(fTexture); i++) { GrSafeUnref(fTexture[i]); } delete fPlotMgr; fGpu->unref(); }
SharedGraphicsContext3D::~SharedGraphicsContext3D() { m_context->deleteBuffer(m_quadVertices); allContexts()->remove(this); #if USE(SKIA) GrSafeUnref(m_grContext); #endif }
GraphicsContext3DPrivate::~GraphicsContext3DPrivate() { #if USE(SKIA) if (m_grContext) { m_grContext->contextDestroyed(); GrSafeUnref(m_grContext); } #endif }
SkGrPixelRef::~SkGrPixelRef() { if (fUnlock) { GrContext* context = fSurface->getContext(); GrTexture* texture = fSurface->asTexture(); if (NULL != context && NULL != texture) { context->unlockScratchTexture(texture); } } GrSafeUnref(fSurface); }
void GrInOrderDrawBuffer::setQuadIndexBuffer(const GrIndexBuffer* indexBuffer) { bool newIdxBuffer = fQuadIndexBuffer != indexBuffer; if (newIdxBuffer) { GrSafeUnref(fQuadIndexBuffer); fQuadIndexBuffer = indexBuffer; GrSafeRef(fQuadIndexBuffer); fCurrQuad = 0; fMaxQuads = (NULL == indexBuffer) ? 0 : indexBuffer->maxQuads(); } else { GrAssert((NULL == indexBuffer && 0 == fMaxQuads) || (indexBuffer->maxQuads() == fMaxQuads)); } }
static SkGrPixelRef* copyToTexturePixelRef(GrTexture* texture, SkBitmap::Config dstConfig, const SkIRect* subset) { if (NULL == texture) { return NULL; } GrContext* context = texture->getContext(); if (NULL == context) { return NULL; } GrTextureDesc desc; SkIPoint pointStorage; SkIPoint* topLeft; if (subset != NULL) { SkASSERT(SkIRect::MakeWH(texture->width(), texture->height()).contains(*subset)); // Create a new texture that is the size of subset. desc.fWidth = subset->width(); desc.fHeight = subset->height(); pointStorage.set(subset->x(), subset->y()); topLeft = &pointStorage; } else { desc.fWidth = texture->width(); desc.fHeight = texture->height(); topLeft = NULL; } desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; desc.fConfig = SkBitmapConfig2GrPixelConfig(dstConfig); GrTexture* dst = context->createUncachedTexture(desc, NULL, 0); if (NULL == dst) { return NULL; } context->copyTexture(texture, dst->asRenderTarget(), topLeft); // TODO: figure out if this is responsible for Chrome canvas errors #if 0 // The render texture we have created (to perform the copy) isn't fully // functional (since it doesn't have a stencil buffer). Release it here // so the caller doesn't try to render to it. // TODO: we can undo this release when dynamic stencil buffer attach/ // detach has been implemented dst->releaseRenderTarget(); #endif SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (dst)); GrSafeUnref(dst); return pixelRef; }
void GrInOrderDrawBuffer::reset() { GrAssert(1 == fGeoPoolStateStack.count()); this->resetVertexSource(); this->resetIndexSource(); int numDraws = fDraws.count(); for (int d = 0; d < numDraws; ++d) { // we always have a VB, but not always an IB GrAssert(NULL != fDraws[d].fVertexBuffer); fDraws[d].fVertexBuffer->unref(); GrSafeUnref(fDraws[d].fIndexBuffer); } fCmds.reset(); fDraws.reset(); fStencilPaths.reset(); fStates.reset(); fClears.reset(); fVertexPool.reset(); fIndexPool.reset(); fClips.reset(); fClipOrigins.reset(); fClipSet = true; }
void GrGLRenderTarget::onRelease() { GPUGL->notifyRenderTargetDelete(this); if (fOwnIDs) { if (fTexFBOID) { GR_GL(DeleteFramebuffers(1, &fTexFBOID)); } if (fRTFBOID && fRTFBOID != fTexFBOID) { GR_GL(DeleteFramebuffers(1, &fRTFBOID)); } if (fStencilRenderbufferID) { GR_GL(DeleteRenderbuffers(1, &fStencilRenderbufferID)); } if (fMSColorRenderbufferID) { GR_GL(DeleteRenderbuffers(1, &fMSColorRenderbufferID)); } } fRTFBOID = 0; fTexFBOID = 0; fStencilRenderbufferID = 0; fMSColorRenderbufferID = 0; GrSafeUnref(fTexIDObj); fTexIDObj = NULL; }
GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { this->reset(); GrSafeUnref(fQuadIndexBuffer); }
SkGrRenderTargetPixelRef::~SkGrRenderTargetPixelRef() { GrSafeUnref(fRenderTarget); }
SkGrTexturePixelRef::~SkGrTexturePixelRef() { GrSafeUnref(fTexture); }
SkGrFontScaler::~SkGrFontScaler() { GrSafeUnref(fKey); }