summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-09 00:02:38 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-09 00:02:38 +0000
commita04272a4b1579b3830b244c1ae26cf4374b1bc6a (patch)
tree05dfbd682999a4878386a153db6b66a47861e175 /cc
parentd3ccc9c594d93efc13b35b5fbc43404799be051c (diff)
downloadchromium_src-a04272a4b1579b3830b244c1ae26cf4374b1bc6a.zip
chromium_src-a04272a4b1579b3830b244c1ae26cf4374b1bc6a.tar.gz
chromium_src-a04272a4b1579b3830b244c1ae26cf4374b1bc6a.tar.bz2
cc: Define Region::Contains() to be A contains B if all points in B are also in A.
This means that Contains(empty) is always true. Tests: RegionTest.Contains R=enne Review URL: https://chromiumcodereview.appspot.com/11368149 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166812 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/occlusion_tracker.cc2
-rw-r--r--cc/region.cc4
-rw-r--r--cc/region_unittest.cc5
3 files changed, 9 insertions, 2 deletions
diff --git a/cc/occlusion_tracker.cc b/cc/occlusion_tracker.cc
index 50a453e..9c536d2 100644
--- a/cc/occlusion_tracker.cc
+++ b/cc/occlusion_tracker.cc
@@ -314,7 +314,7 @@ static inline bool testContentRectOccluded(const gfx::Rect& contentRect, const W
gfx::RectF transformedRect = MathUtil::mapClippedRect(contentSpaceTransform, gfx::RectF(contentRect));
// Take the gfx::ToEnclosingRect, as we want to include partial pixels in the test.
gfx::Rect targetRect = gfx::IntersectRects(gfx::ToEnclosingRect(transformedRect), clipRectInTarget);
- return targetRect.IsEmpty() || occlusion.Contains(targetRect);
+ return occlusion.Contains(targetRect);
}
template<typename LayerType, typename RenderSurfaceType>
diff --git a/cc/region.cc b/cc/region.cc
index 7a5e83c..f0fddc5 100644
--- a/cc/region.cc
+++ b/cc/region.cc
@@ -47,10 +47,14 @@ bool Region::Contains(gfx::Point point) const {
}
bool Region::Contains(gfx::Rect rect) const {
+ if (rect.IsEmpty())
+ return true;
return skregion_.contains(ToSkIRect(rect));
}
bool Region::Contains(const Region& region) const {
+ if (region.IsEmpty())
+ return true;
return skregion_.contains(region.skregion_);
}
diff --git a/cc/region_unittest.cc b/cc/region_unittest.cc
index 2fd52d6..db0fc3c 100644
--- a/cc/region_unittest.cc
+++ b/cc/region_unittest.cc
@@ -224,7 +224,10 @@ TEST(RegionTest, ReadPastFullSpanVectorInIntersectsTest) {
}
TEST(RegionTest, ContainsRegion) {
- TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect());
+ TEST_CONTAINS(gfx::Rect(), gfx::Rect());
+ TEST_CONTAINS(gfx::Rect(0, 0, 1, 1), gfx::Rect());
+ TEST_CONTAINS(gfx::Rect(10, 10, 1, 1), gfx::Rect());
+
TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect(0, 0, 1, 1));
TEST_NO_CONTAINS(gfx::Rect(), gfx::Rect(1, 1, 1, 1));