aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/cru/platform/GraphicsBase.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/include/cru/platform/GraphicsBase.h b/include/cru/platform/GraphicsBase.h
index 14c5d926..78a1c1a6 100644
--- a/include/cru/platform/GraphicsBase.h
+++ b/include/cru/platform/GraphicsBase.h
@@ -113,10 +113,6 @@ struct Thickness final {
void SetAll(const float value) { left = top = right = bottom = value; }
- constexpr float Validate() const {
- return left >= 0.0 && top >= 0.0 && right >= 0.0 && bottom >= 0.0;
- }
-
constexpr bool operator==(const Thickness& other) const = default;
float left;
@@ -139,6 +135,20 @@ constexpr Thickness operator+(const Thickness& left, const Thickness& right) {
left.right + right.right, left.bottom + right.bottom};
}
+constexpr Thickness operator*(const Thickness& thickness, float scale) {
+ return {thickness.left * scale, thickness.top * scale,
+ thickness.right * scale, thickness.bottom * scale};
+}
+
+constexpr Thickness operator*(float scale, const Thickness& thickness) {
+ return operator*(thickness, scale);
+}
+
+constexpr Thickness operator/(const Thickness& thickness, float scale) {
+ return {thickness.left / scale, thickness.top / scale,
+ thickness.right / scale, thickness.bottom / scale};
+}
+
struct Rect final {
constexpr Rect() = default;
constexpr Rect(const float left, const float top, const float width,