OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 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 #ifndef GrTextureProxy_DEFINED |
| 9 #define GrTextureProxy_DEFINED |
| 10 |
| 11 #include "GrSurfaceProxy.h" |
| 12 #include "GrTexture.h" |
| 13 |
| 14 class GrTextureProvider; |
| 15 |
| 16 // This class delays the acquisition of textures until they are actually require
d |
| 17 class GrTextureProxy : public GrSurfaceProxy { |
| 18 public: |
| 19 // TODO: need to refine ownership semantics of 'srcData' if we're in complet
ely |
| 20 // deferred mode |
| 21 static sk_sp<GrTextureProxy> Make(const GrSurfaceDesc&, SkBackingFit, SkBudg
eted, |
| 22 const void* srcData = nullptr, size_t rowB
ytes = 0); |
| 23 static sk_sp<GrTextureProxy> Make(sk_sp<GrTexture>); |
| 24 |
| 25 // TODO: add asRenderTargetProxy variants |
| 26 GrTextureProxy* asTextureProxy() override { return this; } |
| 27 const GrTextureProxy* asTextureProxy() const override { return this; } |
| 28 |
| 29 // Actually instantiate the backing texture, if necessary |
| 30 GrTexture* instantiate(GrTextureProvider* texProvider); |
| 31 |
| 32 private: |
| 33 GrTextureProxy(const GrSurfaceDesc& desc, SkBackingFit fit, SkBudgeted budge
ted, |
| 34 const void* /*srcData*/, size_t /*rowBytes*/) |
| 35 : INHERITED(desc, fit, budgeted) { |
| 36 // TODO: Handle 'srcData' here |
| 37 } |
| 38 |
| 39 // Wrapped version |
| 40 GrTextureProxy(sk_sp<GrTexture> tex); |
| 41 |
| 42 // For wrapped textures we store it here. |
| 43 // For deferred proxies we will fill this in when we need to instantiate the
deferred resource |
| 44 sk_sp<GrTexture> fTexture; |
| 45 |
| 46 typedef GrSurfaceProxy INHERITED; |
| 47 }; |
| 48 |
| 49 #endif |
OLD | NEW |