Remove unnecessary drawing commands when drawing shadows.
When blurring behind a shadow, this will ensure that it
is only blurred once. It does so by updating
Layer::prepareShadowClientComposition to add ShadowSettings
to the input layer, rather than adding an extra layer.
Collapsing the shadow layer into the same layer as the caster will
result in undefined behavior in the old GLESRenderEngine.
Bug: 188050128
Bug: 175915334
Test: atest SurfaceFlinger_test and atest librenderengine_test
Change-Id: I5b74ef9659b519fcc6b89dfd873c35fc579fddd7
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 8139d8a..66d7018 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -764,8 +764,6 @@
// is ready to acquire a buffer.
ui::Transform::RotationFlags getFixedTransformHint() const;
- renderengine::ShadowSettings getShadowSettings(const Rect& layerStackRect) const;
-
/**
* Traverse this layer and it's hierarchy of children directly. Unlike traverseInZOrder
* which will not emit children who have relativeZOrder to another layer, this method
@@ -895,9 +893,6 @@
virtual void setInitialValuesForClone(const sp<Layer>& clonedFrom);
virtual std::optional<compositionengine::LayerFE::LayerSettings> prepareClientComposition(
compositionengine::LayerFE::ClientCompositionTargetSettings&);
- virtual std::optional<compositionengine::LayerFE::LayerSettings> prepareShadowClientComposition(
- const LayerFE::LayerSettings&, const Rect& layerStackRect,
- ui::Dataspace outputDataspace);
virtual void preparePerFrameCompositionState();
virtual void commitTransaction(State& stateToCommit);
virtual uint32_t doTransactionResize(uint32_t flags, Layer::State* stateToCommit);
@@ -923,6 +918,7 @@
// Modifies the passed in layer settings to clear the contents. If the blackout flag is set,
// the settings clears the content with a solid black fill.
void prepareClearClientComposition(LayerFE::LayerSettings&, bool blackout) const;
+ void prepareShadowClientComposition(LayerFE::LayerSettings& caster, const Rect& layerStackRect);
void prepareBasicGeometryCompositionState();
void prepareGeometryCompositionState();