2 * Copyright 2014 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
9 #ifndef GrGLTextureRenderTarget_DEFINED
10 #define GrGLTextureRenderTarget_DEFINED
12 #include "GrGLTexture.h"
13 #include "GrGLRenderTarget.h"
17 #ifdef SK_BUILD_FOR_WIN
18 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via dominance.
20 #pragma warning(disable: 4250)
23 class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget {
25 // We're virtually derived from GrSurface (via both GrGLTexture and GrGLRenderTarget) so its
26 // constructor must be explicitly called.
27 GrGLTextureRenderTarget(GrGLGpu* gpu,
28 const GrSurfaceDesc& desc,
29 const GrGLTexture::IDDesc& texIDDesc,
30 const GrGLRenderTarget::IDDesc& rtIDDesc)
31 : GrSurface(gpu, texIDDesc.fLifeCycle, desc)
32 , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived)
33 , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) {
34 this->registerWithCache();
38 void onAbandon() SK_OVERRIDE {
39 GrGLRenderTarget::onAbandon();
40 GrGLTexture::onAbandon();
43 void onRelease() SK_OVERRIDE {
44 GrGLRenderTarget::onRelease();
45 GrGLTexture::onRelease();
49 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuffer's memory.
50 size_t onGpuMemorySize() const SK_OVERRIDE {
51 return GrGLRenderTarget::onGpuMemorySize();
56 #ifdef SK_BUILD_FOR_WIN