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 "cc/base/region.h" | 5 #include "cc/base/region.h" |
| 6 |
6 #include "base/debug/trace_event_argument.h" | 7 #include "base/debug/trace_event_argument.h" |
7 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "cc/base/simple_enclosed_region.h" |
8 | 10 |
9 namespace cc { | 11 namespace cc { |
10 | 12 |
11 Region::Region() { | 13 Region::Region() { |
12 } | 14 } |
13 | 15 |
14 Region::Region(const Region& region) | 16 Region::Region(const Region& region) |
15 : skregion_(region.skregion_) { | 17 : skregion_(region.skregion_) { |
16 } | 18 } |
17 | 19 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 75 } |
74 | 76 |
75 void Region::Subtract(const gfx::Rect& rect) { | 77 void Region::Subtract(const gfx::Rect& rect) { |
76 skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kDifference_Op); | 78 skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kDifference_Op); |
77 } | 79 } |
78 | 80 |
79 void Region::Subtract(const Region& region) { | 81 void Region::Subtract(const Region& region) { |
80 skregion_.op(region.skregion_, SkRegion::kDifference_Op); | 82 skregion_.op(region.skregion_, SkRegion::kDifference_Op); |
81 } | 83 } |
82 | 84 |
| 85 void Region::Subtract(const SimpleEnclosedRegion& region) { |
| 86 for (size_t i = 0; i < region.GetRegionComplexity(); ++i) { |
| 87 skregion_.op(gfx::RectToSkIRect(region.GetRect(i)), |
| 88 SkRegion::kDifference_Op); |
| 89 } |
| 90 } |
| 91 |
83 void Region::Union(const gfx::Rect& rect) { | 92 void Region::Union(const gfx::Rect& rect) { |
84 skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kUnion_Op); | 93 skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kUnion_Op); |
85 } | 94 } |
86 | 95 |
87 void Region::Union(const Region& region) { | 96 void Region::Union(const Region& region) { |
88 skregion_.op(region.skregion_, SkRegion::kUnion_Op); | 97 skregion_.op(region.skregion_, SkRegion::kUnion_Op); |
89 } | 98 } |
90 | 99 |
91 void Region::Intersect(const gfx::Rect& rect) { | 100 void Region::Intersect(const gfx::Rect& rect) { |
92 skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kIntersect_Op); | 101 skregion_.op(gfx::RectToSkIRect(rect), SkRegion::kIntersect_Op); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 144 } |
136 | 145 |
137 Region::Iterator::Iterator(const Region& region) | 146 Region::Iterator::Iterator(const Region& region) |
138 : it_(region.skregion_) { | 147 : it_(region.skregion_) { |
139 } | 148 } |
140 | 149 |
141 Region::Iterator::~Iterator() { | 150 Region::Iterator::~Iterator() { |
142 } | 151 } |
143 | 152 |
144 } // namespace cc | 153 } // namespace cc |
OLD | NEW |