Loading include/input/DisplayViewport.h +4 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <ftl/string.h> #include <gui/constants.h> #include <input/Input.h> #include <ui/Rotation.h> #include <cinttypes> #include <optional> Loading @@ -29,13 +30,6 @@ using android::base::StringPrintf; namespace android { enum { DISPLAY_ORIENTATION_0 = 0, DISPLAY_ORIENTATION_90 = 1, DISPLAY_ORIENTATION_180 = 2, DISPLAY_ORIENTATION_270 = 3 }; /** * Describes the different type of viewports supported by input flinger. * Keep in sync with values in InputManagerService.java. Loading @@ -54,7 +48,7 @@ enum class ViewportType : int32_t { */ struct DisplayViewport { int32_t displayId; // -1 if invalid int32_t orientation; ui::Rotation orientation; int32_t logicalLeft; int32_t logicalTop; int32_t logicalRight; Loading @@ -74,7 +68,7 @@ struct DisplayViewport { DisplayViewport() : displayId(ADISPLAY_ID_NONE), orientation(DISPLAY_ORIENTATION_0), orientation(ui::ROTATION_0), logicalLeft(0), logicalTop(0), logicalRight(0), Loading Loading @@ -111,7 +105,7 @@ struct DisplayViewport { void setNonDisplayViewport(int32_t width, int32_t height) { displayId = ADISPLAY_ID_NONE; orientation = DISPLAY_ORIENTATION_0; orientation = ui::ROTATION_0; logicalLeft = 0; logicalTop = 0; logicalRight = width; Loading include/input/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -577,7 +577,7 @@ public: inline const ui::Transform& getTransform() const { return mTransform; } int getSurfaceRotation() const; int32_t getSurfaceRotation() const; inline float getXPrecision() const { return mXPrecision; } Loading include/input/TouchVideoFrame.h +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #pragma once #include <ui/Rotation.h> #include <stdint.h> #include <sys/time.h> #include <vector> Loading Loading @@ -58,7 +60,7 @@ public: * Rotate the video frame. * The rotation value is an enum from ui/Rotation.h */ void rotate(int32_t orientation); void rotate(ui::Rotation orientation); private: uint32_t mHeight; Loading libs/input/Input.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -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; } Loading libs/input/TouchVideoFrame.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -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; } } Loading Loading
include/input/DisplayViewport.h +4 −10 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <ftl/string.h> #include <gui/constants.h> #include <input/Input.h> #include <ui/Rotation.h> #include <cinttypes> #include <optional> Loading @@ -29,13 +30,6 @@ using android::base::StringPrintf; namespace android { enum { DISPLAY_ORIENTATION_0 = 0, DISPLAY_ORIENTATION_90 = 1, DISPLAY_ORIENTATION_180 = 2, DISPLAY_ORIENTATION_270 = 3 }; /** * Describes the different type of viewports supported by input flinger. * Keep in sync with values in InputManagerService.java. Loading @@ -54,7 +48,7 @@ enum class ViewportType : int32_t { */ struct DisplayViewport { int32_t displayId; // -1 if invalid int32_t orientation; ui::Rotation orientation; int32_t logicalLeft; int32_t logicalTop; int32_t logicalRight; Loading @@ -74,7 +68,7 @@ struct DisplayViewport { DisplayViewport() : displayId(ADISPLAY_ID_NONE), orientation(DISPLAY_ORIENTATION_0), orientation(ui::ROTATION_0), logicalLeft(0), logicalTop(0), logicalRight(0), Loading Loading @@ -111,7 +105,7 @@ struct DisplayViewport { void setNonDisplayViewport(int32_t width, int32_t height) { displayId = ADISPLAY_ID_NONE; orientation = DISPLAY_ORIENTATION_0; orientation = ui::ROTATION_0; logicalLeft = 0; logicalTop = 0; logicalRight = width; Loading
include/input/Input.h +1 −1 Original line number Diff line number Diff line Loading @@ -577,7 +577,7 @@ public: inline const ui::Transform& getTransform() const { return mTransform; } int getSurfaceRotation() const; int32_t getSurfaceRotation() const; inline float getXPrecision() const { return mXPrecision; } Loading
include/input/TouchVideoFrame.h +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ #pragma once #include <ui/Rotation.h> #include <stdint.h> #include <sys/time.h> #include <vector> Loading Loading @@ -58,7 +60,7 @@ public: * Rotate the video frame. * The rotation value is an enum from ui/Rotation.h */ void rotate(int32_t orientation); void rotate(ui::Rotation orientation); private: uint32_t mHeight; Loading
libs/input/Input.cpp +5 −5 Original line number Diff line number Diff line Loading @@ -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; } Loading
libs/input/TouchVideoFrame.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -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; } } Loading