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

Commit 464c4466 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere
Browse files

Fix PunchHole when punching a Rectangle shape

This CL fixes PunchHole in the case where we punch a hole using a
RectangleShape. Before this CL, we would use the size of the element in
which we punch the hole instead of using the size of the `bounds`
element.

Bug: 290184746
Test: Manual, see http://go/sysui-transition-layout#punch-hole
Change-Id: I5d2a0f17e32c2dbaae42ea727e98cff7cec42001
parent 3658b892
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -72,15 +72,16 @@ internal class PunchHole(
    }

    private fun DrawScope.drawHole(bounds: Element) {
        val boundsSize = bounds.lastSize.toSize()
        if (shape == RectangleShape) {
            drawRect(Color.Black, blendMode = BlendMode.DstOut)
            drawRect(Color.Black, size = boundsSize, blendMode = BlendMode.DstOut)
            return
        }

        // TODO(b/290184746): Cache outline if the size of bounds does not change.
        drawOutline(
            shape.createOutline(
                bounds.lastSize.toSize(),
                boundsSize,
                layoutDirection,
                this,
            ),