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" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "third_party/skia/include/core/SkRegion.h" | 13 #include "third_party/skia/include/core/SkRegion.h" |
14 #include "ui/gfx/rect.h" | 14 #include "ui/gfx/rect.h" |
15 #include "ui/gfx/skia_util.h" | 15 #include "ui/gfx/skia_util.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class Value; | 18 class Value; |
| 19 namespace debug { |
| 20 class TracedValue; |
| 21 } |
19 } | 22 } |
20 | 23 |
21 namespace cc { | 24 namespace cc { |
22 | 25 |
23 class CC_EXPORT Region { | 26 class CC_EXPORT Region { |
24 public: | 27 public: |
25 Region(); | 28 Region(); |
26 Region(const Region& region); | 29 Region(const Region& region); |
27 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) | 30 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) |
28 ~Region(); | 31 ~Region(); |
(...skipping 23 matching lines...) Expand all Loading... |
52 bool Equals(const Region& other) const { | 55 bool Equals(const Region& other) const { |
53 return skregion_ == other.skregion_; | 56 return skregion_ == other.skregion_; |
54 } | 57 } |
55 | 58 |
56 gfx::Rect bounds() const { | 59 gfx::Rect bounds() const { |
57 return gfx::SkIRectToRect(skregion_.getBounds()); | 60 return gfx::SkIRectToRect(skregion_.getBounds()); |
58 } | 61 } |
59 | 62 |
60 std::string ToString() const; | 63 std::string ToString() const; |
61 scoped_ptr<base::Value> AsValue() const; | 64 scoped_ptr<base::Value> AsValue() const; |
| 65 void AsValueInto(base::debug::TracedValue* array) const; |
62 | 66 |
63 class CC_EXPORT Iterator { | 67 class CC_EXPORT Iterator { |
64 public: | 68 public: |
65 Iterator(); | 69 Iterator(); |
66 explicit Iterator(const Region& region); | 70 explicit Iterator(const Region& region); |
67 ~Iterator(); | 71 ~Iterator(); |
68 | 72 |
69 gfx::Rect rect() const { | 73 gfx::Rect rect() const { |
70 return gfx::SkIRectToRect(it_.rect()); | 74 return gfx::SkIRectToRect(it_.rect()); |
71 } | 75 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 130 |
127 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { | 131 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { |
128 Region result = a; | 132 Region result = a; |
129 result.Union(b); | 133 result.Union(b); |
130 return result; | 134 return result; |
131 } | 135 } |
132 | 136 |
133 } // namespace cc | 137 } // namespace cc |
134 | 138 |
135 #endif // CC_BASE_REGION_H_ | 139 #endif // CC_BASE_REGION_H_ |
OLD | NEW |