summaryrefslogtreecommitdiffstats
path: root/gfx/skia/skia/src/gpu/GrRenderTargetProxyPriv.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--gfx/skia/skia/src/gpu/GrRenderTargetProxyPriv.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/gfx/skia/skia/src/gpu/GrRenderTargetProxyPriv.h b/gfx/skia/skia/src/gpu/GrRenderTargetProxyPriv.h
new file mode 100644
index 0000000000..091e4f2f5b
--- /dev/null
+++ b/gfx/skia/skia/src/gpu/GrRenderTargetProxyPriv.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2018 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrRenderTargetProxyPriv_DEFINED
+#define GrRenderTargetProxyPriv_DEFINED
+
+#include "src/gpu/GrRenderTargetProxy.h"
+
+/**
+ * This class hides the more specialized capabilities of GrRenderTargetProxy.
+ */
+class GrRenderTargetProxyPriv {
+public:
+ void setGLRTFBOIDIs0() {
+ // FBO0 should never be wrapped as a texture render target.
+ SkASSERT(!fRenderTargetProxy->requiresManualMSAAResolve());
+ SkASSERT(!fRenderTargetProxy->asTextureProxy());
+ fRenderTargetProxy->setGLRTFBOIDIs0();
+ }
+
+ bool glRTFBOIDIs0() const {
+ return fRenderTargetProxy->glRTFBOIDIs0();
+ }
+
+private:
+ explicit GrRenderTargetProxyPriv(GrRenderTargetProxy* renderTargetProxy)
+ : fRenderTargetProxy(renderTargetProxy) {}
+ GrRenderTargetProxyPriv(const GrRenderTargetProxyPriv&) {} // unimpl
+ GrRenderTargetProxyPriv& operator=(const GrRenderTargetProxyPriv&); // unimpl
+
+ // No taking addresses of this type.
+ const GrRenderTargetProxyPriv* operator&() const;
+ GrRenderTargetProxyPriv* operator&();
+
+ GrRenderTargetProxy* fRenderTargetProxy;
+
+ friend class GrRenderTargetProxy; // to construct/copy this type.
+};
+
+inline GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() {
+ return GrRenderTargetProxyPriv(this);
+}
+
+inline const GrRenderTargetProxyPriv GrRenderTargetProxy::rtPriv() const {
+ return GrRenderTargetProxyPriv(const_cast<GrRenderTargetProxy*>(this));
+}
+
+#endif
+