summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp1
-rw-r--r--services/surfaceflinger/tests/unittests/LayerHierarchyTest.h11
-rw-r--r--services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp9
3 files changed, 21 insertions, 0 deletions
diff --git a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
index 55be398bd0..a1796e1eb0 100644
--- a/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerSnapshotBuilder.cpp
@@ -1006,6 +1006,7 @@ void LayerSnapshotBuilder::updateShadows(LayerSnapshot& snapshot, const Requeste
snapshot.shadowSettings.ambientColor *= snapshot.alpha;
snapshot.shadowSettings.spotColor *= snapshot.alpha;
}
+ snapshot.shadowSettings.length = snapshot.shadowRadius;
}
void LayerSnapshotBuilder::updateInput(LayerSnapshot& snapshot,
diff --git a/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h b/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h
index d7ac038a84..1898f43dcc 100644
--- a/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h
+++ b/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h
@@ -406,6 +406,17 @@ protected:
mLifecycleManager.applyTransactions(transactions);
}
+ void setShadowRadius(uint32_t id, float shadowRadius) {
+ std::vector<TransactionState> transactions;
+ transactions.emplace_back();
+ transactions.back().states.push_back({});
+
+ transactions.back().states.front().state.what = layer_state_t::eShadowRadiusChanged;
+ transactions.back().states.front().layerId = id;
+ transactions.back().states.front().state.shadowRadius = shadowRadius;
+ mLifecycleManager.applyTransactions(transactions);
+ }
+
LayerLifecycleManager mLifecycleManager;
};
diff --git a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
index 69316bf4e5..2ae01312ae 100644
--- a/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
+++ b/services/surfaceflinger/tests/unittests/LayerSnapshotTest.cpp
@@ -872,4 +872,13 @@ TEST_F(LayerSnapshotTest, setBufferCrop) {
UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER);
EXPECT_EQ(getSnapshot(1)->geomContentCrop, Rect(0, 0, 100, 100));
}
+
+TEST_F(LayerSnapshotTest, setShadowRadius) {
+ static constexpr float SHADOW_RADIUS = 123.f;
+ setShadowRadius(1, SHADOW_RADIUS);
+ UPDATE_AND_VERIFY(mSnapshotBuilder, STARTING_ZORDER);
+ EXPECT_EQ(getSnapshot(1)->shadowSettings.length, SHADOW_RADIUS);
+ EXPECT_EQ(getSnapshot(1)->shadowRadius, SHADOW_RADIUS);
+}
+
} // namespace android::surfaceflinger::frontend