| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrWindowRectangles_DEFINED | 8 #ifndef GrWindowRectangles_DEFINED |
| 9 #define GrWindowRectangles_DEFINED | 9 #define GrWindowRectangles_DEFINED |
| 10 | 10 |
| 11 #include "GrNonAtomicRef.h" | 11 #include "GrNonAtomicRef.h" |
| 12 #include "SkRect.h" | 12 #include "SkRect.h" |
| 13 | 13 |
| 14 class GrWindowRectangles { | 14 class GrWindowRectangles { |
| 15 public: | 15 public: |
| 16 constexpr static int kMaxWindows = 16; | 16 constexpr static int kMaxWindows = 8; |
| 17 | 17 |
| 18 enum class Mode : bool { | 18 enum class Mode : bool { |
| 19 kExclusive, | 19 kExclusive, |
| 20 kInclusive | 20 kInclusive |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 GrWindowRectangles(Mode mode = Mode::kExclusive) : fMode(mode), fCount(0) {} | 23 GrWindowRectangles(Mode mode = Mode::kExclusive) : fMode(mode), fCount(0) {} |
| 24 GrWindowRectangles(const GrWindowRectangles& that) : fCount(0) { *this = tha
t; } | 24 GrWindowRectangles(const GrWindowRectangles& that) : fCount(0) { *this = tha
t; } |
| 25 ~GrWindowRectangles() { SkSafeUnref(this->rec()); } | 25 ~GrWindowRectangles() { SkSafeUnref(this->rec()); } |
| 26 | 26 |
| 27 Mode mode() const { return fMode; } | 27 Mode mode() const { return fMode; } |
| 28 uint16_t count() const { return fCount; } | 28 int count() const { return fCount; } |
| 29 bool disabled() const { return Mode::kExclusive == fMode && !fCount; } | 29 bool disabled() const { return Mode::kExclusive == fMode && !fCount; } |
| 30 const SkIRect* data() const; | 30 const SkIRect* data() const; |
| 31 | 31 |
| 32 void reset(Mode = Mode::kExclusive); | 32 void reset(Mode = Mode::kExclusive); |
| 33 GrWindowRectangles& operator=(const GrWindowRectangles&); | 33 GrWindowRectangles& operator=(const GrWindowRectangles&); |
| 34 | 34 |
| 35 SkIRect& addWindow(const SkIRect& window) { return this->addWindow() = windo
w; } | 35 SkIRect& addWindow(const SkIRect& window) { return this->addWindow() = windo
w; } |
| 36 SkIRect& addWindow(); | 36 SkIRect& addWindow(); |
| 37 | 37 |
| 38 bool operator!=(const GrWindowRectangles& that) const { return !(*this == th
at); } | 38 bool operator!=(const GrWindowRectangles& that) const { return !(*this == th
at); } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 if (fMode != that.fMode || fCount != that.fCount) { | 101 if (fMode != that.fMode || fCount != that.fCount) { |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 if (fCount > kNumLocalWindows && fRec == that.fRec) { | 104 if (fCount > kNumLocalWindows && fRec == that.fRec) { |
| 105 return true; | 105 return true; |
| 106 } | 106 } |
| 107 return !fCount || !memcmp(this->data(), that.data(), sizeof(SkIRect) * fCoun
t); | 107 return !fCount || !memcmp(this->data(), that.data(), sizeof(SkIRect) * fCoun
t); |
| 108 } | 108 } |
| 109 | 109 |
| 110 #endif | 110 #endif |
| OLD | NEW |