Patch Detail
Show a patch.
GET /api/patches/21335/?format=api
{ "id": 21335, "url": "https://patchwork.libcamera.org/api/patches/21335/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21335/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20240923144921.1729183-2-chenghaoyang@google.com>", "date": "2024-09-23T14:45:03", "name": "[v6,1/3] libcamera: Add rectangle two-point constructor", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "215bfdb5245c964a10405bdcdd44e0940a736f19", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21335/mbox/", "series": [ { "id": 4615, "url": "https://patchwork.libcamera.org/api/series/4615/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4615", "date": "2024-09-23T14:45:02", "name": "Add Face Detection Controls", "version": 6, "mbox": "https://patchwork.libcamera.org/series/4615/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21335/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21335/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 D50C6C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Sep 2024 14:49:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4683D63513;\n\tMon, 23 Sep 2024 16:49:33 +0200 (CEST)", "from mail-pl1-x633.google.com (mail-pl1-x633.google.com\n\t[IPv6:2607:f8b0:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19488618DE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 16:49:31 +0200 (CEST)", "by mail-pl1-x633.google.com with SMTP id\n\td9443c01a7336-2053525bd90so40746725ad.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 23 Sep 2024 07:49:31 -0700 (PDT)", "from chenghaoyang-low.c.googlers.com.com\n\t(0.223.81.34.bc.googleusercontent.com. [34.81.223.0])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-20794735719sm133857435ad.275.2024.09.23.07.49.28\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 23 Sep 2024 07:49:28 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Y8dMUsPH\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1727102969; x=1727707769;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=5+PG4w4fqPObQDpO2iRBORfJQmqvEOjWQ7wghuQIuCM=;\n\tb=Y8dMUsPHswF6CM4XXlZbEKRYL4syUuzNFT3UCcARJ2a5fj4+vDHUZQpqDCc7jtQJ6g\n\tgBBgkVYgMvSaRcMSG/qPeOBe2ji4TNorN+G6AO5ozx8Or6Zcav+dYBzGMqx7fYlSoYWQ\n\tLJaONzLcO60l8O9n33KXIrLqzL5HRCc3PsQec=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727102969; x=1727707769;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=5+PG4w4fqPObQDpO2iRBORfJQmqvEOjWQ7wghuQIuCM=;\n\tb=MDvVV/kkpgS3VCqCEksZaR1hpPElfh65UjlW7CRn7B5XsqzOT9IKg7MWvZjZad8M6D\n\tvjR+IU/Oz9J3uoYGE1/LJkA48EohIKEBUAEMqv9PO9aCZdKBC6v72Hr36ZABvCpx1T5e\n\tGfVWzM+WZnKekhSh8BitSgjyhi/Vh3Mnq5ApyaHBIruFSFv+Ev+dGokLfjAS74LhU550\n\t6+ykkZPdAPw2Mu3V+DCErNjbYdmkssPmUkALoVHpAiQeI8X/Yu+KfN0tUaDdlSZM5X94\n\tHcFlwJTaXjbKC0JsbsOHf3rNUROlM0kGFOTLEDrYQ76o6tDccchPEUjdD7zxlv017iuz\n\t8DzQ==", "X-Gm-Message-State": "AOJu0YxGfsLn0Z9dRDKs6zqj82Bw+PFGfP7JoGSoeSR/BXtQfTbA3lrc\n\tPR9r5Vcs9DLSvvdF0SpWiSSKheuKNgMl0BbEMJaHGPsWxdAfXgUjhwXDQQDhYwrWEt4O9QHGLl0\n\t=", "X-Google-Smtp-Source": "AGHT+IGJ+LkT4qW5QHTQHV79ZeSYa4dQ9PPMCCUoGWi6U7Ugf9vM0c7hUvAc3j5RGTw4AGMHP2MGcA==", "X-Received": "by 2002:a17:902:fc4c:b0:202:2ee4:16ce with SMTP id\n\td9443c01a7336-208d85aac00mr153039765ad.61.1727102969322; \n\tMon, 23 Sep 2024 07:49:29 -0700 (PDT)", "From": "Harvey Yang <chenghaoyang@chromium.org>", "X-Google-Original-From": "Harvey Yang <chenghaoyang@google.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Yudhistira Erlandinata <yerlandinata@chromium.org>,\n\tHarvey Yang <chenghaoyang@chromium.org>,\n\tJacopo Mondi <jacopo.mondi@ideasonboard.com>", "Subject": "[PATCH v6 1/3] libcamera: Add rectangle two-point constructor", "Date": "Mon, 23 Sep 2024 14:45:03 +0000", "Message-ID": "<20240923144921.1729183-2-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.46.0.792.g87dc391469-goog", "In-Reply-To": "<20240923144921.1729183-1-chenghaoyang@google.com>", "References": "<20240923144921.1729183-1-chenghaoyang@google.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 Rectangle constructor that accepts two points:\ntopLeft and bottomRight.\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>\n---\n include/libcamera/geometry.h | 7 +++++++\n src/libcamera/geometry.cpp | 7 +++++++\n test/geometry.cpp | 14 ++++++++++++++\n 3 files changed, 28 insertions(+)", "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex 3e6f0f5d..5949d55c 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::max(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 00015136..b608e4f0 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -629,6 +629,13 @@ 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 the corner point of the rectangle\n+ * \\param[in] point2 The diagonal corner point from \\a point1\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 64169206..3ed2cc23 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-from-point construction failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\treturn TestPass;\n \t}\n };\n", "prefixes": [ "v6", "1/3" ] }