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

Commit 4372421f authored by Patrick Williams's avatar Patrick Williams Committed by Android (Google) Code Review
Browse files

Merge "Update inverseLayerTransform for screenshots" into udc-dev

parents de92ed0d c6e0cce6
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -7115,6 +7115,8 @@ ftl::SharedFuture<FenceResult> SurfaceFlinger::renderScreenImpl(
        captureResults.capturedHdrLayers |= isHdrLayer(*snapshot);
        captureResults.capturedHdrLayers |= isHdrLayer(*snapshot);
        layerFE->mSnapshot->geomLayerTransform =
        layerFE->mSnapshot->geomLayerTransform =
                renderArea->getTransform() * layerFE->mSnapshot->geomLayerTransform;
                renderArea->getTransform() * layerFE->mSnapshot->geomLayerTransform;
        layerFE->mSnapshot->geomInverseLayerTransform =
                layerFE->mSnapshot->geomLayerTransform.inverse();
    }
    }


    // We allow the system server to take screenshots of secure layers for
    // We allow the system server to take screenshots of secure layers for
+13 −2
Original line number Original line Diff line number Diff line
@@ -187,8 +187,6 @@ TEST_F(TextureFilteringTest, LayerCaptureWithCropNoFiltering) {


// Expect no filtering because the output source crop and output buffer are the same size.
// Expect no filtering because the output source crop and output buffer are the same size.
TEST_F(TextureFilteringTest, OutputSourceCropDisplayFrameMatchNoFiltering) {
TEST_F(TextureFilteringTest, OutputSourceCropDisplayFrameMatchNoFiltering) {
    // Transaction().setCrop(mLayer, Rect{25, 25, 75, 75}).apply();

    gui::DisplayCaptureArgs captureArgs;
    gui::DisplayCaptureArgs captureArgs;
    captureArgs.displayToken = mDisplay;
    captureArgs.displayToken = mDisplay;
    captureArgs.width = 50;
    captureArgs.width = 50;
@@ -224,4 +222,17 @@ TEST_F(TextureFilteringTest, ParentCropNoFiltering) {
    mCapture->expectColor(Rect{50, 25, 75, 75}, Color::BLUE);
    mCapture->expectColor(Rect{50, 25, 75, 75}, Color::BLUE);
}
}


// Expect no filtering because parent's position transform shouldn't scale the layer.
TEST_F(TextureFilteringTest, ParentHasTransformNoFiltering) {
    Transaction().setPosition(mParent, 100, 100).apply();

    LayerCaptureArgs captureArgs;
    captureArgs.layerHandle = mParent->getHandle();
    captureArgs.sourceCrop = Rect{0, 0, 100, 100};
    ScreenCapture::captureLayers(&mCapture, captureArgs);

    mCapture->expectColor(Rect{0, 0, 50, 100}, Color::RED);
    mCapture->expectColor(Rect{50, 0, 100, 100}, Color::BLUE);
}

} // namespace android
} // namespace android