From 3ce61a332f86066bc0073928739bb95f0ade1715 Mon Sep 17 00:00:00 2001 From: Saurabh Shah Date: Wed, 1 Jun 2011 16:41:33 -0700 Subject: [PATCH] Set Position for HDMI in setPosition This is necessary to adjust aspect ratio based on the crop, since src values are modified in crop. Change-Id: Icfb20df5b6ac4e93dfa85b73c4f74b738a4d3e59 CRs-fixed: 290069 --- liboverlay/overlayLib.cpp | 28 ++++++++++++++-------------- liboverlay/overlayLib.h | 4 +++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/liboverlay/overlayLib.cpp b/liboverlay/overlayLib.cpp index ce79f6e..f4b4609 100644 --- a/liboverlay/overlayLib.cpp +++ b/liboverlay/overlayLib.cpp @@ -179,7 +179,8 @@ unsigned int overlay::getOverlayConfig (unsigned int format3D) { Overlay::Overlay() : mChannelUP(false), mHDMIConnected(false), mCloseChannel(false), mS3DFormat(0), - mWidth(0), mHeight(0) { + mWidth(0), mHeight(0), + mCroppedSrcWidth(0), mCroppedSrcHeight(0) { } Overlay::~Overlay() { @@ -199,6 +200,8 @@ bool Overlay::startChannel(int w, int h, int format, int fbnum, unsigned int format3D, int channel, bool ignoreFB, int num_buffers) { int zorder = 0; + mCroppedSrcWidth = w; + mCroppedSrcHeight = h; if (format3D) zorder = channel; mChannelUP = objOvCtrlChannel[channel].startControlChannel(w, h, format, fbnum, @@ -216,13 +219,6 @@ bool Overlay::startChannelHDMI(int w, int h, int format, bool norot) { bool ret = startChannel(w, h, format, FRAMEBUFFER_0, norot); if(ret) { ret = startChannel(w, h, format, FRAMEBUFFER_1, true, 0, 0, VG1_PIPE); - overlay_rect rect; - if(ret && objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(w, h, &rect)) { - if(!setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE)) { - LOGE("Failed to upscale for framebuffer 1"); - return false; - } - } } return ret; } @@ -273,13 +269,15 @@ bool Overlay::getOrientation(int& orientation, int channel) const { } bool Overlay::setPosition(int x, int y, uint32_t w, uint32_t h) { - if(mS3DFormat && mHDMIConnected) { - return setPositionS3D(x, y, w, h); - } if(mHDMIConnected) { - overlay_rect rect; - objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(w, h, &rect); - setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE); + if(mS3DFormat) { + return setPositionS3D(x, y, w, h); + } else { + overlay_rect rect; + objOvCtrlChannel[VG1_PIPE].getAspectRatioPosition(mCroppedSrcWidth, + mCroppedSrcHeight, &rect); + setChannelPosition(rect.x, rect.y, rect.w, rect.h, VG1_PIPE); + } } return setChannelPosition(x, y, w, h, VG0_PIPE); } @@ -420,6 +418,8 @@ bool Overlay::setCrop(uint32_t x, uint32_t y, uint32_t w, uint32_t h) { bool ret; overlay_rect rect, inRect; inRect.x = x; inRect.y = y; inRect.w = w; inRect.h = h; + mCroppedSrcWidth = w; + mCroppedSrcHeight = h; if (mHDMIConnected) { if (mS3DFormat) { diff --git a/liboverlay/overlayLib.h b/liboverlay/overlayLib.h index be87445..4d7f2ea 100644 --- a/liboverlay/overlayLib.h +++ b/liboverlay/overlayLib.h @@ -212,7 +212,9 @@ class Overlay { unsigned int mS3DFormat; int mWidth; int mHeight; - + //Actual cropped source width and height of overlay + int mCroppedSrcWidth; + int mCroppedSrcHeight; OverlayControlChannel objOvCtrlChannel[2]; OverlayDataChannel objOvDataChannel[2];