aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLTextureRenderTarget.h
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-11-03 08:47:23 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-03 08:47:23 -0800
commit37dd331b20a92ce79cc26556e065dec98a66cb0b (patch)
treecac1c6927c1f8f9860890e37b9d08cca01de251b /src/gpu/gl/GrGLTextureRenderTarget.h
parent89a9ecef9ead1f6093e796173b28b82dca4adcbd (diff)
Add class GrGLTextureRenderTarget for GL texture/rendertarget objects
Diffstat (limited to 'src/gpu/gl/GrGLTextureRenderTarget.h')
-rw-r--r--src/gpu/gl/GrGLTextureRenderTarget.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.h b/src/gpu/gl/GrGLTextureRenderTarget.h
new file mode 100644
index 0000000000..55da28f6b8
--- /dev/null
+++ b/src/gpu/gl/GrGLTextureRenderTarget.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#ifndef GrGLTextureRenderTarget_DEFINED
+#define GrGLTextureRenderTarget_DEFINED
+
+#include "GrGLTexture.h"
+#include "GrGLRenderTarget.h"
+
+class GrGpuGL;
+
+#ifdef SK_BUILD_FOR_WIN
+// Windows gives bogus warnings about inheriting asTexture/asRenderTarget via dominance.
+#pragma warning(push)
+#pragma warning(disable: 4250)
+#endif
+
+class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget {
+public:
+ // We're virtually derived from GrSurface (via both GrGLTexture and GrGLRenderTarget) so its
+ // constructor must be explicitly called.
+ GrGLTextureRenderTarget(GrGpuGL* gpu,
+ const GrSurfaceDesc& desc,
+ const GrGLTexture::IDDesc& texIDDesc,
+ const GrGLRenderTarget::IDDesc& rtIDDesc)
+ : GrSurface(gpu, texIDDesc.fIsWrapped, desc)
+ , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived)
+ , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) {
+ this->registerWithCache();
+ }
+
+ virtual ~GrGLTextureRenderTarget() { this->release(); }
+
+ // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory.
+ virtual size_t gpuMemorySize() const SK_OVERRIDE { return GrGLRenderTarget::gpuMemorySize(); }
+
+protected:
+ virtual void onAbandon() SK_OVERRIDE {
+ GrGLRenderTarget::onAbandon();
+ GrGLTexture::onAbandon();
+ }
+
+ virtual void onRelease() SK_OVERRIDE {
+ GrGLRenderTarget::onRelease();
+ GrGLTexture::onRelease();
+ }
+};
+
+#ifdef SK_BUILD_FOR_WIN
+#pragma warning(pop)
+#endif
+
+#endif