Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: src/gpu/GrWindowRectangles.h

Issue 2312173002: Revert of Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrScissorState.h ('k') | src/gpu/GrWindowRectsState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrWindowRectangles.h
diff --git a/src/gpu/GrWindowRectangles.h b/src/gpu/GrWindowRectangles.h
index 076c40d7a4557692e517d2393a23bc1280123019..b2f6e1ab4ad2f80ea216820dc3b6714334acb798 100644
--- a/src/gpu/GrWindowRectangles.h
+++ b/src/gpu/GrWindowRectangles.h
@@ -15,15 +15,21 @@
public:
constexpr static int kMaxWindows = 8;
- GrWindowRectangles() : fCount(0) {}
+ enum class Mode : bool {
+ kExclusive,
+ kInclusive
+ };
+
+ GrWindowRectangles(Mode mode = Mode::kExclusive) : fMode(mode), fCount(0) {}
GrWindowRectangles(const GrWindowRectangles& that) : fCount(0) { *this = that; }
~GrWindowRectangles() { SkSafeUnref(this->rec()); }
- bool empty() const { return !fCount; }
+ Mode mode() const { return fMode; }
int count() const { return fCount; }
+ bool disabled() const { return Mode::kExclusive == fMode && !fCount; }
const SkIRect* data() const;
- void reset();
+ void reset(Mode = Mode::kExclusive);
GrWindowRectangles& operator=(const GrWindowRectangles&);
SkIRect& addWindow(const SkIRect& window) { return this->addWindow() = window; }
@@ -38,7 +44,8 @@
const Rec* rec() const { return fCount <= kNumLocalWindows ? nullptr : fRec; }
- int fCount;
+ Mode fMode;
+ uint8_t fCount;
union {
SkIRect fLocalWindows[kNumLocalWindows]; // If fCount <= kNumLocalWindows.
Rec* fRec; // If fCount > kNumLocalWindows.
@@ -58,13 +65,15 @@
return fCount <= kNumLocalWindows ? fLocalWindows : fRec->fData;
}
-inline void GrWindowRectangles::reset() {
+inline void GrWindowRectangles::reset(Mode mode) {
SkSafeUnref(this->rec());
+ fMode = mode;
fCount = 0;
}
inline GrWindowRectangles& GrWindowRectangles::operator=(const GrWindowRectangles& that) {
SkSafeUnref(this->rec());
+ fMode = that.fMode;
fCount = that.fCount;
if (fCount <= kNumLocalWindows) {
memcpy(fLocalWindows, that.fLocalWindows, fCount * sizeof(SkIRect));
@@ -89,7 +98,7 @@
}
inline bool GrWindowRectangles::operator==(const GrWindowRectangles& that) const {
- if (fCount != that.fCount) {
+ if (fMode != that.fMode || fCount != that.fCount) {
return false;
}
if (fCount > kNumLocalWindows && fRec == that.fRec) {
« no previous file with comments | « src/gpu/GrScissorState.h ('k') | src/gpu/GrWindowRectsState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698