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/TouchVideoFrame.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/TouchVideoFrame.cpp')
-rw-r--r-- | libs/input/TouchVideoFrame.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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<int16_t>& 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; } } |