diff options
| author | 2016-11-15 19:57:08 -0500 | |
|---|---|---|
| committer | 2016-11-15 19:57:08 -0500 | |
| commit | 5a31552764dc8970253e642f4b829a8b785375c6 (patch) | |
| tree | 8186a82c37ae04c17bd1d6250c524fc097f9671c /src/common/math_util.h | |
| parent | Merge pull request #2171 from jroweboy/fix-mac-build (diff) | |
| parent | Round the rectangle size to prevent float to int casting issues (diff) | |
| download | yuzu-5a31552764dc8970253e642f4b829a8b785375c6.tar.gz yuzu-5a31552764dc8970253e642f4b829a8b785375c6.tar.xz yuzu-5a31552764dc8970253e642f4b829a8b785375c6.zip | |
Merge pull request #1753 from jroweboy/frame_layouts
Support additional screen layouts.
Diffstat (limited to 'src/common/math_util.h')
| -rw-r--r-- | src/common/math_util.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/common/math_util.h b/src/common/math_util.h index 41d89666c..cdeaeb733 100644 --- a/src/common/math_util.h +++ b/src/common/math_util.h | |||
| @@ -38,6 +38,16 @@ struct Rectangle { | |||
| 38 | T GetHeight() const { | 38 | T GetHeight() const { |
| 39 | return std::abs(static_cast<typename std::make_signed<T>::type>(bottom - top)); | 39 | return std::abs(static_cast<typename std::make_signed<T>::type>(bottom - top)); |
| 40 | } | 40 | } |
| 41 | Rectangle<T> TranslateX(const T x) const { | ||
| 42 | return Rectangle{left + x, top, right + x, bottom}; | ||
| 43 | } | ||
| 44 | Rectangle<T> TranslateY(const T y) const { | ||
| 45 | return Rectangle{left, top + y, right, bottom + y}; | ||
| 46 | } | ||
| 47 | Rectangle<T> Scale(const float s) const { | ||
| 48 | return Rectangle{left, top, static_cast<T>(left + GetWidth() * s), | ||
| 49 | static_cast<T>(top + GetHeight() * s)}; | ||
| 50 | } | ||
| 41 | }; | 51 | }; |
| 42 | 52 | ||
| 43 | } // namespace MathUtil | 53 | } // namespace MathUtil |