OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_BASE_REGION_H_ | 5 #ifndef CC_BASE_REGION_H_ |
6 #define CC_BASE_REGION_H_ | 6 #define CC_BASE_REGION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | |
11 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
12 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
13 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
14 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
15 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
16 | 15 |
17 namespace base { | 16 namespace base { |
18 class Value; | 17 class Value; |
19 namespace debug { | 18 namespace debug { |
20 class TracedValue; | 19 class TracedValue; |
21 } | 20 } |
22 } | 21 } |
23 | 22 |
24 namespace cc { | 23 namespace cc { |
| 24 class SimpleEnclosedRegion; |
25 | 25 |
26 class CC_EXPORT Region { | 26 class CC_EXPORT Region { |
27 public: | 27 public: |
28 Region(); | 28 Region(); |
29 Region(const Region& region); | 29 Region(const Region& region); |
30 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) | 30 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) |
31 ~Region(); | 31 ~Region(); |
32 | 32 |
33 const Region& operator=(const gfx::Rect& rect); | 33 const Region& operator=(const gfx::Rect& rect); |
34 const Region& operator=(const Region& region); | 34 const Region& operator=(const Region& region); |
35 | 35 |
36 void Swap(Region* region); | 36 void Swap(Region* region); |
37 void Clear(); | 37 void Clear(); |
38 bool IsEmpty() const; | 38 bool IsEmpty() const; |
39 int GetRegionComplexity() const; | 39 int GetRegionComplexity() const; |
40 | 40 |
41 bool Contains(const gfx::Point& point) const; | 41 bool Contains(const gfx::Point& point) const; |
42 bool Contains(const gfx::Rect& rect) const; | 42 bool Contains(const gfx::Rect& rect) const; |
43 bool Contains(const Region& region) const; | 43 bool Contains(const Region& region) const; |
44 | 44 |
45 bool Intersects(const gfx::Rect& rect) const; | 45 bool Intersects(const gfx::Rect& rect) const; |
46 bool Intersects(const Region& region) const; | 46 bool Intersects(const Region& region) const; |
47 | 47 |
48 void Subtract(const gfx::Rect& rect); | 48 void Subtract(const gfx::Rect& rect); |
49 void Subtract(const Region& region); | 49 void Subtract(const Region& region); |
| 50 void Subtract(const SimpleEnclosedRegion& region); |
50 void Union(const gfx::Rect& rect); | 51 void Union(const gfx::Rect& rect); |
51 void Union(const Region& region); | 52 void Union(const Region& region); |
52 void Intersect(const gfx::Rect& rect); | 53 void Intersect(const gfx::Rect& rect); |
53 void Intersect(const Region& region); | 54 void Intersect(const Region& region); |
54 | 55 |
55 bool Equals(const Region& other) const { | 56 bool Equals(const Region& other) const { |
56 return skregion_ == other.skregion_; | 57 return skregion_ == other.skregion_; |
57 } | 58 } |
58 | 59 |
59 gfx::Rect bounds() const { | 60 gfx::Rect bounds() const { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 131 |
131 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { | 132 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { |
132 Region result = a; | 133 Region result = a; |
133 result.Union(b); | 134 result.Union(b); |
134 return result; | 135 return result; |
135 } | 136 } |
136 | 137 |
137 } // namespace cc | 138 } // namespace cc |
138 | 139 |
139 #endif // CC_BASE_REGION_H_ | 140 #endif // CC_BASE_REGION_H_ |
OLD | NEW |