mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
BRect: add 2 argument width, height constructor
Left top position will be set to zero. It is a common pattern to define `BRect` value with only width and height so it allow to simplify code a bit. Change-Id: Ie14644843324c9e5bcc55e7cfbd557a8884559d3 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8535 Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org> Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
parent
2b0aa4245b
commit
8776466030
@ -26,6 +26,7 @@ public:
|
||||
BRect(BPoint leftTop, BPoint rightBottom);
|
||||
BRect(BPoint leftTop, BSize size);
|
||||
BRect(float side);
|
||||
BRect(float width, float height);
|
||||
|
||||
BRect& operator=(const BRect& other);
|
||||
void Set(float left, float top, float right,
|
||||
@ -182,6 +183,17 @@ BRect::BRect(float side)
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
BRect::BRect(float width, float height)
|
||||
:
|
||||
left(0),
|
||||
top(0),
|
||||
right(width),
|
||||
bottom(height)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline BRect&
|
||||
BRect::operator=(const BRect& other)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user