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/TouchVideoFrame.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'libs/input/TouchVideoFrame.cpp') diff --git a/libs/input/TouchVideoFrame.cpp b/libs/input/TouchVideoFrame.cpp index c62e0985f1..c9393f4451 100644 --- a/libs/input/TouchVideoFrame.cpp +++ b/libs/input/TouchVideoFrame.cpp @@ -40,17 +40,20 @@ const std::vector& TouchVideoFrame::getData() const { return mData; } const struct timeval& TouchVideoFrame::getTimestamp() const { return mTimestamp; } -void TouchVideoFrame::rotate(int32_t orientation) { +void TouchVideoFrame::rotate(ui::Rotation orientation) { switch (orientation) { - case DISPLAY_ORIENTATION_90: + case ui::ROTATION_90: rotateQuarterTurn(false /*clockwise*/); break; - case DISPLAY_ORIENTATION_180: + case ui::ROTATION_180: rotate180(); break; - case DISPLAY_ORIENTATION_270: + case ui::ROTATION_270: rotateQuarterTurn(true /*clockwise*/); break; + case ui::ROTATION_0: + // No need to rotate if there's no rotation. + break; } } -- cgit v1.2.3-59-g8ed1b