@@ -72,7 +72,6 @@ constexpr Transform operator~(Transform t)
Transform transformFromRotation(int angle, bool *success = nullptr);
Transform transformFromOrientation(const Orientation &orientation);
-Orientation transformToOrientation(const Transform &transform);
Transform operator/(const Orientation &o1, const Orientation &o2);
Orientation operator*(const Orientation &o, const Transform &t);
@@ -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;
}
/**
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> --- include/libcamera/transform.h | 1 - src/libcamera/transform.cpp | 50 ++++++++++++++--------------------- 2 files changed, 20 insertions(+), 31 deletions(-)