From 384a5b27097bfcf71bfba192420d7c07943b5485 Mon Sep 17 00:00:00 2001 From: Kinjal Bhavsar Date: Thu, 9 Aug 2012 18:15:18 -0700 Subject: [PATCH] Overlay: Switch the flip for MDP, on 90 rotated source Camera client doesn't factor in the 90-rotated source when setting the flip Switch the flips when the source is 90-rotated. Change-Id: I16b81ca2c146f9b4c20908674f89d0a2e9808681 --- liboverlay/overlayMdp.cpp | 5 ++++- liboverlay/overlayRotator.cpp | 7 +++++-- liboverlay/overlayUtils.h | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) 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: