Skip to content

Commit 25753a1

Browse files
committed
Less code duplication, pass Vector value by reference
1 parent 113eb9c commit 25753a1

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/math/rectf.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,7 @@ class Rectf final
154154
*/
155155
Rectf grown(float border) const
156156
{
157-
// If the size would be shrunk below 0, do not resize.
158-
if (m_size.width + border * 2 < 0.f || m_size.height + border * 2 < 0.f)
159-
return *this;
160-
161-
return Rectf(m_p1.x - border, m_p1.y - border,
162-
get_right() + border, get_bottom() + border);
157+
return grown(Vector(border, border));
163158
}
164159

165160
/**
@@ -168,7 +163,7 @@ class Rectf final
168163
* @param border The passed vector contains the horizontal amount as first component and the vertical amount
169164
* as the second component.
170165
*/
171-
Rectf grown(Vector border) const
166+
Rectf grown(const Vector& border) const
172167
{
173168
// If the size would be shrunk below 0, do not resize.
174169
if (m_size.width + border.x * 2 < 0.f || m_size.height + border.y * 2 < 0.f)

0 commit comments

Comments
 (0)