From a9cf419caeebb019a6ca39fd43aab69f0956ae85 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Thu, 1 Dec 2022 23:46:39 +0000 Subject: 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 --- libs/input/Input.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libs/input/Input.cpp') 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(ui::ROTATION_0); case ui::Transform::ROT_90: - return DISPLAY_ORIENTATION_270; + return static_cast(ui::ROTATION_270); case ui::Transform::ROT_180: - return DISPLAY_ORIENTATION_180; + return static_cast(ui::ROTATION_180); case ui::Transform::ROT_270: - return DISPLAY_ORIENTATION_90; + return static_cast(ui::ROTATION_90); default: return -1; } -- cgit v1.2.3-59-g8ed1b