Rework frame layouts to use a max rectangle instead of hardcoded calculations
This commit is contained in:
parent
345ca30c3a
commit
8e64c6c170
2 changed files with 109 additions and 259 deletions
|
@ -38,6 +38,18 @@ struct Rectangle {
|
|||
T GetHeight() const {
|
||||
return std::abs(static_cast<typename std::make_signed<T>::type>(bottom - top));
|
||||
}
|
||||
Rectangle<T> TranslateX(const T x) const {
|
||||
return Rectangle{left + x, top, right + x, bottom};
|
||||
}
|
||||
Rectangle<T> TranslateY(const T y) const {
|
||||
return Rectangle{left, top + y, right, bottom + y};
|
||||
}
|
||||
Rectangle<T> Scale(const float s) const {
|
||||
ASSERT(s > 0);
|
||||
return Rectangle {
|
||||
left, top, static_cast<T>((right + left) * s), static_cast<T>((top + bottom) * s)
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace MathUtil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue