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

Skip to content
Commit 38d8d9a2 authored by Eliot Courtney's avatar Eliot Courtney
Browse files

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

In Layer::computeBounds, we intersect the surface bounds with the bounds
of its parent surface. This requires transforming the coordinates into
the a different coordinate space (and then back):
floatWin = t.transform(floatWin);

Then we do the intersection:
floatWin = floatWin.intersect(bounds.toFloatRect());

In the case that the surface bounds is completely outside the parent
surface bounds, FloatRect::intersect() returns a negative area
FloatRect. That is, FloatRect::intersect returns negative area
rectangles (not empty ones) for non-intersecting rectangles. After this
intersection, we want to transform the cropped FloatRect back into the
old coordinate space:
floatWin = t.inverse().transform(floatWin);

In the case of this bug, the transform is just a translation. However,
since it could be doing flipping or something, Transform::transform()
for Rects computes the transform of each corner point of the rectangle,
then takes the AABB of those four transformed points. This means that
the negative area rectangle we got from intersecting two
non-intersecting Rects becomes a positive area Rect after the inverse
transform. Since it's positive area, we try to draw it.

Bug: 110183273
Test: Opened youtube, put a video into preview (by opening a video then
pressing back), then dragged it out of the side of youtube. It didn't
make a black rectangle poking out the side of the youtube window.

Change-Id: I18f06277f69e3810c1a9c5666959eeceed5899b7
parent a3099857
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment