summaryrefslogtreecommitdiff
path: root/libs/hwui/ClipArea.cpp
diff options
context:
space:
mode:
author Chris Craik <ccraik@google.com> 2015-10-05 12:23:46 -0700
committer Chris Craik <ccraik@google.com> 2015-10-05 14:16:26 -0700
commitac02eb9035a13a3d09c2def9ed63d04225eb2509 (patch)
treef6305a3b32606d77e81eb1ff5766c22daa5506d7 /libs/hwui/ClipArea.cpp
parent117e6daa420763e956c2125da09707b60cbaa33e (diff)
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
Diffstat (limited to 'libs/hwui/ClipArea.cpp')
-rw-r--r--libs/hwui/ClipArea.cpp20
1 files changed, 4 insertions, 16 deletions
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;
}