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

Commit 371626cd authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Consider a color layer to be opaque if its alpha is 1.0

Remove layers occluded by an opaque color layer from going
into composition.

Bug: 136561771

Test: atest SurfaceFlinger_test
Test: Add a full screen color layer with an alpha of 1 and check layers
      behind the layer are consided occluded, and the layers are not
      composed.

Change-Id: Iede63ae4d3e378e650c0b0e7364d0c8d128e3105
parent 466691be
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ std::optional<compositionengine::LayerFE::LayerSettings> ColorLayer::prepareClie
}

bool ColorLayer::isVisible() const {
    return !isHiddenByPolicy() && getAlpha() > 0.0f;
    return !isHiddenByPolicy() && getAlpha() > 0.0_hf;
}

bool ColorLayer::setColor(const half3& color) {
@@ -104,7 +104,9 @@ std::shared_ptr<compositionengine::Layer> ColorLayer::getCompositionLayer() cons
}

bool ColorLayer::isOpaque(const Layer::State& s) const {
    return (s.flags & layer_state_t::eLayerOpaque) != 0;
    // 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;
}

ui::Dataspace ColorLayer::getDataSpace() const {