aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/GraphBase.hpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-07-25 23:57:16 +0800
committercrupest <crupest@outlook.com>2020-07-25 23:57:16 +0800
commit23bf673f9582d7bc99eb6440be1df0cf5c43b725 (patch)
treed4715f526d14d2f3367358e5ba7d987b92df7fd7 /include/cru/platform/GraphBase.hpp
parent83736f1208a613d2457147c2df3f493228bab3cb (diff)
downloadcru-23bf673f9582d7bc99eb6440be1df0cf5c43b725.tar.gz
cru-23bf673f9582d7bc99eb6440be1df0cf5c43b725.tar.bz2
cru-23bf673f9582d7bc99eb6440be1df0cf5c43b725.zip
Implement ScrollRenderObject::ScrollToContain .
Diffstat (limited to 'include/cru/platform/GraphBase.hpp')
-rw-r--r--include/cru/platform/GraphBase.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/cru/platform/GraphBase.hpp b/include/cru/platform/GraphBase.hpp
index 28dab1e6..e476e3cd 100644
--- a/include/cru/platform/GraphBase.hpp
+++ b/include/cru/platform/GraphBase.hpp
@@ -161,6 +161,12 @@ struct Rect final {
constexpr Size GetSize() const { return Size(width, height); }
+ constexpr Rect Expand(const Thickness& thickness) const {
+ return Rect(left - thickness.left, top - thickness.top,
+ width + thickness.GetHorizontalTotal(),
+ height + thickness.GetVerticalTotal());
+ }
+
constexpr Rect Shrink(const Thickness& thickness) const {
return Rect(left + thickness.left, top + thickness.top,
width - thickness.GetHorizontalTotal(),