Refactor to replace FloatPoint by vec2
Using FloatPoint requires unnecessory conversion between vec2 and
FloatPoint, which is inefficient.
This CL replaces FloatPoint by vec2 everywhere.
Test: atest inputflinger_tests
Bug: 245989146
Flag: EXEMPT refactor
Change-Id: I61e64e43f6bbe643eb22e758a2934294037d8a5b
diff --git a/services/inputflinger/include/PointerChoreographerPolicyInterface.h b/services/inputflinger/include/PointerChoreographerPolicyInterface.h
index e1f8fda..36614b2 100644
--- a/services/inputflinger/include/PointerChoreographerPolicyInterface.h
+++ b/services/inputflinger/include/PointerChoreographerPolicyInterface.h
@@ -54,7 +54,7 @@
* @param position The new position of the mouse cursor on the logical display
*/
virtual void notifyPointerDisplayIdChanged(ui::LogicalDisplayId displayId,
- const FloatPoint& position) = 0;
+ const vec2& position) = 0;
/* Returns true if any InputConnection is currently active. */
virtual bool isInputMethodConnectionActive() = 0;
diff --git a/services/inputflinger/include/PointerControllerInterface.h b/services/inputflinger/include/PointerControllerInterface.h
index abca209..bd46490 100644
--- a/services/inputflinger/include/PointerControllerInterface.h
+++ b/services/inputflinger/include/PointerControllerInterface.h
@@ -24,20 +24,6 @@
struct SpriteIcon;
-struct FloatPoint {
- float x;
- float y;
-
- inline FloatPoint(float x, float y) : x(x), y(y) {}
-
- inline explicit FloatPoint(vec2 p) : x(p.x), y(p.y) {}
-
- template <typename T, typename U>
- operator std::tuple<T, U>() {
- return {x, y};
- }
-};
-
/**
* Interface for tracking a mouse / touch pad pointer and touch pad spots.
*
@@ -77,13 +63,13 @@
*
* Return value may be used to move pointer to corresponding adjacent display, if it exists in
* the display-topology */
- [[nodiscard]] virtual FloatPoint move(float deltaX, float deltaY) = 0;
+ [[nodiscard]] virtual vec2 move(float deltaX, float deltaY) = 0;
/* Sets the absolute location of the pointer. */
virtual void setPosition(float x, float y) = 0;
/* Gets the absolute location of the pointer. */
- virtual FloatPoint getPosition() const = 0;
+ virtual vec2 getPosition() const = 0;
enum class Transition {
// Fade/unfade immediately.