Loading include/input/Input.h +2 −0 Original line number Diff line number Diff line Loading @@ -574,6 +574,8 @@ public: inline ui::Transform getTransform() const { return mTransform; } int getSurfaceRotation() const; inline float getXPrecision() const { return mXPrecision; } inline float getYPrecision() const { return mYPrecision; } Loading libs/input/Input.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <android-base/stringprintf.h> #include <gui/constants.h> #include <input/DisplayViewport.h> #include <input/Input.h> #include <input/InputDevice.h> #include <input/InputEventLabels.h> Loading Loading @@ -506,6 +507,24 @@ void MotionEvent::addSample( mSamplePointerCoords.appendArray(pointerCoords, getPointerCount()); } int 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; case ui::Transform::ROT_90: return DISPLAY_ORIENTATION_270; case ui::Transform::ROT_180: return DISPLAY_ORIENTATION_180; case ui::Transform::ROT_270: return DISPLAY_ORIENTATION_90; default: return -1; } } float MotionEvent::getXCursorPosition() const { vec2 vals = mTransform.transform(getRawXCursorPosition(), getRawYCursorPosition()); return vals.x; Loading Loading
include/input/Input.h +2 −0 Original line number Diff line number Diff line Loading @@ -574,6 +574,8 @@ public: inline ui::Transform getTransform() const { return mTransform; } int getSurfaceRotation() const; inline float getXPrecision() const { return mXPrecision; } inline float getYPrecision() const { return mYPrecision; } Loading
libs/input/Input.cpp +19 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <android-base/stringprintf.h> #include <gui/constants.h> #include <input/DisplayViewport.h> #include <input/Input.h> #include <input/InputDevice.h> #include <input/InputEventLabels.h> Loading Loading @@ -506,6 +507,24 @@ void MotionEvent::addSample( mSamplePointerCoords.appendArray(pointerCoords, getPointerCount()); } int 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; case ui::Transform::ROT_90: return DISPLAY_ORIENTATION_270; case ui::Transform::ROT_180: return DISPLAY_ORIENTATION_180; case ui::Transform::ROT_270: return DISPLAY_ORIENTATION_90; default: return -1; } } float MotionEvent::getXCursorPosition() const { vec2 vals = mTransform.transform(getRawXCursorPosition(), getRawYCursorPosition()); return vals.x; Loading