[{"id":31020,"web_url":"https://patchwork.libcamera.org/comment/31020/","msgid":"<vsicbk3ngnaejptyow2qxomuj3xjywy77vhagwiderqwnkx47p@uaq2sjzkjs6x>","date":"2024-08-31T14:02:47","subject":"Re: [PATCH v3 1/3] libcamera: Add rectangle two-point constructor","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Harvey\n\nOn Fri, Aug 30, 2024 at 09:00:19PM GMT, Harvey Yang wrote:\n> From: Yudhistira Erlandinata <yerlandinata@chromium.org>\n>\n> Add a Rectangle constructor that accepts two points:\n> topLeft and bottomRight.\n>\n> Signed-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org>\n> Co-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n> ---\n>  include/libcamera/geometry.h |  2 ++\n>  src/libcamera/geometry.cpp   | 14 ++++++++++++++\n>  2 files changed, 16 insertions(+)\n>\n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index 3e6f0f5d7..dc56f180f 100644\n> --- a/include/libcamera/geometry.h\n> +++ b/include/libcamera/geometry.h\n> @@ -262,6 +262,8 @@ public:\n>  \t{\n>  \t}\n>\n> +\tconstexpr Rectangle(const Point &topLeft, const Point &bottomRight);\n> +\n>  \tint x;\n>  \tint y;\n>  \tunsigned int width;\n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 000151364..029b8dad2 100644\n> --- a/src/libcamera/geometry.cpp\n> +++ b/src/libcamera/geometry.cpp\n> @@ -629,6 +629,20 @@ std::ostream &operator<<(std::ostream &out, const SizeRange &sr)\n>   * \\param[in] size The desired Rectangle size\n>   */\n>\n> +/**\n> + * \\fn Rectangle::Rectangle(const Point &topLeft, const Point &bottomRight)\n> + * \\brief Construct a Rectangle with the two given points\n> + * \\param[in] topLeft The top-left corner\n> + * \\param[in] bottomRight The bottom-right corner\n> + */\n> +constexpr Rectangle::Rectangle(const Point &topLeft, const Point &bottomRight)\n> +\t: x(topLeft.x), y(topLeft.y),\n> +\t  width(bottomRight.x - x),\n> +\t  height(bottomRight.y - y)\n> +{\n> +\tASSERT(bottomRight.x >= x && bottomRight.y >= y);\n> +}\n> +\n>  /**\n>   * \\var Rectangle::x\n>   * \\brief The horizontal coordinate of the rectangle's top-left corner\n> --\n> 2.46.0.469.g59c65b2a67-goog\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3E715C324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 31 Aug 2024 14:02:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 29D8A634C8;\n\tSat, 31 Aug 2024 16:02:53 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BA62A6345D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 31 Aug 2024 16:02:51 +0200 (CEST)","from ideasonboard.com (mob-5-90-57-33.net.vodafone.it [5.90.57.33])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AD798667;\n\tSat, 31 Aug 2024 16:01:41 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"upxYGHV2\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1725112901;\n\tbh=bwMxLmecXn8v+Dq6K54fz9BOzZyaCS2BVKllVnfRiqo=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=upxYGHV283l/EFM7lVNhN0+bAE4QT0lxAGxZ+TcRg7t665Zg4bmiEmCBeBi1x0BRP\n\t3AAxohZqruDZcoAjjYKR64D1ISoyueAH9/9RjXqHGrxplflEUmNHJbOdSu5MJiqUtU\n\tY2zGa0wbBaHT7XxxnXBFcPost84K5ts/YF5f0UMQ=","Date":"Sat, 31 Aug 2024 16:02:47 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Harvey Yang <chenghaoyang@chromium.org>","Cc":"libcamera-devel@lists.libcamera.org, \n\tYudhistira Erlandinata <yerlandinata@chromium.org>","Subject":"Re: [PATCH v3 1/3] libcamera: Add rectangle two-point constructor","Message-ID":"<vsicbk3ngnaejptyow2qxomuj3xjywy77vhagwiderqwnkx47p@uaq2sjzkjs6x>","References":"<20240830210313.30691-1-chenghaoyang@chromium.org>\n\t<20240830210313.30691-2-chenghaoyang@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240830210313.30691-2-chenghaoyang@chromium.org>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]