diff options
| author | 2021-07-08 15:57:11 +0000 | |
|---|---|---|
| committer | 2021-07-08 15:57:11 +0000 | |
| commit | da898461d20b33dbbd990ff0da3ba610f8d37cd5 (patch) | |
| tree | dd871f3e4d334c4ab399a682e4fa0653aacd3496 | |
| parent | ec5caebcd34a3b2187cfdf80fb8fd32faa1497c2 (diff) | |
| parent | 6a5e8c4adbf9be374b70b29e53f37574e0b2b564 (diff) | |
Merge "Add an utility function to convert RotationFlags to Rotation" into sc-dev am: 6a5e8c4adb
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15191746
Change-Id: I1d86ab906fac50a44152378aa2b4978b011e9795
| -rw-r--r-- | libs/ui/include/ui/Transform.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/ui/include/ui/Transform.h b/libs/ui/include/ui/Transform.h index a197b3b20e..33fbe05035 100644 --- a/libs/ui/include/ui/Transform.h +++ b/libs/ui/include/ui/Transform.h @@ -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 |