From 11b756791b9fbef476d30db65e4e2e2f1a444dad Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Fri, 23 Aug 2024 14:41:02 +0900 Subject: [PATCH] common/math: remove inlining Let the compiler decide whether to inline. --- src/common/tvgMath.cpp | 11 +++++++++++ src/common/tvgMath.h | 13 +------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/common/tvgMath.cpp b/src/common/tvgMath.cpp index eef1dabd..2b2f1b32 100644 --- a/src/common/tvgMath.cpp +++ b/src/common/tvgMath.cpp @@ -212,6 +212,17 @@ Point operator*(const Point& pt, const Matrix& m) } +Point normal(const Point& p1, const Point& p2) +{ + auto dir = p2 - p1; + auto len = length(dir); + if (tvg::zero(len)) return {}; + + auto unitDir = dir / len; + return {-unitDir.y, unitDir.x}; +} + + float Line::length() const { return _lineLength(pt1, pt2); diff --git a/src/common/tvgMath.h b/src/common/tvgMath.h index 692ca2c1..71509d57 100644 --- a/src/common/tvgMath.h +++ b/src/common/tvgMath.h @@ -165,7 +165,7 @@ static inline void log(const Matrix& m) void operator*=(Point& pt, const Matrix& m); Point operator*(const Point& pt, const Matrix& m); - +Point normal(const Point& p1, const Point& p2); static inline bool zero(const Point& p) { @@ -233,17 +233,6 @@ static inline Point operator/(const Point& lhs, const float rhs) } -static inline Point normal(const Point& p1, const Point& p2) -{ - auto dir = p2 - p1; - auto len = length(dir); - if (tvg::zero(len)) return {}; - - auto unitDir = dir / len; - return {-unitDir.y, unitDir.x}; -} - - static inline void log(const Point& pt) { TVGLOG("COMMON", "Point: [%f %f]", pt.x, pt.y);