From patchwork Tue Sep 30 12:26:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24525 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id D3EC6C324C for ; Tue, 30 Sep 2025 13:29:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D891B6B5F0; Tue, 30 Sep 2025 15:29:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Z91/Ylb0"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7C01D62C35 for ; Tue, 30 Sep 2025 15:29:16 +0200 (CEST) Received: from ideasonboard.com (unknown [94.31.94.171]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 19B1316A; Tue, 30 Sep 2025 15:27:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1759238868; bh=S5kxuO0kE+eOLa3Pw+g2r8k/DuYrjE1NgSvbDcQ9I9c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z91/Ylb0YjZjHmZGAzagmZed48HIDNTS1sKuND6o/SbD6b6JNAIg5FotSr6HRG8KM vF28T+JgX2GFjSMaTWhuq83vUXnadsaQNItd5VisGxQ4wkNKJPTjyxbtjVh0/8335X 779WnACQXaKzLHmNnl76vscip3Bzx99goy3DeLSQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 26/33] libcamera: Add transpose() function to size Date: Tue, 30 Sep 2025 14:26:47 +0200 Message-ID: <20250930122726.1837524-27-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250930122726.1837524-1-stefan.klug@ideasonboard.com> References: <20250930122726.1837524-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Add a transpose() function to size that applies the Transformation::Transpose operation in the size. This is useful when handling orientation adjustments. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham --- include/libcamera/geometry.h | 6 ++++++ src/libcamera/geometry.cpp | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h index d9378efeca8c..572a07e2cf92 100644 --- a/include/libcamera/geometry.h +++ b/include/libcamera/geometry.h @@ -108,6 +108,12 @@ public: return *this; } + Size &transpose() + { + std::swap(width, height); + return *this; + } + [[nodiscard]] constexpr Size alignedDownTo(unsigned int hAlignment, unsigned int vAlignment) const { diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp index de76d0c12a8c..2763967a6e57 100644 --- a/src/libcamera/geometry.cpp +++ b/src/libcamera/geometry.cpp @@ -209,6 +209,16 @@ std::string Size::toString() const * \return A reference to this object */ +/** + * \fn Size::transpose() + * \brief Transpose the size in place + * + * This function swaps width and height of this size. This effectively applies + * the \a Transform::Transpose transformation on this size. + * + * \return A reference to this object + */ + /** * \fn Size::alignedDownTo(unsigned int hAlignment, unsigned int vAlignment) * \brief Align the size down horizontally and vertically