Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: cc/region.cc

Issue 11368149: cc: Define Region::Contains() to be A contains B if all points in B are also in A. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/occlusion_tracker.cc ('k') | cc/region_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « cc/occlusion_tracker.cc ('k') | cc/region_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698