From ac02eb9035a13a3d09c2def9ed63d04225eb2509 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Mon, 5 Oct 2015 12:23:46 -0700 Subject: Remove confusing behavior of Rect::intersect() and rename bug:24670525 Removes silly 'do nothing if rects do not intersect' behavior, and changes the name to clarify the difference (contrasting against SkRect::intersect()) bug:24670525 Change-Id: Id2ca1cfea1a9d720d4dc70b251f426d9916f8b53 --- libs/hwui/ClipArea.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'libs/hwui/ClipArea.cpp') diff --git a/libs/hwui/ClipArea.cpp b/libs/hwui/ClipArea.cpp index 8e7efb4e35d6..a9d1e4284d2e 100644 --- a/libs/hwui/ClipArea.cpp +++ b/libs/hwui/ClipArea.cpp @@ -23,14 +23,6 @@ namespace android { namespace uirenderer { -static bool intersect(Rect& r, const Rect& r2) { - bool hasIntersection = r.intersect(r2); - if (!hasIntersection) { - r.setEmpty(); - } - return hasIntersection; -} - static void handlePoint(Rect& transformedBounds, const Matrix4& transform, float x, float y) { Vertex v = {x, y}; transform.mapPoint(v.x, v.y); @@ -67,9 +59,8 @@ bool TransformedRectangle::canSimplyIntersectWith( return mTransform == other.mTransform; } -bool TransformedRectangle::intersectWith(const TransformedRectangle& other) { - Rect translatedBounds(other.mBounds); - return intersect(mBounds, translatedBounds); +void TransformedRectangle::intersectWith(const TransformedRectangle& other) { + mBounds.doIntersect(other.mBounds); } bool TransformedRectangle::isEmpty() const { @@ -146,7 +137,7 @@ Rect RectangleList::calculateBounds() const { if (index == 0) { bounds = tr.transformedBounds(); } else { - bounds.intersect(tr.transformedBounds()); + bounds.doIntersect(tr.transformedBounds()); } } return bounds; @@ -275,10 +266,7 @@ void ClipArea::rectangleModeClipRectWithTransform(const Rect& r, if (transform->rectToRect()) { Rect transformed(r); transform->mapRect(transformed); - bool hasIntersection = mClipRect.intersect(transformed); - if (!hasIntersection) { - mClipRect.setEmpty(); - } + mClipRect.doIntersect(transformed); return; } -- cgit v1.2.3-59-g8ed1b