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

Commit 9a501dfd authored by András Kurucz's avatar András Kurucz
Browse files

Remove the hairline drawn on the OverlayShade background

The verticalEdgeExpandContainerBackground puts together its drawn
surface from two pieces: a half-cut pill (rounded rect), and a rect.

These two rects were slightly overlapping due to a rounding issue.

Fixes: 404484458
Test: open the non-floating QS and Notifications panel
Flag: com.android.systemui.scene_container
Change-Id: I5ca8e4598e7e4216f24ddcd24b0e11a9d9c4ce7a
parent b7258703
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.compose.ui.util.fastCoerceAtLeast
import androidx.compose.ui.util.fastCoerceIn
import androidx.compose.ui.util.lerp
import kotlin.math.min
import kotlin.math.round

/**
 * Draws the background of a vertically container, and applies clipping to it.
@@ -134,12 +135,13 @@ internal class EdgeContainerExpansionBackgroundNode(
        val radius = height.fastCoerceIn(spec.minRadius.toPx(), spec.radius.toPx())

        // Draw (at most) the bottom half of the rounded corner rectangle, aligned to the bottom.
        val upperHeight = height - radius
        // Round upper height to the closest integer to avoid to avoid a hairline gap being visible
        // due to the two rectangles overlapping.
        val upperHeight = round((height - radius)).fastCoerceAtLeast(0f)

        // The rounded rect is drawn at 2x the radius height, to avoid smaller corner radii.
        // The clipRect limits this to the relevant part (-1 to avoid a hairline gap being visible
        // between this and the fill below.
        clipRect(top = (upperHeight - 1).fastCoerceAtLeast(0f)) {
        // The clipRect limits this to the relevant part between this and the fill below.
        clipRect(top = upperHeight) {
            drawRoundRect(
                color = backgroundColor,
                cornerRadius = CornerRadius(radius),