Loading services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -982,6 +982,8 @@ void LayerSnapshotBuilder::updateRoundedCorner(LayerSnapshot& snapshot, parentRoundedCorner.cropRect = t.transform(parentRoundedCorner.cropRect); parentRoundedCorner.radius.x *= t.getScaleX(); parentRoundedCorner.radius.y *= t.getScaleY(); parentRoundedCorner.requestedRadius.x *= t.getScaleX(); parentRoundedCorner.requestedRadius.y *= t.getScaleY(); } FloatRect layerCropRect = snapshot.croppedBufferSize; Loading services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp +36 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include "ui/GraphicTypes.h" #include <com_android_graphics_libgui_flags.h> #include <cmath> #define UPDATE_AND_VERIFY(BUILDER, ...) \ ({ \ Loading Loading @@ -1443,7 +1444,36 @@ TEST_F(LayerSnapshotTest, ignoreCornerRadius) { EXPECT_EQ(getSnapshot({.id = 1})->roundedCorner.radius.x, 0.f); } TEST_F(LayerSnapshotTest, childInheritsParentIntendedCornerRadius) { TEST_F(LayerSnapshotTest, childInheritsParentScaledSettings) { // ROOT // ├── 1 (crop rect set to contain child layer) // │ ├── 11 static constexpr float RADIUS = 123.f; setRoundedCorners(1, RADIUS); FloatRect parentCropRect(1, 1, 999, 999); setCrop(1, parentCropRect); // Rotate surface by 90 setMatrix(11, 0.f, -1.f, 1.f, 0.f); UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER); ui::Transform t = getSnapshot({.id = 11})->localTransform.inverse(); UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.cropRect, t.transform(parentCropRect)); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.radius.x, RADIUS * t.getScaleX()); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.radius.y, RADIUS * t.getScaleY()); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.requestedRadius.x, RADIUS * t.getScaleX()); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.requestedRadius.y, RADIUS * t.getScaleY()); } TEST_F(LayerSnapshotTest, childInheritsParentClientDrawnCornerRadius) { // ROOT // ├── 1 (crop rect set to contain child layers ) // │ ├── 11 // │ │ └── 111 static constexpr float RADIUS = 123.f; setClientDrawnCornerRadius(1, RADIUS); Loading @@ -1457,6 +1487,11 @@ TEST_F(LayerSnapshotTest, childInheritsParentIntendedCornerRadius) { } TEST_F(LayerSnapshotTest, childIgnoreCornerRadiusOverridesParent) { // ROOT // ├── 1 (crop rect set to contain child layers ) // │ ├── 11 // │ │ └── 111 static constexpr float RADIUS = 123.f; setRoundedCorners(1, RADIUS); Loading Loading
services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -982,6 +982,8 @@ void LayerSnapshotBuilder::updateRoundedCorner(LayerSnapshot& snapshot, parentRoundedCorner.cropRect = t.transform(parentRoundedCorner.cropRect); parentRoundedCorner.radius.x *= t.getScaleX(); parentRoundedCorner.radius.y *= t.getScaleY(); parentRoundedCorner.requestedRadius.x *= t.getScaleX(); parentRoundedCorner.requestedRadius.y *= t.getScaleY(); } FloatRect layerCropRect = snapshot.croppedBufferSize; Loading
services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp +36 −1 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #include "ui/GraphicTypes.h" #include <com_android_graphics_libgui_flags.h> #include <cmath> #define UPDATE_AND_VERIFY(BUILDER, ...) \ ({ \ Loading Loading @@ -1443,7 +1444,36 @@ TEST_F(LayerSnapshotTest, ignoreCornerRadius) { EXPECT_EQ(getSnapshot({.id = 1})->roundedCorner.radius.x, 0.f); } TEST_F(LayerSnapshotTest, childInheritsParentIntendedCornerRadius) { TEST_F(LayerSnapshotTest, childInheritsParentScaledSettings) { // ROOT // ├── 1 (crop rect set to contain child layer) // │ ├── 11 static constexpr float RADIUS = 123.f; setRoundedCorners(1, RADIUS); FloatRect parentCropRect(1, 1, 999, 999); setCrop(1, parentCropRect); // Rotate surface by 90 setMatrix(11, 0.f, -1.f, 1.f, 0.f); UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER); ui::Transform t = getSnapshot({.id = 11})->localTransform.inverse(); UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.cropRect, t.transform(parentCropRect)); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.radius.x, RADIUS * t.getScaleX()); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.radius.y, RADIUS * t.getScaleY()); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.requestedRadius.x, RADIUS * t.getScaleX()); EXPECT_EQ(getSnapshot({.id = 11})->roundedCorner.requestedRadius.y, RADIUS * t.getScaleY()); } TEST_F(LayerSnapshotTest, childInheritsParentClientDrawnCornerRadius) { // ROOT // ├── 1 (crop rect set to contain child layers ) // │ ├── 11 // │ │ └── 111 static constexpr float RADIUS = 123.f; setClientDrawnCornerRadius(1, RADIUS); Loading @@ -1457,6 +1487,11 @@ TEST_F(LayerSnapshotTest, childInheritsParentIntendedCornerRadius) { } TEST_F(LayerSnapshotTest, childIgnoreCornerRadiusOverridesParent) { // ROOT // ├── 1 (crop rect set to contain child layers ) // │ ├── 11 // │ │ └── 111 static constexpr float RADIUS = 123.f; setRoundedCorners(1, RADIUS); Loading