aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrFixedClip.h
diff options
context:
space:
mode:
authorGravatar csmartdalton <csmartdalton@google.com>2016-08-19 13:29:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-08-19 13:29:27 -0700
commit02fa32c6d1ef4b7b05aa06df8be4add42a1712d3 (patch)
treeba662b2b0c881a0b4f86f0de97942651eded6d6c /src/gpu/GrFixedClip.h
parent3688bfa710d4519c2d306a76bf5500481c1d1559 (diff)
Move GrFixedClip into src directory
Diffstat (limited to 'src/gpu/GrFixedClip.h')
-rw-r--r--src/gpu/GrFixedClip.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/gpu/GrFixedClip.h b/src/gpu/GrFixedClip.h
new file mode 100644
index 0000000000..01498c1161
--- /dev/null
+++ b/src/gpu/GrFixedClip.h
@@ -0,0 +1,50 @@
+/*
+ * 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 GrFixedClip_DEFINED
+#define GrFixedClip_DEFINED
+
+#include "GrClip.h"
+#include "GrTypesPriv.h"
+
+/**
+ * GrFixedClip is a clip that can be represented by fixed-function hardware. It never modifies the
+ * stencil buffer itself, but can be configured to use whatever clip is already there.
+ */
+class GrFixedClip final : public GrClip {
+public:
+ GrFixedClip() : fHasStencilClip(false) {}
+ GrFixedClip(const SkIRect& scissorRect)
+ : fScissorState(scissorRect)
+ , fHasStencilClip(false) {}
+
+ void reset() {
+ fScissorState.setDisabled();
+ fHasStencilClip = false;
+ }
+
+ void reset(const SkIRect& scissorRect) {
+ fScissorState.set(scissorRect);
+ fHasStencilClip = false;
+ }
+
+ void enableStencilClip() { fHasStencilClip = true; }
+ void disableStencilClip() { fHasStencilClip = false; }
+
+ bool quickContains(const SkRect&) const final;
+ void getConservativeBounds(int width, int height, SkIRect* devResult,
+ bool* isIntersectionOfRects) const final;
+
+private:
+ bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings,
+ GrAppliedClip* out) const final;
+
+ GrScissorState fScissorState;
+ bool fHasStencilClip;
+};
+
+#endif