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

Commit e88a886d authored by Pablo Ceballos's avatar Pablo Ceballos Committed by android-build-merger
Browse files

Merge "SF: Fix arbitrary rotation with inverse display transform" into nyc-dev am: 885ac76b

am: d3e7cc01

* commit 'd3e7cc01':
  SF: Fix arbitrary rotation with inverse display transform

Change-Id: I56924e0304e6086886f8ae45a4ab40c423e6a2ed
parents d8c2909d d3e7cc01
Loading
Loading
Loading
Loading
+3 −20
Original line number Original line Diff line number Diff line
@@ -446,17 +446,10 @@ FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const {
        if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) {
        if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) {
            invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
            invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
                    NATIVE_WINDOW_TRANSFORM_FLIP_H;
                    NATIVE_WINDOW_TRANSFORM_FLIP_H;
            // If the transform has been rotated the axis of flip has been swapped
            // so we need to swap which flip operations we are performing
            bool is_h_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0;
            bool is_v_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0;
            if (is_h_flipped != is_v_flipped) {
                invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
                        NATIVE_WINDOW_TRANSFORM_FLIP_H;
            }
        }
        }
        // and apply to the current transform
        // and apply to the current transform
        invTransform = (Transform(invTransform) * Transform(invTransformOrient)).getOrientation();
        invTransform = (Transform(invTransformOrient) * Transform(invTransform))
                .getOrientation();
    }
    }


    int winWidth = s.active.w;
    int winWidth = s.active.w;
@@ -643,23 +636,13 @@ void Layer::setGeometry(
         */
         */
        uint32_t invTransform =
        uint32_t invTransform =
                DisplayDevice::getPrimaryDisplayOrientationTransform();
                DisplayDevice::getPrimaryDisplayOrientationTransform();

        uint32_t t_orientation = transform.getOrientation();
        // calculate the inverse transform
        // calculate the inverse transform
        if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
        if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) {
            invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
            invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
                    NATIVE_WINDOW_TRANSFORM_FLIP_H;
                    NATIVE_WINDOW_TRANSFORM_FLIP_H;
            // If the transform has been rotated the axis of flip has been swapped
            // so we need to swap which flip operations we are performing
            bool is_h_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0;
            bool is_v_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0;
            if (is_h_flipped != is_v_flipped) {
                t_orientation ^= NATIVE_WINDOW_TRANSFORM_FLIP_V |
                        NATIVE_WINDOW_TRANSFORM_FLIP_H;
            }
        }
        }
        // and apply to the current transform
        // and apply to the current transform
        transform = Transform(t_orientation) * Transform(invTransform);
        transform = Transform(invTransform) * transform;
    }
    }


    // this gives us only the "orientation" component of the transform
    // this gives us only the "orientation" component of the transform