From 4f509caa8ed0166ef2e99846f12b7997a37c3a7e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 15 Jul 2020 01:41:07 +0300 Subject: libcamera: geometry: Give constructors to Rectangle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Niklas Söderlund --- include/libcamera/geometry.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include') 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; -- cgit v1.2.1