libcamera: geometry: Give constructors to Rectangle
Rectangle, unlike Size, has no constructor, requiring the users to explicitly initialize the instances. This is error-prone, add constructors. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -127,6 +127,21 @@ static inline bool operator!=(const SizeRange &lhs, const SizeRange &rhs)
|
||||
}
|
||||
|
||||
struct Rectangle {
|
||||
Rectangle()
|
||||
: Rectangle(0, 0, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
Rectangle(int xpos, int ypos, const Size &size)
|
||||
: x(xpos), y(ypos), width(size.width), height(size.height)
|
||||
{
|
||||
}
|
||||
|
||||
Rectangle(int xpos, int ypos, unsigned int w, unsigned int h)
|
||||
: x(xpos), y(ypos), width(w), height(h)
|
||||
{
|
||||
}
|
||||
|
||||
int x;
|
||||
int y;
|
||||
unsigned int width;
|
||||
|
||||
Reference in New Issue
Block a user