Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Unified Diff: src/gpu/GrTexture.cpp

Issue 13814015: Reland of 8525 with fix for case when GrRT outlives GrTexture. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrTexture.cpp
===================================================================
--- src/gpu/GrTexture.cpp (revision 8570)
+++ src/gpu/GrTexture.cpp (working copy)
@@ -17,6 +17,12 @@
SK_DEFINE_INST_COUNT(GrTexture)
+GrTexture::~GrTexture() {
bsalomon 2013/04/09 13:38:27 This was added to the original change.
+ if (NULL != fRenderTarget.get()) {
+ fRenderTarget.get()->owningTextureDestroyed();
+ }
+}
+
/**
* This method allows us to interrupt the normal deletion process and place
* textures back in the texture cache when their ref count goes to zero.
@@ -67,33 +73,15 @@
pixelOpsFlags);
}
-void GrTexture::releaseRenderTarget() {
- if (NULL != fRenderTarget) {
- GrAssert(fRenderTarget->asTexture() == this);
- GrAssert(fDesc.fFlags & kRenderTarget_GrTextureFlagBit);
-
- fRenderTarget->onTextureReleaseRenderTarget();
- fRenderTarget->unref();
- fRenderTarget = NULL;
-
- fDesc.fFlags = fDesc.fFlags &
- ~(kRenderTarget_GrTextureFlagBit|kNoStencil_GrTextureFlagBit);
- fDesc.fSampleCnt = 0;
- }
-}
-
void GrTexture::onRelease() {
GrAssert(!this->isSetFlag((GrTextureFlags) kReturnToCache_FlagBit));
- this->releaseRenderTarget();
-
INHERITED::onRelease();
}
void GrTexture::onAbandon() {
- if (NULL != fRenderTarget) {
+ if (NULL != fRenderTarget.get()) {
fRenderTarget->abandon();
}
-
INHERITED::onAbandon();
}
« include/gpu/GrRenderTarget.h ('K') | « src/gpu/GrGpu.h ('k') | src/gpu/gl/GrGLTexture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698