diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/math/rect2.h | 32 | ||||
-rw-r--r-- | core/variant/variant_call.cpp | 8 |
2 files changed, 20 insertions, 20 deletions
diff --git a/core/math/rect2.h b/core/math/rect2.h index aecba9e88c..3159447d0a 100644 --- a/core/math/rect2.h +++ b/core/math/rect2.h @@ -180,16 +180,16 @@ struct Rect2 { bool operator==(const Rect2 &p_rect) const { return position == p_rect.position && size == p_rect.size; } bool operator!=(const Rect2 &p_rect) const { return position != p_rect.position || size != p_rect.size; } - inline Rect2 grow(real_t p_by) const { + inline Rect2 grow(real_t p_amount) const { Rect2 g = *this; - g.position.x -= p_by; - g.position.y -= p_by; - g.size.width += p_by * 2; - g.size.height += p_by * 2; + g.position.x -= p_amount; + g.position.y -= p_amount; + g.size.width += p_amount * 2; + g.size.height += p_amount * 2; return g; } - inline Rect2 grow_margin(Side p_side, real_t p_amount) const { + inline Rect2 grow_side(Side p_side, real_t p_amount) const { Rect2 g = *this; g = g.grow_individual((SIDE_LEFT == p_side) ? p_amount : 0, (SIDE_TOP == p_side) ? p_amount : 0, @@ -198,8 +198,8 @@ struct Rect2 { return g; } - inline Rect2 grow_margin_bind(uint32_t p_side, real_t p_amount) const { - return grow_margin(Side(p_side), p_amount); + inline Rect2 grow_side_bind(uint32_t p_side, real_t p_amount) const { + return grow_side(Side(p_side), p_amount); } inline Rect2 grow_individual(real_t p_left, real_t p_top, real_t p_right, real_t p_bottom) const { @@ -422,16 +422,16 @@ struct Rect2i { bool operator==(const Rect2i &p_rect) const { return position == p_rect.position && size == p_rect.size; } bool operator!=(const Rect2i &p_rect) const { return position != p_rect.position || size != p_rect.size; } - Rect2i grow(int p_by) const { + Rect2i grow(int p_amount) const { Rect2i g = *this; - g.position.x -= p_by; - g.position.y -= p_by; - g.size.width += p_by * 2; - g.size.height += p_by * 2; + g.position.x -= p_amount; + g.position.y -= p_amount; + g.size.width += p_amount * 2; + g.size.height += p_amount * 2; return g; } - inline Rect2i grow_margin(Side p_side, int p_amount) const { + inline Rect2i grow_side(Side p_side, int p_amount) const { Rect2i g = *this; g = g.grow_individual((SIDE_LEFT == p_side) ? p_amount : 0, (SIDE_TOP == p_side) ? p_amount : 0, @@ -440,8 +440,8 @@ struct Rect2i { return g; } - inline Rect2i grow_margin_bind(uint32_t p_side, int p_amount) const { - return grow_margin(Side(p_side), p_amount); + inline Rect2i grow_side_bind(uint32_t p_side, int p_amount) const { + return grow_side(Side(p_side), p_amount); } inline Rect2i grow_individual(int p_left, int p_top, int p_right, int p_bottom) const { diff --git a/core/variant/variant_call.cpp b/core/variant/variant_call.cpp index 2b6364786e..6be2f435bf 100644 --- a/core/variant/variant_call.cpp +++ b/core/variant/variant_call.cpp @@ -1036,8 +1036,8 @@ static void _register_variant_builtin_methods() { bind_method(Rect2, intersection, sarray("b"), varray()); bind_method(Rect2, merge, sarray("b"), varray()); bind_method(Rect2, expand, sarray("to"), varray()); - bind_method(Rect2, grow, sarray("by"), varray()); - bind_methodv(Rect2, grow_margin, &Rect2::grow_margin_bind, sarray("margin", "by"), varray()); + bind_method(Rect2, grow, sarray("amount"), varray()); + bind_methodv(Rect2, grow_side, &Rect2::grow_side_bind, sarray("side", "amount"), varray()); bind_method(Rect2, grow_individual, sarray("left", "top", "right", "bottom"), varray()); bind_method(Rect2, abs, sarray(), varray()); @@ -1051,8 +1051,8 @@ static void _register_variant_builtin_methods() { bind_method(Rect2i, intersection, sarray("b"), varray()); bind_method(Rect2i, merge, sarray("b"), varray()); bind_method(Rect2i, expand, sarray("to"), varray()); - bind_method(Rect2i, grow, sarray("by"), varray()); - bind_methodv(Rect2i, grow_margin, &Rect2i::grow_margin_bind, sarray("margin", "by"), varray()); + bind_method(Rect2i, grow, sarray("amount"), varray()); + bind_methodv(Rect2i, grow_side, &Rect2i::grow_side_bind, sarray("side", "amount"), varray()); bind_method(Rect2i, grow_individual, sarray("left", "top", "right", "bottom"), varray()); bind_method(Rect2i, abs, sarray(), varray()); |