OLD | NEW |
(Empty) | |
| 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 GrGpuGL; |
| 16 |
| 17 #ifdef SK_BUILD_FOR_WIN |
| 18 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do
minance. |
| 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 GrGLRend
erTarget) so its |
| 26 // constructor must be explicitly called. |
| 27 GrGLTextureRenderTarget(GrGpuGL* gpu, |
| 28 const GrSurfaceDesc& desc, |
| 29 const GrGLTexture::IDDesc& texIDDesc, |
| 30 const GrGLRenderTarget::IDDesc& rtIDDesc) |
| 31 : GrSurface(gpu, texIDDesc.fIsWrapped, desc) |
| 32 , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived) |
| 33 , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) { |
| 34 this->registerWithCache(); |
| 35 } |
| 36 |
| 37 virtual ~GrGLTextureRenderTarget() { this->release(); } |
| 38 |
| 39 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuf
fer's memory. |
| 40 virtual size_t gpuMemorySize() const SK_OVERRIDE { return GrGLRenderTarget::
gpuMemorySize(); } |
| 41 |
| 42 protected: |
| 43 virtual void onAbandon() SK_OVERRIDE { |
| 44 GrGLRenderTarget::onAbandon(); |
| 45 GrGLTexture::onAbandon(); |
| 46 } |
| 47 |
| 48 virtual void onRelease() SK_OVERRIDE { |
| 49 GrGLRenderTarget::onRelease(); |
| 50 GrGLTexture::onRelease(); |
| 51 } |
| 52 }; |
| 53 |
| 54 #ifdef SK_BUILD_FOR_WIN |
| 55 #pragma warning(pop) |
| 56 #endif |
| 57 |
| 58 #endif |
OLD | NEW |