summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-15 01:41:07 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-07-15 17:29:59 +0300
commit4f509caa8ed0166ef2e99846f12b7997a37c3a7e (patch)
tree5ff55b3f5a5948e3a0d00333143f71f1ce97f0a8 /include
parent935aec66ae50ec2448e052c95757b2a83e3999ba (diff)
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>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/geometry.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h
index f3088d33..380248ac 100644
--- a/include/libcamera/geometry.h
+++ b/include/libcamera/geometry.h
@@ -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;