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

Commit a3c4d372 authored by chaviw's avatar chaviw
Browse files

Don't create CE Layer when EffectLayer has nothing to draw.

If the EffectLayer has nothing to draw, it's essentially a container
layer. In that case, there's no need to create a CE Layer since nothing
will draw on screen.

This fixes the case where a VD is created for screenrecording. The first
few frames can be black because there's an effect layer in the hierarchy
with nothing to draw before the mirroring starts. When that happens,
the recording shows black frames. There's no need to render the
EffectLayer since it doesn't actually have content

Fixes: 222749939
Test: Screenrecord no black frames at the start.
Change-Id: Iec720810eaad923a4045b8f1b73b088ada86cfd1
parent 70379c81
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -114,7 +114,13 @@ void EffectLayer::preparePerFrameCompositionState() {
}

sp<compositionengine::LayerFE> EffectLayer::getCompositionEngineLayerFE() const {
    // There's no need to get a CE Layer if the EffectLayer isn't going to draw anything. In that
    // case, it acts more like a ContainerLayer so returning a null CE Layer makes more sense
    if (hasSomethingToDraw()) {
        return asLayerFE();
    } else {
        return nullptr;
    }
}

compositionengine::LayerFECompositionState* EffectLayer::editCompositionState() {