Greg Daniel | a070ed7 | 2018-04-26 16:31:38 -0400 | [diff] [blame] | 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 | |
Greg Daniel | f91aeb2 | 2019-06-18 09:58:02 -0400 | [diff] [blame] | 11 | #include "src/gpu/GrRenderTargetProxy.h" |
Greg Daniel | a070ed7 | 2018-04-26 16:31:38 -0400 | [diff] [blame] | 12 | |
| 13 | /** |
| 14 | * This class hides the more specialized capabilities of GrRenderTargetProxy. |
| 15 | */ |
| 16 | class GrRenderTargetProxyPriv { |
| 17 | public: |
| 18 | void setGLRTFBOIDIs0() { |
Chris Dalton | 3f7932e | 2019-08-19 00:39:13 -0600 | [diff] [blame] | 19 | // FBO0 should never be wrapped as a texture render target. |
| 20 | SkASSERT(!fRenderTargetProxy->requiresManualMSAAResolve()); |
| 21 | SkASSERT(!fRenderTargetProxy->asTextureProxy()); |
Greg Daniel | a070ed7 | 2018-04-26 16:31:38 -0400 | [diff] [blame] | 22 | fRenderTargetProxy->setGLRTFBOIDIs0(); |
| 23 | } |
| 24 | |
| 25 | bool glRTFBOIDIs0() const { |
| 26 | return fRenderTargetProxy->glRTFBOIDIs0(); |
| 27 | } |
| 28 | |
| 29 | private: |
| 30 | explicit GrRenderTargetProxyPriv(GrRenderTargetProxy* renderTargetProxy) |
| 31 | : fRenderTargetProxy(renderTargetProxy) {} |
| 32 | GrRenderTargetProxyPriv(const GrRenderTargetProxyPriv&) {} // unimpl |
| 33 | GrRenderTargetProxyPriv& operator=(const GrRenderTargetProxyPriv&); // unimpl |
| 34 | |
| 35 | // No taking addresses of this type. |
| 36 | const GrRenderTargetProxyPriv* operator&() const; |
| 37 | GrRenderTargetProxyPriv* operator&(); |
| 38 | |
| 39 | GrRenderTargetProxy* fRenderTargetProxy; |
| 40 | |
| 41 | friend class GrRenderTargetProxy; // to construct/copy this type. |
| 42 | }; |
| 43 | |
| 44 | inline GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() { |
| 45 | return GrRenderTargetProxyPriv(this); |
| 46 | } |
| 47 | |
| 48 | inline const GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() const { |
| 49 | return GrRenderTargetProxyPriv(const_cast<GrRenderTargetProxy*>(this)); |
| 50 | } |
| 51 | |
| 52 | #endif |
| 53 | |