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

Commit 7629af71 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Expand the displayFrame for shadows" into sc-dev

parents 848879ae d394d3c0
Loading
Loading
Loading
Loading
+12 −2
Original line number Original line Diff line number Diff line
@@ -216,8 +216,18 @@ Rect OutputLayer::calculateOutputDisplayFrame() const {


    // reduce uses a FloatRect to provide more accuracy during the
    // reduce uses a FloatRect to provide more accuracy during the
    // transformation. We then round upon constructing 'frame'.
    // transformation. We then round upon constructing 'frame'.
    Rect frame{
    FloatRect geomLayerBounds = layerState.geomLayerBounds;
            layerTransform.transform(reduce(layerState.geomLayerBounds, activeTransparentRegion))};

    // Some HWCs may clip client composited input to its displayFrame. Make sure
    // that this does not cut off the shadow.
    if (layerState.forceClientComposition && layerState.shadowRadius > 0.0f) {
        const auto outset = layerState.shadowRadius;
        geomLayerBounds.left -= outset;
        geomLayerBounds.top -= outset;
        geomLayerBounds.right += outset;
        geomLayerBounds.bottom += outset;
    }
    Rect frame{layerTransform.transform(reduce(geomLayerBounds, activeTransparentRegion))};
    if (!frame.intersect(outputState.layerStackSpace.content, &frame)) {
    if (!frame.intersect(outputState.layerStackSpace.content, &frame)) {
        frame.clear();
        frame.clear();
    }
    }
+21 −0
Original line number Original line Diff line number Diff line
@@ -324,6 +324,27 @@ TEST_F(OutputLayerDisplayFrameTest, outputTransformAffectsDisplayFrame) {
    EXPECT_THAT(calculateOutputDisplayFrame(), expected);
    EXPECT_THAT(calculateOutputDisplayFrame(), expected);
}
}


TEST_F(OutputLayerDisplayFrameTest, shadowExpandsDisplayFrame) {
    const int kShadowRadius = 5;
    mLayerFEState.shadowRadius = kShadowRadius;
    mLayerFEState.forceClientComposition = true;

    mLayerFEState.geomLayerBounds = FloatRect{100.f, 100.f, 200.f, 200.f};
    Rect expected{mLayerFEState.geomLayerBounds};
    expected.inset(-kShadowRadius, -kShadowRadius, -kShadowRadius, -kShadowRadius);
    EXPECT_THAT(calculateOutputDisplayFrame(), expected);
}

TEST_F(OutputLayerDisplayFrameTest, shadowExpandsDisplayFrame_onlyIfForcingClientComposition) {
    const int kShadowRadius = 5;
    mLayerFEState.shadowRadius = kShadowRadius;
    mLayerFEState.forceClientComposition = false;

    mLayerFEState.geomLayerBounds = FloatRect{100.f, 100.f, 200.f, 200.f};
    Rect expected{mLayerFEState.geomLayerBounds};
    EXPECT_THAT(calculateOutputDisplayFrame(), expected);
}

/*
/*
 * OutputLayer::calculateOutputRelativeBufferTransform()
 * OutputLayer::calculateOutputRelativeBufferTransform()
 */
 */