diff --git a/Libraries/LibDraw/Point.h b/Libraries/LibDraw/Point.h index 6c958143f9..d08068cbeb 100644 --- a/Libraries/LibDraw/Point.h +++ b/Libraries/LibDraw/Point.h @@ -1,7 +1,7 @@ #pragma once -#include #include +#include #include class Rect; @@ -107,14 +107,20 @@ public: set_y(value); } - // Returns pixels moved from other in either direction - int pixels_moved(const Point &other) const + int dx_relative_to(const Point& other) const { - auto pixels_moved = max( - abs(other.x() - x()), - abs(other.y() - y()) - ); - return pixels_moved; + return x() - other.x(); + } + + int dy_relative_to(const Point& other) const + { + return y() - other.y(); + } + + // Returns pixels moved from other in either direction + int pixels_moved(const Point& other) const + { + return max(abs(dx_relative_to(other)), abs(dy_relative_to(other))); } private: