From eab7ea0e64a24fc254fa71f0f501c2dc8794ed72 Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Wed, 3 Jun 2020 17:27:28 -0700 Subject: Fix issue where surface corner rounding is ignored It's not correct to only check the diagonal of the transform matrix for scaling. The scale will be distributed across four components when the layer is rotated. Test: manual Test: atest LayerTypeAndRenderTypeTransaction Fixes: 147415720 Change-Id: I140b373efd7fad705d0cd54aa6e86b4142e190e5 --- services/surfaceflinger/Layer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'services/surfaceflinger/Layer.cpp') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 96552770c4..dcc213f943 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -2122,7 +2122,9 @@ Layer::RoundedCornerState Layer::getRoundedCornerState() const { // but a transform matrix can define horizontal and vertical scales. // Let's take the average between both of them and pass into the shader, practically we // never do this type of transformation on windows anyway. - parentState.radius *= (t[0][0] + t[1][1]) / 2.0f; + auto scaleX = sqrtf(t[0][0] * t[0][0] + t[0][1] * t[0][1]); + auto scaleY = sqrtf(t[1][0] * t[1][0] + t[1][1] * t[1][1]); + parentState.radius *= (scaleX + scaleY) / 2.0f; return parentState; } } -- cgit v1.2.3-59-g8ed1b