DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit b55d247679d4b47b1fc6d865b4579c814bc2bb63
parent dc46fcb3c813e01d8a71d6292c5d7be4251ac077
Author: falkTX <falktx@gmail.com>
Date:   Tue, 18 Nov 2014 03:39:11 +0000

Use double instead of typename T for multiply/divide operations

Diffstat:
Mdgl/Geometry.hpp | 16++++++++--------
Mdgl/src/Geometry.cpp | 32++++++++++++++++----------------
2 files changed, 24 insertions(+), 24 deletions(-)

diff --git 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<T>& operator=(const Size<T>& size) noexcept; Size<T>& operator+=(const Size<T>& size) noexcept; Size<T>& operator-=(const Size<T>& size) noexcept; - Size<T>& operator*=(const T& m) noexcept; - Size<T>& operator/=(const T& d) noexcept; + Size<T>& operator*=(double m) noexcept; + Size<T>& operator/=(double d) noexcept; bool operator==(const Size<T>& size) const noexcept; bool operator!=(const Size<T>& 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<T>& operator=(const Rectangle<T>& rect) noexcept; - Rectangle<T>& operator*=(const T& m) noexcept; - Rectangle<T>& operator/=(const T& d) noexcept; + Rectangle<T>& operator*=(double m) noexcept; + Rectangle<T>& operator/=(double d) noexcept; bool operator==(const Rectangle<T>& size) const noexcept; bool operator!=(const Rectangle<T>& size) const noexcept; diff --git a/dgl/src/Geometry.cpp b/dgl/src/Geometry.cpp @@ -209,17 +209,17 @@ void Size<T>::setSize(const Size<T>& size) noexcept } template<typename T> -void Size<T>::growBy(const T& multiplier) noexcept +void Size<T>::growBy(double multiplier) noexcept { - fWidth = static_cast<T>(fWidth*multiplier); - fHeight = static_cast<T>(fHeight*multiplier); + fWidth = static_cast<T>(static_cast<double>(fWidth)*multiplier); + fHeight = static_cast<T>(static_cast<double>(fHeight)*multiplier); } template<typename T> -void Size<T>::shrinkBy(const T& divider) noexcept +void Size<T>::shrinkBy(double divider) noexcept { - fWidth = static_cast<T>(fWidth/divider); - fHeight = static_cast<T>(fHeight/divider); + fWidth = static_cast<T>(static_cast<double>(fWidth)/divider); + fHeight = static_cast<T>(static_cast<double>(fHeight)/divider); } template<typename T> @@ -283,18 +283,18 @@ Size<T>& Size<T>::operator-=(const Size<T>& size) noexcept } template<typename T> -Size<T>& Size<T>::operator*=(const T& m) noexcept +Size<T>& Size<T>::operator*=(double m) noexcept { - fWidth = static_cast<T>(fWidth*m); - fHeight = static_cast<T>(fHeight*m); + fWidth = static_cast<T>(static_cast<double>(fWidth)*m); + fHeight = static_cast<T>(static_cast<double>(fHeight)*m); return *this; } template<typename T> -Size<T>& Size<T>::operator/=(const T& d) noexcept +Size<T>& Size<T>::operator/=(double d) noexcept { - fWidth = static_cast<T>(fWidth/d); - fHeight = static_cast<T>(fHeight/d); + fWidth = static_cast<T>(static_cast<double>(fWidth)/d); + fHeight = static_cast<T>(static_cast<double>(fHeight)/d); return *this; } @@ -903,13 +903,13 @@ void Rectangle<T>::setSize(const Size<T>& size) noexcept } template<typename T> -void Rectangle<T>::growBy(const T& multiplier) noexcept +void Rectangle<T>::growBy(double multiplier) noexcept { fSize.growBy(multiplier); } template<typename T> -void Rectangle<T>::shrinkBy(const T& divider) noexcept +void Rectangle<T>::shrinkBy(double divider) noexcept { fSize.shrinkBy(divider); } @@ -973,14 +973,14 @@ Rectangle<T>& Rectangle<T>::operator=(const Rectangle<T>& rect) noexcept } template<typename T> -Rectangle<T>& Rectangle<T>::operator*=(const T& m) noexcept +Rectangle<T>& Rectangle<T>::operator*=(double m) noexcept { fSize *= m; return *this; } template<typename T> -Rectangle<T>& Rectangle<T>::operator/=(const T& d) noexcept +Rectangle<T>& Rectangle<T>::operator/=(double d) noexcept { fSize /= d; return *this;