diff --git a/liboverlay/overlayMdp.cpp b/liboverlay/overlayMdp.cpp index 2cdd003..6fd1eb8 100644 --- a/liboverlay/overlayMdp.cpp +++ b/liboverlay/overlayMdp.cpp @@ -97,9 +97,12 @@ bool MdpCtrl::setPosition(const overlay::utils::Dim& d, bool MdpCtrl::setTransform(const utils::eTransform& orient, const bool& rotUsed) { - mOrientation = orient; int rot = utils::getMdpOrient(orient); setUserData(rot); + //getMdpOrient will switch the flips if the source is 90 rotated. + //Clients in Android dont factor in 90 rotation while deciding the flip. + mOrientation = static_cast(rot); + //Rotator can be requested by client even if layer has 0 orientation. mRotUsed = rotUsed; return true; diff --git a/liboverlay/overlayRotator.cpp b/liboverlay/overlayRotator.cpp index 7e17df7..b4eede9 100644 --- a/liboverlay/overlayRotator.cpp +++ b/liboverlay/overlayRotator.cpp @@ -82,10 +82,13 @@ void MdpRot::setFlags(const utils::eMdpFlags& flags) { void MdpRot::setTransform(const utils::eTransform& rot, const bool& rotUsed) { - mOrientation = rot; int r = utils::getMdpOrient(rot); - ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r); setRotations(r); + //getMdpOrient will switch the flips if the source is 90 rotated. + //Clients in Android dont factor in 90 rotation while deciding the flip. + mOrientation = static_cast(r); + ALOGE_IF(DEBUG_OVERLAY, "%s: r=%d", __FUNCTION__, r); + setDisable(); if(rotUsed) { setEnable(); diff --git a/liboverlay/overlayUtils.h b/liboverlay/overlayUtils.h index a09010c..66c5df7 100644 --- a/liboverlay/overlayUtils.h +++ b/liboverlay/overlayUtils.h @@ -640,10 +640,12 @@ inline int getMdpOrient(eTransform rotation) { case OVERLAY_TRANSFORM_FLIP_V: return MDP_FLIP_UD; case OVERLAY_TRANSFORM_FLIP_H: return MDP_FLIP_LR; case OVERLAY_TRANSFORM_ROT_90: return MDP_ROT_90; + //getMdpOrient will switch the flips if the source is 90 rotated. + //Clients in Android dont factor in 90 rotation while deciding flip. case OVERLAY_TRANSFORM_ROT_90_FLIP_V: - return MDP_ROT_90 | MDP_FLIP_UD; - case OVERLAY_TRANSFORM_ROT_90_FLIP_H: return MDP_ROT_90 | MDP_FLIP_LR; + case OVERLAY_TRANSFORM_ROT_90_FLIP_H: + return MDP_ROT_90 | MDP_FLIP_UD; case OVERLAY_TRANSFORM_ROT_180: return MDP_ROT_180; case OVERLAY_TRANSFORM_ROT_270: return MDP_ROT_270; default: