Show a patch.

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

{
    "id": 25201,
    "url": "https://patchwork.libcamera.org/api/patches/25201/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/25201/",
    "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": "<20251125162851.2301793-23-stefan.klug@ideasonboard.com>",
    "date": "2025-11-25T16:28:34",
    "name": "[v3,22/29] libcamera: Add transpose() function to size",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "fa2019133144fb13eb9e7282f6a9f837ddd31a17",
    "submitter": {
        "id": 184,
        "url": "https://patchwork.libcamera.org/api/people/184/?format=api",
        "name": "Stefan Klug",
        "email": "stefan.klug@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/25201/mbox/",
    "series": [
        {
            "id": 5613,
            "url": "https://patchwork.libcamera.org/api/series/5613/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5613",
            "date": "2025-11-25T16:28:12",
            "name": "Full dewarper support on imx8mp",
            "version": 3,
            "mbox": "https://patchwork.libcamera.org/series/5613/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/25201/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/25201/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 EEE9BC3338\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 25 Nov 2025 16:30:02 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 787A260B33;\n\tTue, 25 Nov 2025 17:30:02 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E55D060AD0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 25 Nov 2025 17:29:59 +0100 (CET)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bae1:340c:573c:570b])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 05586524;\n\tTue, 25 Nov 2025 17:27:50 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Sly7K4cR\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1764088071;\n\tbh=Whf6J85kiCqddzmN8XRL2gX9/PkNgMqHWeAhj82Lx8U=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Sly7K4cR5Ss17L9PT4HkSWMnH1MP3dS7r/1rQ4n3+BUiXXYtbW4tXITgNGOJEakhY\n\tFjKZCPhwqry8HuqTQ0gmRpnWqxw/UtYgodYJyp2HxQD6WMDt2HxvqOh9qqjyj+IXyE\n\taVHwHteN+bgHLnSIo96S9FAi2LKX5xyfunLAaYaE=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH v3 22/29] libcamera: Add transpose() function to size",
        "Date": "Tue, 25 Nov 2025 17:28:34 +0100",
        "Message-ID": "<20251125162851.2301793-23-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.51.0",
        "In-Reply-To": "<20251125162851.2301793-1-stefan.klug@ideasonboard.com>",
        "References": "<20251125162851.2301793-1-stefan.klug@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": "Add a transpose() function to size that applies the\nTransformation::Transpose operation in the size. This is useful when\nhandling orientation adjustments.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v3:\n- Added test case\n---\n include/libcamera/geometry.h |  6 ++++++\n src/libcamera/geometry.cpp   | 10 ++++++++++\n test/geometry.cpp            |  5 +++++\n 3 files changed, 21 insertions(+)",
    "diff": "diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\nindex d9378efeca8c..572a07e2cf92 100644\n--- a/include/libcamera/geometry.h\n+++ b/include/libcamera/geometry.h\n@@ -108,6 +108,12 @@ public:\n \t\treturn *this;\n \t}\n \n+\tSize &transpose()\n+\t{\n+\t\tstd::swap(width, height);\n+\t\treturn *this;\n+\t}\n+\n \t[[nodiscard]] constexpr Size alignedDownTo(unsigned int hAlignment,\n \t\t\t\t\t\t   unsigned int vAlignment) const\n \t{\ndiff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\nindex de76d0c12a8c..2763967a6e57 100644\n--- a/src/libcamera/geometry.cpp\n+++ b/src/libcamera/geometry.cpp\n@@ -209,6 +209,16 @@ std::string Size::toString() const\n  * \\return A reference to this object\n  */\n \n+/**\n+ * \\fn Size::transpose()\n+ * \\brief Transpose the size in place\n+ *\n+ * This function swaps width and height of this size. This effectively applies\n+ * the \\a Transform::Transpose transformation on this size.\n+ *\n+ * \\return A reference to this object\n+ */\n+\n /**\n  * \\fn Size::alignedDownTo(unsigned int hAlignment, unsigned int vAlignment)\n  * \\brief Align the size down horizontally and vertically\ndiff --git a/test/geometry.cpp b/test/geometry.cpp\nindex 11df043b733b..a50b643b7ee6 100644\n--- a/test/geometry.cpp\n+++ b/test/geometry.cpp\n@@ -203,6 +203,11 @@ protected:\n \t\t\treturn TestFail;\n \t\t}\n \n+\t\tif (Size(200, 50).transpose() != Size(50, 200)) {\n+\t\t\tcout << \"Size::transpose() test failed\" << endl;\n+\t\t\treturn TestFail;\n+\t\t}\n+\n \t\t/* Aspect ratio tests */\n \t\tif (Size(0, 0).boundedToAspectRatio(Size(4, 3)) != Size(0, 0) ||\n \t\t    Size(1920, 1440).boundedToAspectRatio(Size(16, 9)) != Size(1920, 1080) ||\n",
    "prefixes": [
        "v3",
        "22/29"
    ]
}