• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 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 GrTextureProxyPriv_DEFINED
9 #define GrTextureProxyPriv_DEFINED
10 
11 #include "GrTextureProxy.h"
12 
13 class GrDeferredProxyUploader;
14 class GrOpFlushState;
15 
16 /**
17  * This class hides the more specialized capabilities of GrTextureProxy.
18  */
19 class GrTextureProxyPriv {
20 public:
21     // Attach a deferred uploader to the proxy. Holds data being prepared by a worker thread.
22     void setDeferredUploader(std::unique_ptr<GrDeferredProxyUploader>);
isDeferred()23     bool isDeferred() const { return SkToBool(fTextureProxy->fDeferredUploader.get()); }
24     // For a deferred proxy (one that has a deferred uploader attached), this schedules an ASAP
25     // upload of that data to the instantiated texture.
26     void scheduleUpload(GrOpFlushState*);
27     // Clears any deferred uploader object on the proxy. Used to free the CPU data after the
28     // contents have been uploaded.
29     void resetDeferredUploader();
30     // Returns the GrMipMapped value of the proxy from creation time regardless of whether it has
31     // been instantiated or not.
proxyMipMapped()32     GrMipMapped proxyMipMapped() const { return fTextureProxy->fMipMapped; }
33 
34 private:
GrTextureProxyPriv(GrTextureProxy * textureProxy)35     explicit GrTextureProxyPriv(GrTextureProxy* textureProxy) : fTextureProxy(textureProxy) {}
GrTextureProxyPriv(const GrTextureProxyPriv &)36     GrTextureProxyPriv(const GrTextureProxyPriv&) {} // unimpl
37     GrTextureProxyPriv& operator=(const GrTextureProxyPriv&); // unimpl
38 
39     // No taking addresses of this type.
40     const GrTextureProxyPriv* operator&() const;
41     GrTextureProxyPriv* operator&();
42 
43     GrTextureProxy* fTextureProxy;
44 
45     friend class GrTextureProxy;  // to construct/copy this type.
46 };
47 
texPriv()48 inline GrTextureProxyPriv GrTextureProxy::texPriv() { return GrTextureProxyPriv(this); }
49 
texPriv()50 inline const GrTextureProxyPriv GrTextureProxy::texPriv() const {
51     return GrTextureProxyPriv(const_cast<GrTextureProxy*>(this));
52 }
53 
54 #endif
55