Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a4b33674 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Return empty rect in FloatRect::intersect for non-intersecting rects."

parents 9e1c9561 38d8d9a2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ public:
    float getHeight() const { return bottom - top; }

    FloatRect intersect(const FloatRect& other) const {
        return {
        FloatRect intersection = {
            // Inline to avoid tromping on other min/max defines or adding a
            // dependency on STL
            (left > other.left) ? left : other.left,
@@ -36,6 +36,10 @@ public:
            (right < other.right) ? right : other.right,
            (bottom < other.bottom) ? bottom : other.bottom
        };
        if (intersection.getWidth() < 0 || intersection.getHeight() < 0) {
            return {0, 0, 0, 0};
        }
        return intersection;
    }

    float left = 0.0f;