aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/GraphicsBase.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/GraphicsBase.h')
-rw-r--r--include/cru/platform/GraphicsBase.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/cru/platform/GraphicsBase.h b/include/cru/platform/GraphicsBase.h
index 43c36494..89d3df77 100644
--- a/include/cru/platform/GraphicsBase.h
+++ b/include/cru/platform/GraphicsBase.h
@@ -56,6 +56,16 @@ struct Size final {
std::numeric_limits<float>::max()};
}
+ constexpr Size Min(const Size& other) const {
+ return {std::min(width, other.width), std::min(height, other.height)};
+ }
+
+ constexpr Size Max(const Size& other) const {
+ return {std::max(width, other.width), std::max(height, other.height)};
+ }
+
+ constexpr Size AtLeast0() const { return Max(kZero); }
+
std::string ToString() const {
return std::format("Size(width: {}, height: {})", width, height);
}
@@ -93,6 +103,10 @@ struct Thickness final {
constexpr float GetVerticalTotal() const { return top + bottom; }
+ constexpr Size GetTotalSize() const {
+ return {GetHorizontalTotal(), GetVerticalTotal()};
+ }
+
void SetLeftRight(const float value) { left = right = value; }
void SetTopBottom(const float value) { top = bottom = value; }