1 /*
2  * Copyright 2018 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 GrRenderTargetProxyPriv_DEFINED
9 #define GrRenderTargetProxyPriv_DEFINED
10 
11 #include "GrRenderTargetProxy.h"
12 
13 /**
14  * This class hides the more specialized capabilities of GrRenderTargetProxy.
15  */
16 class GrRenderTargetProxyPriv {
17 public:
18     void setGLRTFBOIDIs0() {
19         fRenderTargetProxy->setGLRTFBOIDIs0();
20     }
21 
22     bool glRTFBOIDIs0() const {
23         return fRenderTargetProxy->glRTFBOIDIs0();
24     }
25 
26 private:
27     explicit GrRenderTargetProxyPriv(GrRenderTargetProxy* renderTargetProxy)
28             : fRenderTargetProxy(renderTargetProxy) {}
29     GrRenderTargetProxyPriv(const GrRenderTargetProxyPriv&) {} // unimpl
30     GrRenderTargetProxyPriv& operator=(const GrRenderTargetProxyPriv&); // unimpl
31 
32     // No taking addresses of this type.
33     const GrRenderTargetProxyPriv* operator&() const;
34     GrRenderTargetProxyPriv* operator&();
35 
36     GrRenderTargetProxy* fRenderTargetProxy;
37 
38     friend class GrRenderTargetProxy;  // to construct/copy this type.
39 };
40 
41 inline GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() {
42     return GrRenderTargetProxyPriv(this);
43 }
44 
45 inline const GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() const {
46     return GrRenderTargetProxyPriv(const_cast<GrRenderTargetProxy*>(this));
47 }
48 
49 #endif
50 
51