| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #ifndef GrGLTextureRenderTarget_DEFINED | 9 #ifndef GrGLTextureRenderTarget_DEFINED |
| 10 #define GrGLTextureRenderTarget_DEFINED | 10 #define GrGLTextureRenderTarget_DEFINED |
| 11 | 11 |
| 12 #include "GrGLGpu.h" | 12 #include "GrGLGpu.h" |
| 13 #include "GrGLTexture.h" | 13 #include "GrGLTexture.h" |
| 14 #include "GrGLRenderTarget.h" | 14 #include "GrGLRenderTarget.h" |
| 15 | 15 |
| 16 class GrGLGpu; | 16 class GrGLGpu; |
| 17 | 17 |
| 18 #ifdef SK_BUILD_FOR_WIN | 18 #ifdef SK_BUILD_FOR_WIN |
| 19 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do
minance. | 19 // Windows gives bogus warnings about inheriting asTexture/asRenderTarget via do
minance. |
| 20 #pragma warning(push) | 20 #pragma warning(push) |
| 21 #pragma warning(disable: 4250) | 21 #pragma warning(disable: 4250) |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget { | 24 class GrGLTextureRenderTarget : public GrGLTexture, public GrGLRenderTarget { |
| 25 public: | 25 public: |
| 26 // We're virtually derived from GrSurface (via both GrGLTexture and GrGLRend
erTarget) so its | 26 // We're virtually derived from GrSurface (via both GrGLTexture and GrGLRend
erTarget) so its |
| 27 // constructor must be explicitly called. | 27 // constructor must be explicitly called. |
| 28 GrGLTextureRenderTarget(GrGLGpu* gpu, | 28 GrGLTextureRenderTarget(GrGLGpu* gpu, |
| 29 SkBudgeted budgeted, |
| 29 const GrSurfaceDesc& desc, | 30 const GrSurfaceDesc& desc, |
| 30 const GrGLTexture::IDDesc& texIDDesc, | 31 const GrGLTexture::IDDesc& texIDDesc, |
| 31 const GrGLRenderTarget::IDDesc& rtIDDesc) | 32 const GrGLRenderTarget::IDDesc& rtIDDesc) |
| 32 : GrSurface(gpu, texIDDesc.fLifeCycle, desc) | 33 : GrSurface(gpu, desc) |
| 33 , GrGLTexture(gpu, desc, texIDDesc, GrGLTexture::kDerived) | 34 , GrGLTexture(gpu, desc, texIDDesc) |
| 34 , GrGLRenderTarget(gpu, desc, rtIDDesc, GrGLRenderTarget::kDerived) { | 35 , GrGLRenderTarget(gpu, desc, rtIDDesc) { |
| 35 this->registerWithCache(); | 36 this->registerWithCache(budgeted); |
| 36 } | 37 } |
| 37 | 38 |
| 38 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override
; | 39 void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override
; |
| 39 | 40 |
| 41 static GrGLTextureRenderTarget* CreateWrapped(GrGLGpu* gpu, const GrSurfaceD
esc& desc, |
| 42 const GrGLTexture::IDDesc& tex
IDDesc, |
| 43 const GrGLRenderTarget::IDDesc
& rtIDDesc); |
| 40 protected: | 44 protected: |
| 41 void onAbandon() override { | 45 void onAbandon() override { |
| 42 GrGLRenderTarget::onAbandon(); | 46 GrGLRenderTarget::onAbandon(); |
| 43 GrGLTexture::onAbandon(); | 47 GrGLTexture::onAbandon(); |
| 44 } | 48 } |
| 45 | 49 |
| 46 void onRelease() override { | 50 void onRelease() override { |
| 47 GrGLRenderTarget::onRelease(); | 51 GrGLRenderTarget::onRelease(); |
| 48 GrGLTexture::onRelease(); | 52 GrGLTexture::onRelease(); |
| 49 } | 53 } |
| 50 | 54 |
| 51 private: | 55 private: |
| 56 // Constructor for instances wrapping backend objects. |
| 57 GrGLTextureRenderTarget(GrGLGpu* gpu, |
| 58 const GrSurfaceDesc& desc, |
| 59 const GrGLTexture::IDDesc& texIDDesc, |
| 60 const GrGLRenderTarget::IDDesc& rtIDDesc) |
| 61 : GrSurface(gpu, desc) |
| 62 , GrGLTexture(gpu, desc, texIDDesc) |
| 63 , GrGLRenderTarget(gpu, desc, rtIDDesc) { |
| 64 this->registerWithCacheWrapped(); |
| 65 } |
| 66 |
| 52 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuf
fer's memory. | 67 // GrGLRenderTarget accounts for the texture's memory and any MSAA renderbuf
fer's memory. |
| 53 size_t onGpuMemorySize() const override { | 68 size_t onGpuMemorySize() const override { |
| 54 return GrGLRenderTarget::onGpuMemorySize(); | 69 return GrGLRenderTarget::onGpuMemorySize(); |
| 55 } | 70 } |
| 56 | 71 |
| 57 }; | 72 }; |
| 58 | 73 |
| 59 #ifdef SK_BUILD_FOR_WIN | 74 #ifdef SK_BUILD_FOR_WIN |
| 60 #pragma warning(pop) | 75 #pragma warning(pop) |
| 61 #endif | 76 #endif |
| 62 | 77 |
| 63 #endif | 78 #endif |
| OLD | NEW |