summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-10-20 17:42:47 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-10-23 16:06:19 +0300
commit53b4419986953e6f20b10588e187e403b3d0791e (patch)
tree1f4d6270e08143509a59cd7f56198d8864b52542 /src
parent7a5d4b83e5d5a2444e62ac5868c9016de43f8f60 (diff)
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 <laurent.pinchart@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/transform.cpp50
1 files changed, 20 insertions, 30 deletions
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
@@ -331,35 +331,6 @@ Transform transformFromOrientation(const Orientation &orientation)
}
/**
- * \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
* \param o2 The base Orientation
@@ -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;
}
/**