Browse Source

Add extra multiplier and divider operator to Size

Signed-off-by: falkTX <falktx@falktx.com>
pull/282/head
falkTX 4 years ago
parent
commit
1162d24a19
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 18 additions and 0 deletions
  1. +2
    -0
      dgl/Geometry.hpp
  2. +16
    -0
      dgl/src/Geometry.cpp

+ 2
- 0
dgl/Geometry.hpp View File

@@ -219,6 +219,8 @@ public:
Size<T>& operator-=(const Size<T>& size) noexcept;
Size<T>& operator*=(double m) noexcept;
Size<T>& operator/=(double d) noexcept;
Size<T> operator*(double m) const noexcept;
Size<T> operator/(double m) const noexcept;
bool operator==(const Size<T>& size) const noexcept;
bool operator!=(const Size<T>& size) const noexcept;



+ 16
- 0
dgl/src/Geometry.cpp View File

@@ -324,6 +324,22 @@ Size<T>& Size<T>::operator/=(double d) noexcept
return *this;
}

template<typename T>
Size<T> Size<T>::operator*(const double m) const noexcept
{
Size<T> size(fWidth, fHeight);
size *= m;
return size;
}

template<typename T>
Size<T> Size<T>::operator/(const double m) const noexcept
{
Size<T> size(fWidth, fHeight);
size /= m;
return size;
}

template<typename T>
bool Size<T>::operator==(const Size<T>& size) const noexcept
{


Loading…
Cancel
Save