| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
| 13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
| 14 #include "ui/gfx/skia_util.h" | 14 #include "ui/gfx/skia_util.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class Value; | 17 class Value; |
| 18 namespace trace_event { | 18 namespace trace_event { |
| 19 class TracedValue; | 19 class TracedValue; |
| 20 } | 20 } |
| 21 | |
| 22 // TODO(ssid): remove these aliases after the tracing clients are moved to the | |
| 23 // new trace_event namespace. See crbug.com/451032. ETA: March 2015. | |
| 24 namespace debug { | |
| 25 using ::base::trace_event::TracedValue; | |
| 26 } | 21 } |
| 27 } // namespace base | |
| 28 | 22 |
| 29 namespace cc { | 23 namespace cc { |
| 30 class SimpleEnclosedRegion; | 24 class SimpleEnclosedRegion; |
| 31 | 25 |
| 32 class CC_EXPORT Region { | 26 class CC_EXPORT Region { |
| 33 public: | 27 public: |
| 34 Region(); | 28 Region(); |
| 35 Region(const Region& region); | 29 Region(const Region& region); |
| 36 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) | 30 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) |
| 37 ~Region(); | 31 ~Region(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 62 bool Equals(const Region& other) const { | 56 bool Equals(const Region& other) const { |
| 63 return skregion_ == other.skregion_; | 57 return skregion_ == other.skregion_; |
| 64 } | 58 } |
| 65 | 59 |
| 66 gfx::Rect bounds() const { | 60 gfx::Rect bounds() const { |
| 67 return gfx::SkIRectToRect(skregion_.getBounds()); | 61 return gfx::SkIRectToRect(skregion_.getBounds()); |
| 68 } | 62 } |
| 69 | 63 |
| 70 std::string ToString() const; | 64 std::string ToString() const; |
| 71 scoped_ptr<base::Value> AsValue() const; | 65 scoped_ptr<base::Value> AsValue() const; |
| 72 void AsValueInto(base::debug::TracedValue* array) const; | 66 void AsValueInto(base::trace_event::TracedValue* array) const; |
| 73 | 67 |
| 74 class CC_EXPORT Iterator { | 68 class CC_EXPORT Iterator { |
| 75 public: | 69 public: |
| 76 Iterator(); | 70 Iterator(); |
| 77 explicit Iterator(const Region& region); | 71 explicit Iterator(const Region& region); |
| 78 ~Iterator(); | 72 ~Iterator(); |
| 79 | 73 |
| 80 gfx::Rect rect() const { | 74 gfx::Rect rect() const { |
| 81 return gfx::SkIRectToRect(it_.rect()); | 75 return gfx::SkIRectToRect(it_.rect()); |
| 82 } | 76 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 131 |
| 138 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { | 132 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { |
| 139 Region result = a; | 133 Region result = a; |
| 140 result.Union(b); | 134 result.Union(b); |
| 141 return result; | 135 return result; |
| 142 } | 136 } |
| 143 | 137 |
| 144 } // namespace cc | 138 } // namespace cc |
| 145 | 139 |
| 146 #endif // CC_BASE_REGION_H_ | 140 #endif // CC_BASE_REGION_H_ |
| OLD | NEW |