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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/region.h" | 7 #include "cc/region.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 const Region& Region::operator=(gfx::Rect rect) { | 31 const Region& Region::operator=(gfx::Rect rect) { |
32 skregion_ = SkRegion(ToSkIRect(rect)); | 32 skregion_ = SkRegion(ToSkIRect(rect)); |
33 return *this; | 33 return *this; |
34 } | 34 } |
35 | 35 |
36 const Region& Region::operator=(const Region& region) { | 36 const Region& Region::operator=(const Region& region) { |
37 skregion_ = region.skregion_; | 37 skregion_ = region.skregion_; |
38 return *this; | 38 return *this; |
39 } | 39 } |
40 | 40 |
| 41 void Region::Swap(Region& region) { |
| 42 region.skregion_.swap(skregion_); |
| 43 } |
| 44 |
| 45 void Region::Clear() { |
| 46 skregion_.setEmpty(); |
| 47 } |
| 48 |
41 bool Region::IsEmpty() const { | 49 bool Region::IsEmpty() const { |
42 return skregion_.isEmpty(); | 50 return skregion_.isEmpty(); |
43 } | 51 } |
44 | 52 |
45 bool Region::Contains(gfx::Point point) const { | 53 bool Region::Contains(gfx::Point point) const { |
46 return skregion_.contains(point.x(), point.y()); | 54 return skregion_.contains(point.x(), point.y()); |
47 } | 55 } |
48 | 56 |
49 bool Region::Contains(gfx::Rect rect) const { | 57 bool Region::Contains(gfx::Rect rect) const { |
50 return skregion_.contains(ToSkIRect(rect)); | 58 return skregion_.contains(ToSkIRect(rect)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 108 } |
101 | 109 |
102 Region::Iterator::Iterator(const Region& region) | 110 Region::Iterator::Iterator(const Region& region) |
103 : it_(region.skregion_) { | 111 : it_(region.skregion_) { |
104 } | 112 } |
105 | 113 |
106 Region::Iterator::~Iterator() { | 114 Region::Iterator::~Iterator() { |
107 } | 115 } |
108 | 116 |
109 } // namespace cc | 117 } // namespace cc |
OLD | NEW |