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

Unified Diff: include/gpu/GrTexture.h

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: include/gpu/GrTexture.h
===================================================================
--- include/gpu/GrTexture.h (revision 8570)
+++ include/gpu/GrTexture.h (working copy)
@@ -11,8 +11,8 @@
#include "GrSurface.h"
#include "SkPoint.h"
+#include "GrRenderTarget.h"
-class GrRenderTarget;
class GrResourceKey;
class GrTextureParams;
@@ -80,10 +80,10 @@
* render target
*/
virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE {
- return fRenderTarget;
+ return fRenderTarget.get();
}
virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE {
- return fRenderTarget;
+ return fRenderTarget.get();
}
// GrTexture
@@ -101,13 +101,6 @@
}
/**
- * Removes the reference on the associated GrRenderTarget held by this
- * texture. Afterwards asRenderTarget() will return NULL. The
- * GrRenderTarget survives the release if another ref is held on it.
- */
- void releaseRenderTarget();
-
- /**
* Return the native ID or handle to the texture, depending on the
* platform. e.g. on OpenGL, return the texture ID.
*/
@@ -137,9 +130,9 @@
static bool NeedsFiltering(const GrResourceKey& key);
protected:
- GrRenderTarget* fRenderTarget; // texture refs its rt representation
- // base class cons sets to NULL
- // subclass cons can create and set
+ // A texture refs its rt representation but not vice-versa. It is up to
+ // the subclass constructor to initialize this pointer.
+ SkAutoTUnref<GrRenderTarget> fRenderTarget;
GrTexture(GrGpu* gpu, bool isWrapped, const GrTextureDesc& desc)
: INHERITED(gpu, isWrapped, desc)
@@ -149,6 +142,7 @@
fShiftFixedX = 31 - SkCLZ(fDesc.fWidth);
fShiftFixedY = 31 - SkCLZ(fDesc.fHeight);
}
+ virtual ~GrTexture();
// GrResource overrides
virtual void onRelease() SK_OVERRIDE;

Powered by Google App Engine
This is Rietveld 408576698