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

Commit c76fce61 authored by Wang Han's avatar Wang Han Committed by Bruno Martins
Browse files

Revert "Fix captureScreen when 90/180/270 LCM"

 * Let's take the more proper upstream fix.

This reverts commit 0699eff8.

Change-Id: I7ed88a3ecf8b560302697e4c5c2357acc05c29fa
parent cc99a996
Loading
Loading
Loading
Loading
+1 −35
Original line number Original line Diff line number Diff line
@@ -5467,15 +5467,6 @@ status_t SurfaceFlinger::captureScreen(const sp<IBinder>& displayToken,
        display = getDisplayDeviceLocked(displayToken);
        display = getDisplayDeviceLocked(displayToken);
        if (!display) return NAME_NOT_FOUND;
        if (!display) return NAME_NOT_FOUND;


        if (display->isPrimary()) {
            const auto physicalOrientation = display->getPhysicalOrientation();
            renderAreaRotation = ui::Transform::toRotationFlags(rotation + physicalOrientation);
            if (renderAreaRotation == ui::Transform::ROT_INVALID) {
                ALOGE("%s: Invalid rotation: %s", __FUNCTION__, toCString(rotation));
                renderAreaRotation = ui::Transform::ROT_0;
            }
        }

        // set the requested width/height to the logical display viewport size
        // set the requested width/height to the logical display viewport size
        // by default
        // by default
        if (reqWidth == 0 || reqHeight == 0) {
        if (reqWidth == 0 || reqHeight == 0) {
@@ -5549,7 +5540,6 @@ status_t SurfaceFlinger::captureScreen(uint64_t displayOrLayerStack, Dataspace*
    uint32_t width;
    uint32_t width;
    uint32_t height;
    uint32_t height;
    ui::Transform::RotationFlags captureOrientation;
    ui::Transform::RotationFlags captureOrientation;
    ui::Rotation correctOrientation;
    {
    {
        Mutex::Autolock lock(mStateLock);
        Mutex::Autolock lock(mStateLock);
        display = getDisplayByIdOrLayerStack(displayOrLayerStack);
        display = getDisplayByIdOrLayerStack(displayOrLayerStack);
@@ -5561,31 +5551,7 @@ status_t SurfaceFlinger::captureScreen(uint64_t displayOrLayerStack, Dataspace*
        height = uint32_t(display->getViewport().height());
        height = uint32_t(display->getViewport().height());


        const auto orientation = display->getOrientation();
        const auto orientation = display->getOrientation();
        const auto physicalOrientation = display->getPhysicalOrientation();
        if (display->isPrimary()) {
            switch (physicalOrientation) {
            case ui::Rotation::Rotation0:
                correctOrientation = orientation;
                break;
            case ui::Rotation::Rotation90:
                correctOrientation = orientation + ui::Rotation::Rotation270;
                break;

            case ui::Rotation::Rotation180:
                correctOrientation = orientation + ui::Rotation::Rotation180;
                break;

            case ui::Rotation::Rotation270:
                correctOrientation = orientation + ui::Rotation::Rotation90;
                break;

            default:
                break;
            }
            captureOrientation = ui::Transform::toRotationFlags(correctOrientation);
        } else {
        captureOrientation = ui::Transform::toRotationFlags(orientation);
        captureOrientation = ui::Transform::toRotationFlags(orientation);
        }


        switch (captureOrientation) {
        switch (captureOrientation) {
            case ui::Transform::ROT_90:
            case ui::Transform::ROT_90: