| 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 } | 21 } |
| 22 | 22 |
| 23 namespace cc { | 23 namespace cc { |
| 24 class SimpleEnclosedRegion; | 24 class SimpleEnclosedRegion; |
| 25 | 25 |
| 26 namespace proto { |
| 27 class Region; |
| 28 } // namespace proto |
| 29 |
| 26 class CC_EXPORT Region { | 30 class CC_EXPORT Region { |
| 27 public: | 31 public: |
| 28 Region(); | 32 Region(); |
| 29 Region(const Region& region); | 33 Region(const Region& region); |
| 30 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) | 34 Region(const gfx::Rect& rect); // NOLINT(runtime/explicit) |
| 31 ~Region(); | 35 ~Region(); |
| 32 | 36 |
| 33 const Region& operator=(const gfx::Rect& rect); | 37 const Region& operator=(const gfx::Rect& rect); |
| 34 const Region& operator=(const Region& region); | 38 const Region& operator=(const Region& region); |
| 35 | 39 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 58 } | 62 } |
| 59 | 63 |
| 60 gfx::Rect bounds() const { | 64 gfx::Rect bounds() const { |
| 61 return gfx::SkIRectToRect(skregion_.getBounds()); | 65 return gfx::SkIRectToRect(skregion_.getBounds()); |
| 62 } | 66 } |
| 63 | 67 |
| 64 std::string ToString() const; | 68 std::string ToString() const; |
| 65 scoped_ptr<base::Value> AsValue() const; | 69 scoped_ptr<base::Value> AsValue() const; |
| 66 void AsValueInto(base::trace_event::TracedValue* array) const; | 70 void AsValueInto(base::trace_event::TracedValue* array) const; |
| 67 | 71 |
| 72 void ToProtobuf(proto::Region* proto) const; |
| 73 void FromProtobuf(const proto::Region& proto); |
| 74 |
| 68 class CC_EXPORT Iterator { | 75 class CC_EXPORT Iterator { |
| 69 public: | 76 public: |
| 70 Iterator(); | 77 Iterator(); |
| 71 explicit Iterator(const Region& region); | 78 explicit Iterator(const Region& region); |
| 72 ~Iterator(); | 79 ~Iterator(); |
| 73 | 80 |
| 74 gfx::Rect rect() const { | 81 gfx::Rect rect() const { |
| 75 return gfx::SkIRectToRect(it_.rect()); | 82 return gfx::SkIRectToRect(it_.rect()); |
| 76 } | 83 } |
| 77 | 84 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 138 |
| 132 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { | 139 inline Region UnionRegions(const Region& a, const gfx::Rect& b) { |
| 133 Region result = a; | 140 Region result = a; |
| 134 result.Union(b); | 141 result.Union(b); |
| 135 return result; | 142 return result; |
| 136 } | 143 } |
| 137 | 144 |
| 138 } // namespace cc | 145 } // namespace cc |
| 139 | 146 |
| 140 #endif // CC_BASE_REGION_H_ | 147 #endif // CC_BASE_REGION_H_ |
| OLD | NEW |