aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrScissorState.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrScissorState.h')
-rw-r--r--src/gpu/GrScissorState.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gpu/GrScissorState.h b/src/gpu/GrScissorState.h
index 59ea088078..a395aef7ac 100644
--- a/src/gpu/GrScissorState.h
+++ b/src/gpu/GrScissorState.h
@@ -8,32 +8,29 @@
#ifndef GrScissorState_DEFINED
#define GrScissorState_DEFINED
-#include "SkRect.h"
-
class GrScissorState {
public:
- GrScissorState() : fEnabled(false) {}
- GrScissorState(const SkIRect& rect) : fEnabled(true), fRect(rect) {}
- void setDisabled() { fEnabled = false; }
- void set(const SkIRect& rect) { fRect = rect; fEnabled = true; }
+ GrScissorState() = default;
+ GrScissorState(const SkIRect& rect) : fScissorTest(GrScissorTest::kEnabled), fRect(rect) {}
+ void setDisabled() { fScissorTest = GrScissorTest::kDisabled; }
bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& rect) {
- if (!fEnabled) {
- this->set(rect);
+ if (fScissorTest == GrScissorTest::kDisabled) {
+ *this = GrScissorState(rect);
return true;
}
return fRect.intersect(rect);
}
bool operator==(const GrScissorState& other) const {
- return fEnabled == other.fEnabled &&
- (false == fEnabled || fRect == other.fRect);
+ return fScissorTest == other.fScissorTest &&
+ (fScissorTest == GrScissorTest::kDisabled || fRect == other.fRect);
}
bool operator!=(const GrScissorState& other) const { return !(*this == other); }
- bool enabled() const { return fEnabled; }
+ GrScissorTest scissorTest() const { return fScissorTest; }
const SkIRect& rect() const { return fRect; }
private:
- bool fEnabled;
+ GrScissorTest fScissorTest = GrScissorTest::kDisabled;
SkIRect fRect;
};