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 "src/gpu/GrRenderTargetProxy.h"
12
13/**
14 * This class hides the more specialized capabilities of GrRenderTargetProxy.
15 */
16class GrRenderTargetProxyPriv {
17public:
18 void setGLRTFBOIDIs0() {
19 // FBO0 should never be wrapped as a texture render target.
20 SkASSERT(!fRenderTargetProxy->requiresManualMSAAResolve());
21 SkASSERT(!fRenderTargetProxy->asTextureProxy());
22 fRenderTargetProxy->setGLRTFBOIDIs0();
23 }
24
25 bool glRTFBOIDIs0() const {
26 return fRenderTargetProxy->glRTFBOIDIs0();
27 }
28
29private:
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
44inline GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() {
45 return GrRenderTargetProxyPriv(this);
46}
47
48inline const GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() const {
49 return GrRenderTargetProxyPriv(const_cast<GrRenderTargetProxy*>(this));
50}
51
52#endif
53
54