Show a patch.

GET /api/1.1/patches/21003/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 21003,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/21003/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/21003/",
    "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": "<20240823143205.2668765-2-chenghaoyang@google.com>",
    "date": "2024-08-23T14:29:08",
    "name": "[v2,1/3] libcamera: Add rectangle two-point constructor",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "850c410e223c613c0237ca19a21fb2f34a547aae",
    "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/21003/mbox/",
    "series": [
        {
            "id": 4536,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4536/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4536",
            "date": "2024-08-23T14:29:07",
            "name": "Add Face Detection Controls",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/4536/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/21003/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/21003/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 348DDBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 23 Aug 2024 14:32:18 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ABCFF633CF;\n\tFri, 23 Aug 2024 16:32:14 +0200 (CEST)",
            "from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D49F6633CB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Aug 2024 16:32:09 +0200 (CEST)",
            "by mail-wr1-x42a.google.com with SMTP id\n\tffacd0b85a97d-3719896b7c8so995207f8f.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 23 Aug 2024 07:32:09 -0700 (PDT)",
            "from chenghaoyang-germany.c.googlers.com.com\n\t(161.126.77.34.bc.googleusercontent.com. [34.77.126.161])\n\tby smtp.gmail.com with ESMTPSA id\n\tffacd0b85a97d-373081ffb66sm4300627f8f.84.2024.08.23.07.32.08\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 23 Aug 2024 07:32:08 -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=\"mDObCun8\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=chromium.org; s=google; t=1724423529; x=1725028329;\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=IDX86hfigYN0gC08TEOpl2L7+W79GzBQ1t4h96ImMug=;\n\tb=mDObCun8ewi3ZySg2kNfGt/Z/AelQwouR11+MNZQZlSYZnuiS4Ua4JjsnF6Q9NFtwv\n\tz3TfO9hLSzkSFAwmSYZJAvlHwUMrAtiTl8MYBcMIBiBMNF7NQMoaYHecP8sHRvr+EyCC\n\txP9WYUKElzZvui6LAKlVE+j5m05KA/OHTw6xE=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1724423529; x=1725028329;\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=IDX86hfigYN0gC08TEOpl2L7+W79GzBQ1t4h96ImMug=;\n\tb=cagwVKYg7ZnCPb6j3N2+J2O7IKPgsuGnJAHVDcU9B4mGCTKM/ZoYPUk/HenDUoQzjk\n\tAceHwmVs/d4u1gwJY/fiZa+3pNPtnDLlg920LE/HMqBkHHD3wX6cN6EYG8CEpaIp+934\n\taXgoq9uhZNoSVCdxcjig2BqTuNr4azC+ZDipU4l6cw9lQXtc4QajNz58aPSxSKoSrTdr\n\tsUOGj8IY3LDCKyLAcfFgpQgFAYnaiV1rvtmmJmyfo+o2pZWLKpsWVPzQ9tVQuXieLiv6\n\t2N13gIMuKcd807kMFSZXBudjuXqncIyZhVWtgizCNUlVPXoBLGvijsF0vmzNYe0JU5cD\n\tRMTA==",
        "X-Gm-Message-State": "AOJu0YyJB1sfKd9/7x5TK0RAQBYrgOB7q223IWSfuH9yrVw/1LnNMfmb\n\trZzDAfw9WZX89P7qv0eJ4O2aeWAfQbJlvzRaIeWDxz4JbnkhTFBKnShuhts6OovhUxTcx3diUEx\n\taFA==",
        "X-Google-Smtp-Source": "AGHT+IEsAu7rW+IxEVWVzL8BSpS0ALyOQzM6I1UwWj7bVrdTsy9JlEml6sCQmYLfI5w5tL16S9h6JA==",
        "X-Received": "by 2002:a05:6000:e4f:b0:36d:2984:ef74 with SMTP id\n\tffacd0b85a97d-37311863b12mr1598145f8f.35.1724423528844; \n\tFri, 23 Aug 2024 07:32:08 -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>",
        "Subject": "[PATCH v2 1/3] libcamera: Add rectangle two-point constructor",
        "Date": "Fri, 23 Aug 2024 14:29:08 +0000",
        "Message-ID": "<20240823143205.2668765-2-chenghaoyang@google.com>",
        "X-Mailer": "git-send-email 2.46.0.295.g3b9ea8a38a-goog",
        "In-Reply-To": "<20240823143205.2668765-1-chenghaoyang@google.com>",
        "References": "<20240823143205.2668765-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\nBUG=b:308714092\nTEST=emerge-geralt libcamera-mtkisp7\n\nSigned-off-by: Yudhistira Erlandinata <yerlandinata@chromium.org>\nCo-developed-by: Harvey Yang <chenghaoyang@chromium.org>\n---\n include/libcamera/geometry.h | 10 ++++++++++\n src/libcamera/geometry.cpp   | 11 +++++++++--\n 2 files changed, 19 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex 3e6f0f5d7..978322a22 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -8,7 +8,9 @@\n #pragma once\n \n #include <algorithm>\n+#include <assert.h>\n #include <ostream>\n+#include <stdlib.h>\n #include <string>\n \n #include <libcamera/base/compiler.h>\n@@ -262,6 +264,14 @@ public:\n \t{\n \t}\n \n+\tconstexpr Rectangle(const Point &topLeft, const Point &bottomRight)\n+\t\t: x(topLeft.x), y(topLeft.y),\n+\t\t  width(bottomRight.x - x),\n+\t\t  height(bottomRight.y - y)\n+\t{\n+\t\tassert(bottomRight.x >= x && bottomRight.y >= y);\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 000151364..86385ad35 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -5,13 +5,13 @@\n  * Geometry-related structures\n  */\n \n-#include <libcamera/geometry.h>\n-\n #include <sstream>\n #include <stdint.h>\n \n #include <libcamera/base/log.h>\n \n+#include <libcamera/geometry.h>\n+\n /**\n  * \\file geometry.h\n  * \\brief Data structures related to geometric objects\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 &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+\n /**\n  * \\var Rectangle::x\n  * \\brief The horizontal coordinate of the rectangle's top-left corner\n",
    "prefixes": [
        "v2",
        "1/3"
    ]
}