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

Commit 1955bb85 authored by Marin Shalamanov's avatar Marin Shalamanov Committed by Android (Google) Code Review
Browse files

Merge "[SF] Set default layerStackRect to the framebuffer size"

parents de0dbd73 4429cac4
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -168,22 +168,16 @@ void DisplayDevice::setProjection(ui::Rotation orientation, Rect layerStackSpace
        sPrimaryDisplayRotationFlags = ui::Transform::toRotationFlags(orientation);
    }

    const Rect& displayBounds = getCompositionDisplay()->getState().displaySpace.bounds;
    const int displayWidth = displayBounds.width();
    const int displayHeight = displayBounds.height();

    if (!orientedDisplaySpaceRect.isValid()) {
        // the destination frame can be invalid if it has never been set,
        // in that case we assume the whole display frame.
        orientedDisplaySpaceRect = Rect(displayWidth, displayHeight);
        // The destination frame can be invalid if it has never been set,
        // in that case we assume the whole display size.
        orientedDisplaySpaceRect = getCompositionDisplay()->getState().displaySpace.bounds;
    }

    if (layerStackSpaceRect.isEmpty()) {
        // layerStackSpaceRect can be invalid if it has never been set, in that case
        // we assume the whole display size.
        // It's also invalid to have an empty layerStackSpaceRect, so we handle that
        // case in the same way.
        layerStackSpaceRect = Rect(displayWidth, displayHeight);
        // The layerStackSpaceRect can be invalid if it has never been set, in that case
        // we assume the whole framebuffer size.
        layerStackSpaceRect = getCompositionDisplay()->getState().framebufferSpace.bounds;
        if (orientation == ui::ROTATION_90 || orientation == ui::ROTATION_270) {
            std::swap(layerStackSpaceRect.right, layerStackSpaceRect.bottom);
        }