Patch Detail
Show a patch.
GET /api/1.1/patches/21441/?format=api
{ "id": 21441, "url": "https://patchwork.libcamera.org/api/1.1/patches/21441/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21441/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20240930195915.152187-3-jacopo.mondi@ideasonboard.com>", "date": "2024-09-30T19:59:10", "name": "[v9,2/5] libcamera: geometry: Add two-point Rectangle constructor", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "02f143b45c1e15dcb94cf98d18f4db2dfc483c1f", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21441/mbox/", "series": [ { "id": 4642, "url": "https://patchwork.libcamera.org/api/1.1/series/4642/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4642", "date": "2024-09-30T19:59:08", "name": "Add Face Detection Controls", "version": 9, "mbox": "https://patchwork.libcamera.org/series/4642/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21441/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21441/checks/", "tags": {}, "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 2B316C3257\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 30 Sep 2024 19:59:42 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C0B5563517;\n\tMon, 30 Sep 2024 21:59:40 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7933163517\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 30 Sep 2024 21:59:32 +0200 (CEST)", "from ideasonboard.com (unknown [95.131.46.153])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7BE9DFB8;\n\tMon, 30 Sep 2024 21:58:00 +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=\"bNgolEag\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1727726281;\n\tbh=k2+c5+LRuyKaS5oPPCgMPKAhfdHGfVjtixSJ+6RwFks=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=bNgolEageXc5BgRBkMbhkJxVR80c0NUuLZEatHuxSBhj8ZLAB2Zgjh01w9dOf9xPq\n\tKafrMxKVHGcu2F/TMrkYsZ5OveKx3JFC57s7T/WKGVYnv+DvKfwZ/CB6g/rZKQ1bJJ\n\t/txTNUsq5iPtaJcDELZvYqXdRi4VQCwFYQ53xI5c=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tHarvey Yang <chenghaoyang@google.com>,\n\tYudhistira Erlandinata <yerlandinata@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>", "Subject": "[PATCH v9 2/5] libcamera: geometry: Add two-point Rectangle\n\tconstructor", "Date": "Mon, 30 Sep 2024 21:59:10 +0200", "Message-ID": "<20240930195915.152187-3-jacopo.mondi@ideasonboard.com>", "X-Mailer": "git-send-email 2.46.1", "In-Reply-To": "<20240930195915.152187-1-jacopo.mondi@ideasonboard.com>", "References": "<20240930195915.152187-1-jacopo.mondi@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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>" }, "content": "From: Yudhistira Erlandinata <yerlandinata@chromium.org>\n\nAdd a constructor to the Rectangle class that accepts two points.\n\nThe constructed Rectangle spans all the space between the two given\npoints.\n\nSigned-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n include/libcamera/geometry.h | 7 +++++\n src/libcamera/geometry.cpp | 58 ++++++++++++++++++++++++++++++++++++\n test/geometry.cpp | 14 +++++++++\n 3 files changed, 79 insertions(+)", "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex 3e6f0f5d7fab..2cc25f1facd9 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -262,6 +262,13 @@ public:\n \t{\n \t}\n \n+\tconstexpr Rectangle(const Point &point1, const Point &point2)\n+\t\t: Rectangle(std::min(point1.x, point2.x), std::min(point1.y, point2.y),\n+\t\t\t std::max(point1.x, point2.x) - std::min(point1.x, point2.x),\n+\t\t\t std::max(point1.y, point2.y) - std::min(point1.y, point2.y))\n+\t{\n+\t}\n+\n \tint x;\n \tint y;\n \tunsigned int width;\ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex 6eb432e5d803..5e5e72e15d67 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -715,6 +715,64 @@ 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 &point1, const Point &point2)\n+ * \\brief Construct a Rectangle with the two given points\n+ * \\param[in] point1 One of corners of the rectangle\n+ * \\param[in] point2 The opposite diagonal corner point of \\a point1\n+ *\n+ * Contruct a rectangle that spans the space between two given points. The\n+ * position of the two given points is not relevant for the rectangle's\n+ * contruction.\n+ *\n+ * \\verbatim\n+\n+ p1 = point1\n+ p2 = point2\n+\n+ ^\n+ |\n+ | ----------------p2\n+ | | |\n+ | | |\n+ | p1----------------\n+ |\n+ o------------------------------->\n+ (0,0)\n+\n+ ^\n+ |\n+ | p1----------------\n+ | | |\n+ | | |\n+ | ----------------p2\n+ |\n+ o------------------------------->\n+ (0,0)\n+\n+ ^\n+ |\n+ | ----------------p1\n+ | | |\n+ | | |\n+ | p2----------------\n+ |\n+ o------------------------------->\n+ (0,0)\n+\n+ ^\n+ |\n+ | p2----------------\n+ | | |\n+ | | |\n+ | ----------------p1\n+ |\n+ o------------------------------->\n+ (0,0)\n+\n+ \\endverbatim\n+ */\n+\n /**\n * \\var Rectangle::x\n * \\brief The horizontal coordinate of the rectangle's top-left corner\ndiff --git a/test/geometry.cpp b/test/geometry.cpp\nindex 64169206ad16..5760fa3c885a 100644\n--- a/test/geometry.cpp\n+++ b/test/geometry.cpp\n@@ -481,6 +481,20 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\tPoint topLeft(3, 3);\n+\t\tPoint bottomRight(30, 30);\n+\t\tPoint topRight(30, 3);\n+\t\tPoint bottomLeft(3, 30);\n+\t\tRectangle rect1(topLeft, bottomRight);\n+\t\tRectangle rect2(topRight, bottomLeft);\n+\t\tRectangle rect3(bottomRight, topLeft);\n+\t\tRectangle rect4(bottomLeft, topRight);\n+\n+\t\tif (rect1 != rect2 || rect1 != rect3 || rect1 != rect4) {\n+\t\t\tcout << \"Point-to-point construction failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n };\n", "prefixes": [ "v9", "2/5" ] }