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 <[email protected]> Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user