diff options
author | 2022-12-01 23:46:39 +0000 | |
---|---|---|
committer | 2022-12-02 13:54:39 +0000 | |
commit | a9cf419caeebb019a6ca39fd43aab69f0956ae85 (patch) | |
tree | e7a9fad8e46b1ea27641344faaebd7ef2c96056d /libs/input/Input.cpp | |
parent | 5956e69ecea469b9d51cd42a0d03852ca2236411 (diff) |
Convert orientation values in input to ui::Rotation.
ui::Rotation both provides better typesafety as well as some convenience
functions (e.g. operator+, operator-).
Test: atest TouchVideoFrame_test.cpp InputReader_test.cpp
Change-Id: Ib423457c742ed3d41f2e3fc269ddf86809cbf247
Diffstat (limited to 'libs/input/Input.cpp')
-rw-r--r-- | libs/input/Input.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libs/input/Input.cpp b/libs/input/Input.cpp index 3685f54a53..162b757743 100644 --- a/libs/input/Input.cpp +++ b/libs/input/Input.cpp @@ -552,19 +552,19 @@ void MotionEvent::addSample( &pointerCoords[getPointerCount()]); } -int MotionEvent::getSurfaceRotation() const { +int32_t MotionEvent::getSurfaceRotation() const { // The surface rotation is the rotation from the window's coordinate space to that of the // display. Since the event's transform takes display space coordinates to window space, the // returned surface rotation is the inverse of the rotation for the surface. switch (mTransform.getOrientation()) { case ui::Transform::ROT_0: - return DISPLAY_ORIENTATION_0; + return static_cast<int32_t>(ui::ROTATION_0); case ui::Transform::ROT_90: - return DISPLAY_ORIENTATION_270; + return static_cast<int32_t>(ui::ROTATION_270); case ui::Transform::ROT_180: - return DISPLAY_ORIENTATION_180; + return static_cast<int32_t>(ui::ROTATION_180); case ui::Transform::ROT_270: - return DISPLAY_ORIENTATION_90; + return static_cast<int32_t>(ui::ROTATION_90); default: return -1; } |