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

Unified Diff: src/gpu/GrWindowRectangles.h

Issue 2289363005: Improve usage of window rectangles (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_drawsinreducedclip
Patch Set: Improve usage of window rectangles 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 b2f6e1ab4ad2f80ea216820dc3b6714334acb798..076c40d7a4557692e517d2393a23bc1280123019 100644
--- a/src/gpu/GrWindowRectangles.h
+++ b/src/gpu/GrWindowRectangles.h
@@ -15,21 +15,15 @@ class GrWindowRectangles {
public:
constexpr static int kMaxWindows = 8;
- enum class Mode : bool {
- kExclusive,
- kInclusive
- };
-
- GrWindowRectangles(Mode mode = Mode::kExclusive) : fMode(mode), fCount(0) {}
+ GrWindowRectangles() : fCount(0) {}
GrWindowRectangles(const GrWindowRectangles& that) : fCount(0) { *this = that; }
~GrWindowRectangles() { SkSafeUnref(this->rec()); }
- Mode mode() const { return fMode; }
+ bool empty() const { return !fCount; }
int count() const { return fCount; }
- bool disabled() const { return Mode::kExclusive == fMode && !fCount; }
const SkIRect* data() const;
- void reset(Mode = Mode::kExclusive);
+ void reset();
GrWindowRectangles& operator=(const GrWindowRectangles&);
SkIRect& addWindow(const SkIRect& window) { return this->addWindow() = window; }
@@ -44,8 +38,7 @@ private:
const Rec* rec() const { return fCount <= kNumLocalWindows ? nullptr : fRec; }
- Mode fMode;
- uint8_t fCount;
+ int fCount;
union {
SkIRect fLocalWindows[kNumLocalWindows]; // If fCount <= kNumLocalWindows.
Rec* fRec; // If fCount > kNumLocalWindows.
@@ -65,15 +58,13 @@ inline const SkIRect* GrWindowRectangles::data() const {
return fCount <= kNumLocalWindows ? fLocalWindows : fRec->fData;
}
-inline void GrWindowRectangles::reset(Mode mode) {
+inline void GrWindowRectangles::reset() {
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));
@@ -98,7 +89,7 @@ inline SkIRect& GrWindowRectangles::addWindow() {
}
inline bool GrWindowRectangles::operator==(const GrWindowRectangles& that) const {
- if (fMode != that.fMode || fCount != that.fCount) {
+ if (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