[{"id":36056,"web_url":"https://patchwork.libcamera.org/comment/36056/","msgid":"<175923962897.216853.9084626660308051171@ping.linuxembedded.co.uk>","date":"2025-09-30T13:40:28","subject":"Re: [PATCH v1 26/33] libcamera: Add transpose() function to size","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-09-30 13:26:47)\n> Add a transpose() function to size that applies the\n> Transformation::Transpose operation in the size. This is useful when\n> handling orientation adjustments.\n> \n\nNice, that makes things clearer. This is simple - but these classes are\nwell covered by the unit tests - so I think just a simple validation in\nthere for this call would be worthwhile too to keep it consistent.\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  include/libcamera/geometry.h |  6 ++++++\n>  src/libcamera/geometry.cpp   | 10 ++++++++++\n>  2 files changed, 16 insertions(+)\n> \n> diff --git a/include/libcamera/geometry.h b/include/libcamera/geometry.h\n> index d9378efeca8c..572a07e2cf92 100644\n> --- a/include/libcamera/geometry.h\n> +++ b/include/libcamera/geometry.h\n> @@ -108,6 +108,12 @@ public:\n>                 return *this;\n>         }\n>  \n> +       Size &transpose()\n> +       {\n> +               std::swap(width, height);\n> +               return *this;\n> +       }\n> +\n>         [[nodiscard]] constexpr Size alignedDownTo(unsigned int hAlignment,\n>                                                    unsigned int vAlignment) const\n>         {\n> diff --git a/src/libcamera/geometry.cpp b/src/libcamera/geometry.cpp\n> index 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\n> -- \n> 2.48.1\n>","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 635DEC324C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Sep 2025 13:40:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 175D86B5F8;\n\tTue, 30 Sep 2025 15:40:33 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AD99169367\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Sep 2025 15:40:31 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 75639226;\n\tTue, 30 Sep 2025 15:39:03 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"eL7LrrlV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1759239543;\n\tbh=1Z0yuE8f+HUB1w3pw9K27Wl2mpypIYIiPGEZqwc9rVw=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=eL7LrrlVt0ZWnlb/Z/j1HKEF7HU0R9fKgCV7nyU9eAo3Ssb8jQXu+p8/CP1sSOiZ7\n\tG4/d1udKLvqouthDjCYnCjj87izViK6Q3Qk5g3TuVF2Jd0HdvbIWKE/MPah4Ilwx2p\n\tjDbv9lx/+ihCldvP6g48UE9K9xgIQiTGhl/r2994=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20250930122726.1837524-27-stefan.klug@ideasonboard.com>","References":"<20250930122726.1837524-1-stefan.klug@ideasonboard.com>\n\t<20250930122726.1837524-27-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v1 26/33] libcamera: Add transpose() function to size","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Tue, 30 Sep 2025 14:40:28 +0100","Message-ID":"<175923962897.216853.9084626660308051171@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]