1 /* 2 * Copyright 2014 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 9 #ifndef GrGLTextureRenderTarget_DEFINED 10 #define GrGLTextureRenderTarget_DEFINED 11 12 #include "GrGLTexture.h" 13 #include "GrGLRenderTarget.h" 14 15 class GrGLGpu; 16 17 #ifdef SK_BUILD_FOR_WIN 18 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via dominance. 19 #pragma warning(push) 20 #pragma warning(disable: 4250) 21 #endif 22 23 class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget { 24 public: 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 SkBudgeted budgeted, 29 const GrSurfaceDesc& desc, 30 const GrGLTexture::IDDesc& texIDDesc, 31 const GrGLRenderTarget::IDDesc& rtIDDesc, 32 bool wasMipMapDataProvided); 33 34 bool canAttemptStencilAttachment() const override; 35 36 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override; 37 38 static sk_sp<GrGLTextureRenderTarget> MakeWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc, 39 const GrGLTexture::IDDesc& texIDDesc, 40 const GrGLRenderTarget::IDDesc& rtIDDesc); 41 protected: 42 void onAbandon() override { 43 GrGLRenderTarget::onAbandon(); 44 GrGLTexture::onAbandon(); 45 } 46 47 void onRelease() override { 48 GrGLRenderTarget::onRelease(); 49 GrGLTexture::onRelease(); 50 } 51 52 private: 53 // Constructor for instances wrapping backend objects. 54 GrGLTextureRenderTarget(GrGLGpu* gpu, 55 const GrSurfaceDesc& desc, 56 const GrGLTexture::IDDesc& texIDDesc, 57 const GrGLRenderTarget::IDDesc& rtIDDesc, 58 bool wasMipMapDataProvided); 59 60 size_t onGpuMemorySize() const override; 61 }; 62 63 #ifdef SK_BUILD_FOR_WIN 64 #pragma warning(pop) 65 #endif 66 67 #endif 68