OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2016 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef GrWindowRectsState_DEFINED | |
9 #define GrWindowRectsState_DEFINED | |
10 | |
11 #include "GrWindowRectangles.h" | |
12 | |
13 class GrWindowRectsState { | |
14 public: | |
15 enum class Mode : bool { | |
16 kExclusive, | |
17 kInclusive | |
18 }; | |
19 | |
20 GrWindowRectsState() : fMode(Mode::kExclusive) {} | |
21 GrWindowRectsState(const GrWindowRectangles& windows, const SkIPoint& origin
, Mode mode) | |
22 : fMode(mode) | |
23 , fOrigin(origin) | |
24 , fWindows(windows) { | |
25 } | |
26 | |
27 bool enabled() const { return Mode::kInclusive == fMode || !fWindows.empty()
; } | |
28 Mode mode() const { return fMode; } | |
29 const SkIPoint& origin() const { return fOrigin; } | |
30 const GrWindowRectangles& windows() const { return fWindows; } | |
31 int numWindows() const { return fWindows.count(); } | |
32 | |
33 void setDisabled() { | |
34 fMode = Mode::kExclusive; | |
35 fWindows.reset(); | |
36 } | |
37 | |
38 void set(const GrWindowRectangles& windows, const SkIPoint& origin, Mode mod
e) { | |
39 fMode = mode; | |
40 fOrigin = origin; | |
41 fWindows = windows; | |
42 } | |
43 | |
44 bool cheapEqualTo(const GrWindowRectsState& that) const { | |
45 if (fMode != that.fMode) { | |
46 return false; | |
47 } | |
48 if (!fWindows.empty() && fOrigin != that.fOrigin) { | |
49 return false; | |
50 } | |
51 return fWindows == that.fWindows; | |
52 } | |
53 | |
54 private: | |
55 Mode fMode; | |
56 SkIPoint fOrigin; | |
57 GrWindowRectangles fWindows; | |
58 }; | |
59 | |
60 #endif | |
OLD | NEW |