From b55d247679d4b47b1fc6d865b4579c814bc2bb63 Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 18 Nov 2014 03:39:36 +0000 Subject: [PATCH] Use double instead of typename T for multiply/divide operations --- dgl/Geometry.hpp | 16 ++++++++-------- dgl/src/Geometry.cpp | 32 ++++++++++++++++---------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/dgl/Geometry.hpp b/dgl/Geometry.hpp index e6d260d8..725a15e2 100644 --- a/dgl/Geometry.hpp +++ b/dgl/Geometry.hpp @@ -180,12 +180,12 @@ public: /** Grow size by @a multiplier. */ - void growBy(const T& multiplier) noexcept; + void growBy(double multiplier) noexcept; /** Shrink size by @a divider. */ - void shrinkBy(const T& divider) noexcept; + void shrinkBy(double divider) noexcept; /** Return true if size is null (0x0). @@ -215,8 +215,8 @@ public: Size& operator=(const Size& size) noexcept; Size& operator+=(const Size& size) noexcept; Size& operator-=(const Size& size) noexcept; - Size& operator*=(const T& m) noexcept; - Size& operator/=(const T& d) noexcept; + Size& operator*=(double m) noexcept; + Size& operator/=(double d) noexcept; bool operator==(const Size& size) const noexcept; bool operator!=(const Size& size) const noexcept; @@ -683,12 +683,12 @@ public: /** Grow size by @a multiplier. */ - void growBy(const T& multiplier) noexcept; + void growBy(double multiplier) noexcept; /** Shrink size by @a divider. */ - void shrinkBy(const T& divider) noexcept; + void shrinkBy(double divider) noexcept; /** Set rectangle using @a pos and @a size. @@ -731,8 +731,8 @@ public: void drawOutline(); Rectangle& operator=(const Rectangle& rect) noexcept; - Rectangle& operator*=(const T& m) noexcept; - Rectangle& operator/=(const T& d) noexcept; + Rectangle& operator*=(double m) noexcept; + Rectangle& operator/=(double d) noexcept; bool operator==(const Rectangle& size) const noexcept; bool operator!=(const Rectangle& size) const noexcept; diff --git a/dgl/src/Geometry.cpp b/dgl/src/Geometry.cpp index 9131cdd2..2b351c5d 100644 --- a/dgl/src/Geometry.cpp +++ b/dgl/src/Geometry.cpp @@ -209,17 +209,17 @@ void Size::setSize(const Size& size) noexcept } template -void Size::growBy(const T& multiplier) noexcept +void Size::growBy(double multiplier) noexcept { - fWidth = static_cast(fWidth*multiplier); - fHeight = static_cast(fHeight*multiplier); + fWidth = static_cast(static_cast(fWidth)*multiplier); + fHeight = static_cast(static_cast(fHeight)*multiplier); } template -void Size::shrinkBy(const T& divider) noexcept +void Size::shrinkBy(double divider) noexcept { - fWidth = static_cast(fWidth/divider); - fHeight = static_cast(fHeight/divider); + fWidth = static_cast(static_cast(fWidth)/divider); + fHeight = static_cast(static_cast(fHeight)/divider); } template @@ -283,18 +283,18 @@ Size& Size::operator-=(const Size& size) noexcept } template -Size& Size::operator*=(const T& m) noexcept +Size& Size::operator*=(double m) noexcept { - fWidth = static_cast(fWidth*m); - fHeight = static_cast(fHeight*m); + fWidth = static_cast(static_cast(fWidth)*m); + fHeight = static_cast(static_cast(fHeight)*m); return *this; } template -Size& Size::operator/=(const T& d) noexcept +Size& Size::operator/=(double d) noexcept { - fWidth = static_cast(fWidth/d); - fHeight = static_cast(fHeight/d); + fWidth = static_cast(static_cast(fWidth)/d); + fHeight = static_cast(static_cast(fHeight)/d); return *this; } @@ -903,13 +903,13 @@ void Rectangle::setSize(const Size& size) noexcept } template -void Rectangle::growBy(const T& multiplier) noexcept +void Rectangle::growBy(double multiplier) noexcept { fSize.growBy(multiplier); } template -void Rectangle::shrinkBy(const T& divider) noexcept +void Rectangle::shrinkBy(double divider) noexcept { fSize.shrinkBy(divider); } @@ -973,14 +973,14 @@ Rectangle& Rectangle::operator=(const Rectangle& rect) noexcept } template -Rectangle& Rectangle::operator*=(const T& m) noexcept +Rectangle& Rectangle::operator*=(double m) noexcept { fSize *= m; return *this; } template -Rectangle& Rectangle::operator/=(const T& d) noexcept +Rectangle& Rectangle::operator/=(double d) noexcept { fSize /= d; return *this;