diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-04-04 15:16:50 +0100 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-04-06 00:34:54 +0100 |
commit | c962bf8b8fa4d9a6400811296fb270f47db68cf4 (patch) | |
tree | f5e651935cbbf54e6d1488bbe19a6e2a4599a070 /liboverlay/overlayCtrl.cpp | |
parent | 7a8a513ac8a2b9a76b36cf1341d45b00d88ed45c (diff) | |
parent | 6445344dbaf08ec4d8fbf6aeeffdf29faed64e78 (diff) | |
download | android_hardware_qcom_display-cm-10.1.tar.gz android_hardware_qcom_display-cm-10.1.tar.bz2 android_hardware_qcom_display-cm-10.1.zip |
Merge remote-tracking branch 'aosp/jb-mr1.1-release' into cm-10.1cm-10.1.3-RC2cm-10.1.3-RC1cm-10.1.3cm-10.1.2cm-10.1.1cm-10.1.0-RC5cm-10.1.0-RC4cm-10.1.0-RC3cm-10.1.0-RC2cm-10.1.0-RC1cm-10.1.0cm-10.1-M3cm-10.1
Change-Id: I44a10eaa285d0521669781a4fafb7641df209186
Diffstat (limited to 'liboverlay/overlayCtrl.cpp')
-rw-r--r-- | liboverlay/overlayCtrl.cpp | 121 |
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"); |