Remove GrTexture::releaseRenderTarget() and add GrSurface::isSameAs().
Review URL: https://codereview.chromium.org/13414006
git-svn-id: http://skia.googlecode.com/svn/trunk@8525 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrTexture.h b/include/gpu/GrTexture.h
index 5d8ecaa..52253ed 100644
--- a/include/gpu/GrTexture.h
+++ b/include/gpu/GrTexture.h
@@ -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)