aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrDrawContextPriv.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-03-02 09:26:36 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-02 09:26:36 -0800
commit391395dcfbff09a83f8f0e9d3e02d38c855ae2e9 (patch)
tree8f03364d3b4939642a597834f7929dce98c7d2b8 /src/gpu/GrDrawContextPriv.h
parent855bd4415c1a26950e946cc2f8756f7e03b61637 (diff)
Begin weaning GrClipMaskManager off of GrDrawTarget (take 2)
Diffstat (limited to 'src/gpu/GrDrawContextPriv.h')
-rw-r--r--src/gpu/GrDrawContextPriv.h60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/gpu/GrDrawContextPriv.h b/src/gpu/GrDrawContextPriv.h
new file mode 100644
index 0000000000..935b631a26
--- /dev/null
+++ b/src/gpu/GrDrawContextPriv.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrDrawContextPriv_DEFINED
+#define GrDrawContextPriv_DEFINED
+
+#include "GrDrawContext.h"
+
+class GrStencilSettings;
+
+/** Class that adds methods to GrDrawContext that are only intended for use internal to Skia.
+ This class is purely a privileged window into GrDrawContext. It should never have additional
+ data members or virtual methods. */
+class GrDrawContextPriv {
+public:
+ bool drawAndStencilRect(const SkIRect* scissorRect,
+ const GrStencilSettings&,
+ SkRegion::Op op,
+ bool invert,
+ bool doAA,
+ const SkMatrix& viewMatrix,
+ const SkRect&);
+
+ bool drawAndStencilPath(const SkIRect* scissorRect,
+ const GrStencilSettings&,
+ SkRegion::Op op,
+ bool invert,
+ bool doAA,
+ const SkMatrix& viewMatrix,
+ const SkPath&);
+
+ void testingOnly_drawBatch(const GrPipelineBuilder& pipelineBuilder,
+ GrDrawBatch* batch);
+
+private:
+ explicit GrDrawContextPriv(GrDrawContext* drawContext) : fDrawContext(drawContext) {}
+ GrDrawContextPriv(const GrRenderTargetPriv&) {} // unimpl
+ GrDrawContextPriv& operator=(const GrRenderTargetPriv&); // unimpl
+
+ // No taking addresses of this type.
+ const GrDrawContextPriv* operator&() const;
+ GrDrawContextPriv* operator&();
+
+ GrDrawContext* fDrawContext;
+
+ friend class GrDrawContext; // to construct/copy this type.
+};
+
+inline GrDrawContextPriv GrDrawContext::drawContextPriv() { return GrDrawContextPriv(this); }
+
+inline const GrDrawContextPriv GrDrawContext::drawContextPriv () const {
+ return GrDrawContextPriv(const_cast<GrDrawContext*>(this));
+}
+
+#endif
+