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

Commit 6e064ce3 authored by Vishnu Nair's avatar Vishnu Nair Committed by Automerger Merge Worker
Browse files

Merge "Add an utility function to convert RotationFlags to Rotation" into...

Merge "Add an utility function to convert RotationFlags to Rotation" into sc-dev am: 6a5e8c4a am: 5ee25eaa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15191746

Change-Id: I809c3b397ae2ba4ea68453c5e7f2c65279561ea8
parents 065c8930 5ee25eaa
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -112,6 +112,7 @@ public:
    void dump(const char* name, const char* prefix = "") const;

    static constexpr RotationFlags toRotationFlags(Rotation);
    static constexpr Rotation toRotation(RotationFlags);

private:
    struct mat33 {
@@ -151,5 +152,20 @@ inline constexpr Transform::RotationFlags Transform::toRotationFlags(Rotation ro
    }
}

inline constexpr Rotation Transform::toRotation(Transform::RotationFlags rotationFlags) {
    switch (rotationFlags) {
        case ROT_0:
            return ROTATION_0;
        case ROT_90:
            return ROTATION_90;
        case ROT_180:
            return ROTATION_180;
        case ROT_270:
            return ROTATION_270;
        default:
            return ROTATION_0;
    }
}

}  // namespace ui
}  // namespace android