Add class GrGLTextureRenderTarget for GL texture/rendertarget objects
BUG=skia:2889
Review URL: https://codereview.chromium.org/695813003
diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h
index b8e30d9..e0f1199 100644
--- a/include/gpu/GrRenderTarget.h
+++ b/include/gpu/GrRenderTarget.h
@@ -12,36 +12,21 @@
#include "SkRect.h"
class GrStencilBuffer;
-class GrTexture;
/**
* GrRenderTarget represents a 2D buffer of pixels that can be rendered to.
* A context's render target is set by setRenderTarget(). Render targets are
- * created by a createTexture with the kRenderTarget_TextureFlag flag.
+ * created by a createTexture with the kRenderTarget_SurfaceFlag flag.
* Additionally, GrContext provides methods for creating GrRenderTargets
* that wrap externally created render targets.
*/
-class GrRenderTarget : public GrSurface {
+class GrRenderTarget : virtual public GrSurface {
public:
SK_DECLARE_INST_COUNT(GrRenderTarget)
- // GrResource overrides
- virtual size_t gpuMemorySize() const SK_OVERRIDE;
-
// GrSurface overrides
- /**
- * @return the texture associated with the render target, may be NULL.
- */
- virtual GrTexture* asTexture() SK_OVERRIDE { return fTexture; }
- virtual const GrTexture* asTexture() const SK_OVERRIDE { return fTexture; }
-
- /**
- * @return this render target.
- */
virtual GrRenderTarget* asRenderTarget() SK_OVERRIDE { return this; }
- virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE {
- return this;
- }
+ virtual const GrRenderTarget* asRenderTarget() const SK_OVERRIDE { return this; }
// GrRenderTarget
/**
@@ -134,11 +119,9 @@
protected:
GrRenderTarget(GrGpu* gpu,
bool isWrapped,
- GrTexture* texture,
const GrSurfaceDesc& desc)
: INHERITED(gpu, isWrapped, desc)
- , fStencilBuffer(NULL)
- , fTexture(texture) {
+ , fStencilBuffer(NULL) {
fResolveRect.setLargestInverted();
}
@@ -147,15 +130,7 @@
virtual void onRelease() SK_OVERRIDE;
private:
- friend class GrTexture;
- // called by ~GrTexture to remove the non-ref'ed back ptr.
- void owningTextureDestroyed() {
- SkASSERT(fTexture);
- fTexture = NULL;
- }
-
GrStencilBuffer* fStencilBuffer;
- GrTexture* fTexture; // not ref'ed
SkIRect fResolveRect;