summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Lucas Dupin <dupin@google.com> 2021-05-27 17:27:15 -0700
committer Lucas Dupin <dupin@google.com> 2021-06-01 12:22:27 -0700
commit0fe42e5bdfc5ec1a828c2d5d1ec04520cb652b62 (patch)
treeb4b4f4eb6d0700feed5962e6a2308347ce9c0352
parentf1804968780f975fa8fe361c480a15e8dd85d131 (diff)
Mark empty EffectLayer as skipContentDraw
An effect layer that only draws a shadow or blurs shouldn't draw a color. We should skip drawing its contents altogether. Bug: 189207458 Test: manual Change-Id: I01bb066d4a02f6111a6974dd241f9530c4979420
-rw-r--r--services/surfaceflinger/EffectLayer.cpp5
-rw-r--r--services/surfaceflinger/Layer.cpp3
2 files changed, 5 insertions, 3 deletions
diff --git a/services/surfaceflinger/EffectLayer.cpp b/services/surfaceflinger/EffectLayer.cpp
index fd18c3bf31..0cc5f33d73 100644
--- a/services/surfaceflinger/EffectLayer.cpp
+++ b/services/surfaceflinger/EffectLayer.cpp
@@ -66,6 +66,7 @@ std::vector<compositionengine::LayerFE::LayerSettings> EffectLayer::prepareClien
layerSettings->source.solidColor = getColor().rgb;
results.push_back(*layerSettings);
} else if (hasBlur() || drawShadows()) {
+ layerSettings->skipContentDraw = true;
results.push_back(*layerSettings);
}
@@ -126,7 +127,7 @@ const compositionengine::LayerFECompositionState* EffectLayer::getCompositionSta
bool EffectLayer::isOpaque(const Layer::State& s) const {
// Consider the layer to be opaque if its opaque flag is set or its effective
// alpha (considering the alpha of its parents as well) is 1.0;
- return (s.flags & layer_state_t::eLayerOpaque) != 0 || getAlpha() == 1.0_hf;
+ return (s.flags & layer_state_t::eLayerOpaque) != 0 || (fillsColor() && getAlpha() == 1.0_hf);
}
ui::Dataspace EffectLayer::getDataSpace() const {
@@ -147,7 +148,7 @@ bool EffectLayer::fillsColor() const {
}
bool EffectLayer::hasBlur() const {
- return getBackgroundBlurRadius() > 0;
+ return getBackgroundBlurRadius() > 0 || getDrawingState().blurRegions.size() > 0;
}
} // namespace android
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index a7c870483b..690fda66a6 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -574,7 +574,8 @@ std::optional<compositionengine::LayerFE::LayerSettings> Layer::prepareClientCom
layerSettings.geometry.positionTransform = getTransform().asMatrix4();
// skip drawing content if the targetSettings indicate the content will be occluded
- layerSettings.skipContentDraw = !targetSettings.realContentIsVisible;
+ layerSettings.skipContentDraw =
+ layerSettings.skipContentDraw || !targetSettings.realContentIsVisible;
if (hasColorTransform()) {
layerSettings.colorTransform = getColorTransform();