Patch Detail
Show a patch.
GET /api/1.1/patches/21350/?format=api
{ "id": 21350, "url": "https://patchwork.libcamera.org/api/1.1/patches/21350/?format=api", "web_url": "https://patchwork.libcamera.org/patch/21350/", "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": "<20240925081551.3265942-2-chenghaoyang@google.com>", "date": "2024-09-25T08:12:24", "name": "[v8,1/3] libcamera: Add rectangle two-point constructor", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "c5a5ec5fbc408d679101ac66223b39680cc10cae", "submitter": { "id": 117, "url": "https://patchwork.libcamera.org/api/1.1/people/117/?format=api", "name": "Cheng-Hao Yang", "email": "chenghaoyang@chromium.org" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/21350/mbox/", "series": [ { "id": 4622, "url": "https://patchwork.libcamera.org/api/1.1/series/4622/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4622", "date": "2024-09-25T08:12:23", "name": "Add Face Detection Controls", "version": 8, "mbox": "https://patchwork.libcamera.org/series/4622/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/21350/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/21350/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 60282C0F1B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 25 Sep 2024 08:16:07 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 04B0A6350B;\n\tWed, 25 Sep 2024 10:16:07 +0200 (CEST)", "from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com\n\t[IPv6:2607:f8b0:4864:20::62c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 441E463502\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Sep 2024 10:16:03 +0200 (CEST)", "by mail-pl1-x62c.google.com with SMTP id\n\td9443c01a7336-205659dc63aso55246875ad.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 25 Sep 2024 01:16:03 -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-20b002aaa8fsm6336465ad.240.2024.09.25.01.15.59\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 25 Sep 2024 01:16:00 -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=\"O++BF+7f\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1727252161; x=1727856961;\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=tBhL4xEvsxdss/ASWIxhXN6eYcF3o/Wyd4aQEAOsBrg=;\n\tb=O++BF+7fQvClx7sFpwYRd8bDJ0VTaGRtisEYjwpmOyhACgtWjSm/Z7ACsKJuAffkKN\n\tZzLHODMD9QpdnZGXh3ql5UljVn+TNbirng3o97BoB/X8nCk99lC9zBDHy/6OZwEJ/a0b\n\tvXYK/+diFzybG5hVgIhYPgRWwr/s5Lslnci7w=", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1727252161; x=1727856961;\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=tBhL4xEvsxdss/ASWIxhXN6eYcF3o/Wyd4aQEAOsBrg=;\n\tb=IlYwtpIiuPC8fwFLIGu3DhiN8pk7U7r9Nt6YC7lKHxWh5vIT73gIXvbL1W7NW0IaXc\n\tWO8fB9JVsykDPEr65olVIu7pQiNXutp3CCczBgaKu4Jv8UN+SFWTHDhT2bm+Y45F+PYM\n\t7VOJkf7thky89kMgb6Xwcbz5wgkjFqbP0mrTXKm2O24EQ23NRbD5zgsAZECDKVj2K4KS\n\t9D7YXWCCErxxIac77TM3Hj7Ap4wO4MXOa76FSDMMejeMXw4+ig6vWYrLzHdK7PR7uZz8\n\txHoKxPv5nsXfScMVxH4+9sPeIh9+mpCakD3sgs/u3YRpb04/nw88x4BR4JtOtTfKZNkf\n\ti39Q==", "X-Gm-Message-State": "AOJu0YwmVyj7yDBOO8fZtKTOOP9+G8831dMwyzjwhI+v2GBaYr+RuzOE\n\tdYL+DvAna7qMGkpNPW0tL+Cen9RbrVoUGBv8GLiS9Mznz1aUf+jwKDAU2I8VSGVBtbn5c2OtrOo\n\t=", "X-Google-Smtp-Source": "AGHT+IG04SXniC3wCns0hjTy1nUbhn/ErQCqDQPo4Z+CIniqwulOJmqkBLUlqcEP5lJn6axsUp8JKQ==", "X-Received": "by 2002:a17:902:c94a:b0:202:26d:146c with SMTP id\n\td9443c01a7336-20afc42d838mr24931395ad.5.1727252160864; \n\tWed, 25 Sep 2024 01:16:00 -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 v8 1/3] libcamera: Add rectangle two-point constructor", "Date": "Wed, 25 Sep 2024 08:12:24 +0000", "Message-ID": "<20240925081551.3265942-2-chenghaoyang@google.com>", "X-Mailer": "git-send-email 2.46.0.792.g87dc391469-goog", "In-Reply-To": "<20240925081551.3265942-1-chenghaoyang@google.com>", "References": "<20240925081551.3265942-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..3c47dcdc 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 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": [ "v8", "1/3" ] }