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