From 53b4419986953e6f20b10588e187e403b3d0791e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 20 Oct 2023 17:42:47 +0300 Subject: libcamera: transform: Fold transformToOrientation() in its only caller The transformToOrientation() function is called from Orientation operator*(const Orientation &o, const Transform &t); only. Fold the code in the caller and drop the transformToOrientation() function to drop what can be considered as an ill-defined operation from the API. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- src/libcamera/transform.cpp | 50 ++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 30 deletions(-) (limited to 'src/libcamera/transform.cpp') diff --git a/src/libcamera/transform.cpp b/src/libcamera/transform.cpp index 0ccdb42f..cd2717c2 100644 --- a/src/libcamera/transform.cpp +++ b/src/libcamera/transform.cpp @@ -330,35 +330,6 @@ Transform transformFromOrientation(const Orientation &orientation) return Transform::Identity; } -/** - * \brief Return the Orientation representing \a transform - * \param[in] transform The transform to convert - * \return The Orientation corresponding to \a transform - */ -Orientation transformToOrientation(const Transform &transform) -{ - switch (transform) { - case Transform::Identity: - return Orientation::Rotate0; - case Transform::HFlip: - return Orientation::Rotate0Mirror; - case Transform::VFlip: - return Orientation::Rotate180Mirror; - case Transform::Rot180: - return Orientation::Rotate180; - case Transform::Transpose: - return Orientation::Rotate90Mirror; - case Transform::Rot270: - return Orientation::Rotate270; - case Transform::Rot90: - return Orientation::Rotate90; - case Transform::Rot180Transpose: - return Orientation::Rotate270Mirror; - } - - return Orientation::Rotate0; -} - /** * \brief Return the Transform that applied to \a o2 gives \a o1 * \param o1 The Orientation to obtain @@ -389,7 +360,26 @@ Orientation operator*(const Orientation &o, const Transform &t) * Apply a Transform corresponding to the orientation first and * then apply \a t to it. */ - return transformToOrientation(transformFromOrientation(o) * t); + switch (transformFromOrientation(o) * t) { + case Transform::Identity: + return Orientation::Rotate0; + case Transform::HFlip: + return Orientation::Rotate0Mirror; + case Transform::VFlip: + return Orientation::Rotate180Mirror; + case Transform::Rot180: + return Orientation::Rotate180; + case Transform::Transpose: + return Orientation::Rotate90Mirror; + case Transform::Rot270: + return Orientation::Rotate270; + case Transform::Rot90: + return Orientation::Rotate90; + case Transform::Rot180Transpose: + return Orientation::Rotate270Mirror; + } + + return Orientation::Rotate0; } /** -- cgit v1.2.1