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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 bool Region::IsEmpty() const { | 41 bool Region::IsEmpty() const { |
42 return skregion_.isEmpty(); | 42 return skregion_.isEmpty(); |
43 } | 43 } |
44 | 44 |
45 bool Region::Contains(gfx::Point point) const { | 45 bool Region::Contains(gfx::Point point) const { |
46 return skregion_.contains(point.x(), point.y()); | 46 return skregion_.contains(point.x(), point.y()); |
47 } | 47 } |
48 | 48 |
49 bool Region::Contains(gfx::Rect rect) const { | 49 bool Region::Contains(gfx::Rect rect) const { |
| 50 if (rect.IsEmpty()) |
| 51 return true; |
50 return skregion_.contains(ToSkIRect(rect)); | 52 return skregion_.contains(ToSkIRect(rect)); |
51 } | 53 } |
52 | 54 |
53 bool Region::Contains(const Region& region) const { | 55 bool Region::Contains(const Region& region) const { |
| 56 if (region.IsEmpty()) |
| 57 return true; |
54 return skregion_.contains(region.skregion_); | 58 return skregion_.contains(region.skregion_); |
55 } | 59 } |
56 | 60 |
57 bool Region::Intersects(gfx::Rect rect) const { | 61 bool Region::Intersects(gfx::Rect rect) const { |
58 return skregion_.intersects(ToSkIRect(rect)); | 62 return skregion_.intersects(ToSkIRect(rect)); |
59 } | 63 } |
60 | 64 |
61 bool Region::Intersects(const Region& region) const { | 65 bool Region::Intersects(const Region& region) const { |
62 return skregion_.intersects(region.skregion_); | 66 return skregion_.intersects(region.skregion_); |
63 } | 67 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } | 104 } |
101 | 105 |
102 Region::Iterator::Iterator(const Region& region) | 106 Region::Iterator::Iterator(const Region& region) |
103 : it_(region.skregion_) { | 107 : it_(region.skregion_) { |
104 } | 108 } |
105 | 109 |
106 Region::Iterator::~Iterator() { | 110 Region::Iterator::~Iterator() { |
107 } | 111 } |
108 | 112 |
109 } // namespace cc | 113 } // namespace cc |
OLD | NEW |