summaryrefslogtreecommitdiffstats
path: root/liboverlay/overlayCtrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'liboverlay/overlayCtrl.cpp')
-rw-r--r--liboverlay/overlayCtrl.cpp121
1 files changed, 0 insertions, 121 deletions
diff --git a/liboverlay/overlayCtrl.cpp b/liboverlay/overlayCtrl.cpp
index 9047f3eaa..ac4a2965b 100644
--- a/liboverlay/overlayCtrl.cpp
+++ b/liboverlay/overlayCtrl.cpp
@@ -77,129 +77,8 @@ bool Ctrl::setCrop(const utils::Dim& d)
utils::ActionSafe* utils::ActionSafe::sActionSafe = NULL;
-utils::Dim Ctrl::getAspectRatio(const utils::Whf& whf) const
-{
- utils::Whf inWhf(whf.w, whf.h, mMdp.getSrcWhf().format);
- utils::Whf tmpwhf(inWhf);
- uint32_t fbWidth = mInfo.mFBWidth;
- uint32_t fbHeight = mInfo.mFBHeight;
-
- /* Calculate the width and height if it is YUV TILE format*/
- if (inWhf.format == HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED) {
- tmpwhf.w = whf.w - (utils::alignup(whf.w, 64) - whf.w);
- tmpwhf.h = whf.h - (utils::alignup(whf.h, 32) - whf.h);
- }
- if (inWhf.w * fbHeight > fbWidth * inWhf.h) {
- inWhf.h = fbWidth * inWhf.h / inWhf.w;
- inWhf.w = fbWidth;
- } else if (inWhf.w * fbHeight < fbWidth * inWhf.h) {
- inWhf.w = fbHeight * inWhf.w / inWhf.h;
- inWhf.h = fbHeight;
- } else {
- inWhf.w = fbWidth;
- inWhf.h = fbHeight;
- }
- /* Scaling of upto a max of 8 times supported */
- if (inWhf.w > (tmpwhf.w * utils::HW_OV_MAGNIFICATION_LIMIT)){
- inWhf.w = utils::HW_OV_MAGNIFICATION_LIMIT * tmpwhf.w;
- }
- if(inWhf.h > (tmpwhf.h * utils::HW_OV_MAGNIFICATION_LIMIT)) {
- inWhf.h = utils::HW_OV_MAGNIFICATION_LIMIT * tmpwhf.h;
- }
- if (inWhf.w > fbWidth) inWhf.w = fbWidth;
- if (inWhf.h > fbHeight) inWhf.h = fbHeight;
-
- float asWidth = utils::ActionSafe::getInstance()->getHeight();
- float asHeight = utils::ActionSafe::getInstance()->getWidth();
-
- inWhf.w = inWhf.w * (1.0f - asWidth / 100.0f);
- inWhf.h = inWhf.h * (1.0f - asHeight / 100.0f);
-
- uint32_t x = (fbWidth - inWhf.w) / 2.0;
- uint32_t y = (fbHeight - inWhf.h) / 2.0;
- return utils::Dim(x, y, inWhf.w, inWhf.h);
-}
-
utils::FrameBufferInfo* utils::FrameBufferInfo::sFBInfoInstance = 0;
-// This function gets the destination position for external display
-// based on the position and aspect ratio of the primary
-utils::Dim Ctrl::getAspectRatio(const utils::Dim& dim) const {
- float priWidth = utils::FrameBufferInfo::getInstance()->getWidth();
- float priHeight = utils::FrameBufferInfo::getInstance()->getHeight();
- float fbWidth = mInfo.mFBWidth;
- float fbHeight = mInfo.mFBHeight;
- float wRatio = 1.0;
- float hRatio = 1.0;
- float xRatio = 1.0;
- float yRatio = 1.0;
- utils::Dim inDim(dim);
-
- int xPos = 0;
- int yPos = 0;
- int tmp = 0;
- utils::Dim tmpDim;
- switch(inDim.o) {
- case MDP_ROT_NOP:
- case MDP_ROT_180:
- {
- utils::Whf whf((uint32_t) priWidth, (uint32_t) priHeight, 0);
- tmpDim = getAspectRatio(whf);
- xPos = tmpDim.x;
- yPos = tmpDim.y;
- fbWidth = tmpDim.w;
- fbHeight = tmpDim.h;
-
- if (inDim.o == MDP_ROT_180) {
- inDim.x = priWidth - (inDim.x + inDim.w);
- inDim.y = priHeight - (inDim.y + inDim.h);
- }
- break;
- }
- case MDP_ROT_90:
- case MDP_ROT_270:
- {
- if(inDim.o == MDP_ROT_90) {
- tmp = inDim.y;
- inDim.y = priWidth - (inDim.x + inDim.w);
- inDim.x = tmp;
- }
- else if (inDim.o == MDP_ROT_270) {
- tmp = inDim.x;
- inDim.x = priHeight - (inDim.y + inDim.h);
- inDim.y = tmp;
- }
-
- // Swap the destination width/height
- utils::swapWidthHeight(inDim.w, inDim.h);
- // Swap width/height for primary
- utils::swapWidthHeight(priWidth, priHeight);
- utils::Whf whf((uint32_t) priWidth, (uint32_t) priHeight, 0);
- tmpDim = getAspectRatio(whf);
- xPos = tmpDim.x;
- yPos = tmpDim.y;
- fbWidth = tmpDim.w;
- fbHeight = tmpDim.h;
- break;
- }
- default:
- ALOGE("%s: Unknown Orientation", __FUNCTION__);
- break;
- }
-
- // Calculate the position
- xRatio = inDim.x/priWidth;
- yRatio = inDim.y/priHeight;
- wRatio = inDim.w/priWidth;
- hRatio = inDim.h/priHeight;
-
- return utils::Dim((xRatio * fbWidth) + xPos, // x
- (yRatio * fbHeight) + yPos, // y
- (wRatio * fbWidth), // width
- (hRatio * fbHeight), // height
- inDim.o); // orientation
-}
-
void Ctrl::dump() const {
ALOGE("== Dump Ctrl start ==");
mInfo.dump("mInfo");