Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0fe42e5b authored by Lucas Dupin's avatar Lucas Dupin
Browse files

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
parent f1804968
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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
+2 −1
Original line number Diff line number Diff line
@@ -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();