• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GrCaps;
15 class GrResourceProvider;
16 class GrTextureOpList;
17 
18 // This class delays the acquisition of textures until they are actually required
19 class GrTextureProxy : virtual public GrSurfaceProxy {
20 public:
asTextureProxy()21     GrTextureProxy* asTextureProxy() override { return this; }
asTextureProxy()22     const GrTextureProxy* asTextureProxy() const override { return this; }
23 
24     // Actually instantiate the backing texture, if necessary
25     GrTexture* instantiate(GrResourceProvider*);
26 
27     void setMipColorMode(SkDestinationSurfaceColorMode colorMode);
28 
29 protected:
30     friend class GrSurfaceProxy; // for ctors
31 
32     // Deferred version
33     GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit, SkBudgeted,
34                    const void* srcData, size_t srcRowBytes, uint32_t flags);
35     // Wrapped version
36     GrTextureProxy(sk_sp<GrSurface>);
37 
38 private:
39     size_t onGpuMemorySize() const override;
40 
41     // For wrapped proxies the GrTexture pointer is stored in GrIORefProxy.
42     // For deferred proxies that pointer will be filled in when we need to instantiate
43     // the deferred resource
44 
45     typedef GrSurfaceProxy INHERITED;
46 };
47 
48 #endif
49