Refactoring overlay control (apply VisualElements)
authorwoo <s-w.woo@samsung.com>
Mon, 10 Jun 2013 08:16:14 +0000 (17:16 +0900)
committerwoo <s-w.woo@samsung.com>
Tue, 18 Jun 2013 11:14:51 +0000 (20:14 +0900)
Change-Id: I397c8bfb502965508663e7cbc50ff2fcaab4d31d
Signed-off-by: woo <s-w.woo@samsung.com>
12 files changed:
src/ui/controls/FUiCtrlOverlayPanel.cpp
src/ui/controls/FUiCtrlOverlayRegion.cpp
src/ui/controls/FUiCtrl_Form.cpp
src/ui/controls/FUiCtrl_OverlayAgent.cpp
src/ui/controls/FUiCtrl_OverlayPanel.cpp
src/ui/controls/FUiCtrl_OverlayPanelImpl.cpp
src/ui/controls/FUiCtrl_OverlayRegionImpl.cpp
src/ui/inc/FUiCtrl_Form.h
src/ui/inc/FUiCtrl_OverlayAgent.h
src/ui/inc/FUiCtrl_OverlayPanel.h
src/ui/inc/FUiCtrl_OverlayPanelImpl.h
src/ui/inc/FUiCtrl_OverlayRegionImpl.h

index b2d6e48..bdef433 100644 (file)
@@ -111,7 +111,7 @@ OverlayPanel::SetRenderSize(const FloatDimension& dim)
        SysAssertf(pOverlayPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        result r = pOverlayPanelImpl->SetRenderSize(dim);
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        return r;
 }
@@ -123,7 +123,7 @@ OverlayPanel::SetInputBuffer(const Dimension& destDim, const ByteBuffer& srcBuff
        SysAssertf(pOverlayPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        result r = pOverlayPanelImpl->SetInputBuffer(destDim, srcBuffer, srcDim, srcFormat);
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        return r;
 }
@@ -135,7 +135,7 @@ OverlayPanel::SetInputBuffer(const FloatDimension& destDim, const ByteBuffer& sr
        SysAssertf(pOverlayPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        result r = pOverlayPanelImpl->SetInputBuffer(destDim, srcBuffer, srcDim, srcFormat);
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        return r;
 }
@@ -147,7 +147,7 @@ OverlayPanel::GetBackgroundBufferInfo(BufferInfo& info) const
        SysAssertf(pOverlayPanelImpl != null, "Not yet constructed. Construct() should be called before use.");
 
        result r = pOverlayPanelImpl->GetBackgroundBufferInfo(info);
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        return r;
 }
@@ -178,24 +178,24 @@ OverlayPanel::GetMaskingColor(void) const
 result
 OverlayPanel::EvaluateBounds(OverlayPanelEvaluationOption option, Rectangle& rect, bool& modified)
 {
-       return _OverlayPanelImpl::EvaluateBounds(option, rect, modified);
-}
-
-result
-OverlayPanel::EvaluateBounds(OverlayPanelEvaluationOption option, FloatRectangle& rect, bool& modified)
-{
-       Rectangle convetedRect = _CoordinateSystemUtils::ConvertToInteger(rect);
+       FloatRectangle convetedRect = _CoordinateSystemUtils::ConvertToFloat(rect);
 
        result r = _OverlayPanelImpl::EvaluateBounds(option, convetedRect, modified);
 
-       if(modified)
+       if(r == E_SUCCESS && modified)
        {
-               rect = _CoordinateSystemUtils::ConvertToFloat(convetedRect);
+               rect = _CoordinateSystemUtils::ConvertToInteger(convetedRect);
        }
 
        return r;
 }
 
+result
+OverlayPanel::EvaluateBounds(OverlayPanelEvaluationOption option, FloatRectangle& rect, bool& modified)
+{
+       return _OverlayPanelImpl::EvaluateBounds(option, rect, modified);
+}
+
 IListT<Tizen::Ui::Controls::OverlayPanel::BufferPixelFormat>*
 OverlayPanel::GetSupportedBufferPixelFormatListN(void)
 {
index 301fa3d..217aa9f 100644 (file)
@@ -92,7 +92,7 @@ OverlayRegion::SetInputBuffer(const ByteBuffer& srcBuffer, const Dimension& sour
 {
        SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       result r  = __pOverlayRegionImpl->SetInputBuffer(srcBuffer, sourceDim, srcFormat, true);
+       result r  = __pOverlayRegionImpl->SetInputBuffer(srcBuffer, sourceDim, srcFormat);
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
        return E_SUCCESS;
@@ -114,15 +114,26 @@ OverlayRegion::Show(void)
 {
        SysAssertf(__pOverlayRegionImpl != null, "Not yet constructed. Construct() should be called before use.");
 
-       result r  = __pOverlayRegionImpl->Show();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
        return E_SUCCESS;
 }
 
 bool
 OverlayRegion::EvaluateBounds(OverlayRegionEvaluationOption option, Rectangle& rect, bool& modified)
 {
+       FloatRectangle convertedRect = _CoordinateSystemUtils::ConvertToFloat(rect);
+       bool ret = EvaluateBounds(option, convertedRect, modified);
+
+       if(ret && modified)
+       {
+               rect = _CoordinateSystemUtils::ConvertToInteger(convertedRect);
+       }
+
+       return ret;
+}
+
+bool
+OverlayRegion::EvaluateBounds(OverlayRegionEvaluationOption option, FloatRectangle& rect, bool& modified)
+{
        result r = E_SUCCESS;
 
        switch (option)
@@ -143,29 +154,15 @@ OverlayRegion::EvaluateBounds(OverlayRegionEvaluationOption option, Rectangle& r
                break;
        }
 
-       SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The option which is input parameter is invalid.");
+       SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The input OverlayRegionEvaluationOption is invalid.");
        return false;
 }
 
-bool
-OverlayRegion::EvaluateBounds(OverlayRegionEvaluationOption option, FloatRectangle& rect, bool& modified)
-{
-       Rectangle convertedRect = _CoordinateSystemUtils::ConvertToInteger(rect);
-       bool ret = EvaluateBounds(option, convertedRect, modified);
-
-       if(ret && modified)
-       {
-               rect = _CoordinateSystemUtils::ConvertToFloat(convertedRect);
-       }
-
-       return ret;
-}
-
 int
 OverlayRegion::GetWidthUnit(void)
 {
        int widthUnit = _OverlayAgent::GetWidthUnit();
-       SysTryReturn(NID_UI_CTRL, widthUnit != -1, -1, E_SYSTEM, "[E_SYSTEM] can't get the width Unit");
+       SysTryReturn(NID_UI_CTRL, widthUnit != -1, -1, E_SYSTEM, "[E_SYSTEM] Failed to get width unit of OverlayRegion.");
 
        return widthUnit;
 }
@@ -174,7 +171,7 @@ int
 OverlayRegion::GetHeightUnit(void)
 {
        int heightUnit = _OverlayAgent::GetHeightUnit();
-       SysTryReturn(NID_UI_CTRL, heightUnit != -1, -1, E_SYSTEM, "[E_SYSTEM] can't get the height Unit");
+       SysTryReturn(NID_UI_CTRL, heightUnit != -1, -1, E_SYSTEM, "[E_SYSTEM] Failed to get height unit of OverlayRegion.");
 
        return heightUnit;
 }
@@ -183,7 +180,7 @@ int
 OverlayRegion::GetMaxCount(void)
 {
        int maxCount = _OverlayAgent::GetMaxCount();
-       SysTryReturn(NID_UI_CTRL, maxCount != -1, -1, E_SYSTEM, "[E_SYSTEM] can't get the maximum count value");
+       SysTryReturn(NID_UI_CTRL, maxCount != -1, -1, E_SYSTEM, "[E_SYSTEM]Failed to get maximum count of OverlayRegion.");
 
        return maxCount;
 }
index 799909d..c96d88c 100644 (file)
@@ -79,7 +79,7 @@ _Form::_Form(void)
        , __deflated(false)
        , __deflatedHeight(0.0f)
        , __overlayRegionCount(0)
-       , __ppOverlayerRegionImplArray(null)
+       , __pOverlayerRegionImplArray(null)
        , __softkeyCount(SOFTKEY_COUNT + 1)
        , __updatedSoftkeyCount(0)
        , __keypadShowstate(false)
@@ -260,20 +260,20 @@ _Form::~_Form(void)
                }
        }
 
-       if (__ppOverlayerRegionImplArray != null)
+       if (__pOverlayerRegionImplArray != null)
        {
                int maxCount = OverlayRegion::GetMaxCount();
 
                for (int i = 0; i < maxCount; i++)
                {
-                       if (__ppOverlayerRegionImplArray[i])
+                       if (__pOverlayerRegionImplArray[i])
                        {
-                               OverlayRegion* _pOverlayRegion = __ppOverlayerRegionImplArray[i]->GetOverlayRegion();
+                               OverlayRegion* _pOverlayRegion = __pOverlayerRegionImplArray[i]->GetOverlayRegion();
                                delete _pOverlayRegion;
                        }
                }
 
-               delete[] __ppOverlayerRegionImplArray;
+               delete[] __pOverlayerRegionImplArray;
        }
 
        if (__pIndicator)
@@ -426,206 +426,95 @@ _Form::GetTitleTextHorizontalAlignment(void) const
 OverlayRegion*
 _Form::GetOverlayRegionN(const Rectangle& rect, OverlayRegionType regionType)
 {
-       _OverlayRegionImpl* pOverlayRegionImpl = null;
-       OverlayRegion* pOverlayRegion = null;
-       Color bgColor(0, 0, 0, 0);
-       int idx = 0;
-       int maxCount = 0;
-       _OverlayPanel* pOverlayPanel = null;
-       result r = E_SYSTEM;
-       bool modified = false;
-
-       ClearLastResult();
-
-       maxCount = OverlayRegion::GetMaxCount();
-       SysTryReturn(NID_UI_CTRL, maxCount > 0, null, E_SYSTEM, "[E_SYSTEM] maxCount [%d] is invalid", maxCount);
-
-       if (__ppOverlayerRegionImplArray == null)
-       {
-               __ppOverlayerRegionImplArray = new (std::nothrow) _OverlayRegionImpl*[maxCount];
-               SysTryReturn(NID_UI_CTRL, __ppOverlayerRegionImplArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Can not allocate memory for the OverlayRegionList.");
-
-               for (int i = 0; i < maxCount; i++)
-               {
-                       __ppOverlayerRegionImplArray[i] = null;
-               }
-               __overlayRegionCount = 0;
-       }
-
-       Rectangle clientRect(GetClientBounds());
-       Point overlayPosition(clientRect.x + rect.x, clientRect.y + rect.y);
-       Rectangle overlayRect(overlayPosition.x, overlayPosition.y, rect.width, rect.height);
-
-       Rectangle userPhyRect = _CoordinateSystemUtils::Transform(rect);
-       Rectangle devBounds = _CoordinateSystemUtils::Transform(overlayRect);
-
-       SysLog(NID_UI_CTRL, "rect [%d, %d, %d, %d] ", rect.x, rect.y, rect.width, rect.height);
-       SysLog(NID_UI_CTRL, "userPhyRect [%d, %d, %d, %d] ", userPhyRect.x, userPhyRect.y, userPhyRect.width, userPhyRect.height);
-       SysLog(NID_UI_CTRL, "overlayRect [%d, %d, %d, %d]", overlayPosition.x, overlayPosition.y, rect.width, rect.height);
-       SysLog(NID_UI_CTRL, "devBounds [%d, %d, %d, %d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
-
-       // 1. width , height unit check
-       if (_OverlayRegionImpl::IsValidOverlayRect(overlayRect, devBounds, _CoordinateSystemUtils::Transform(clientRect), modified) != E_SUCCESS)
-       {
-               SysTryReturn(NID_UI_CTRL, 0, null, E_INVALID_ARG, "[E_INVALID_ARG] IsValidOverlayRect is failed!");
-       }
-
-       if (modified)
-       {
-               SysLog(NID_UI_CTRL, "devBounds modified [%d, %d, %d, %d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
-       }
-
-       // 2. check for using OverlayPanel simutaneously
-       for (idx = 0 ; idx < GetChildCount() ; idx++)
-       {
-               pOverlayPanel = dynamic_cast <_OverlayPanel*>(GetChild(idx));
-               SysTryReturn(NID_UI_CTRL, pOverlayPanel == null, null, E_SYSTEM, "[E_SYSTEM] Using OverlayRegion mixed with OverlayPanel is not supported!");
-       }
-
-       // 3. find the empty slot idx
-       for (idx = 0; idx < maxCount; idx++)
-       {
-               if (__ppOverlayerRegionImplArray[idx] == null)
-               {
-                       break;
-               }
-       }
-
-       SysTryReturn(NID_UI_CTRL, idx < maxCount, null, E_SYSTEM, "[E_SYSTEM] already used permitted maximum number of OverlayRegion!");
-
-       // 4. make OverlayRegion object
-       pOverlayRegionImpl = new (std::nothrow) _OverlayRegionImpl();
-       SysTryReturn(NID_UI_CTRL, pOverlayRegionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] failed to make the OverlayRegionImpl instance!");
-
-       FloatRectangle overlayRectF = _CoordinateSystemUtils::InverseTransform(_CoordinateSystemUtils::ConvertToFloat(devBounds));
-       r = pOverlayRegionImpl->Construct(this, regionType, _CoordinateSystemUtils::ConvertToFloat(rect), overlayRectF, devBounds);
-       if (r != E_SUCCESS)
-       {
-               delete pOverlayRegionImpl;
-               SysTryReturn(NID_UI_CTRL, 0, null, r, "[%s] Propagating.", GetErrorMessage(r));
-       }
-
-       pOverlayRegion = pOverlayRegionImpl->CreateOverlayRegionN();
-       if (pOverlayRegion == null)
-       {
-               delete pOverlayRegionImpl;
-               SysTryReturn(NID_UI_CTRL, 0, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-       }
-
-       __ppOverlayerRegionImplArray[idx] = pOverlayRegionImpl;
-       pOverlayRegionImpl->SetFormArrayIndex(idx);
-
-       __overlayRegionCount++;
-
-       SetLastResult(E_SUCCESS);
-
-       return pOverlayRegion;
+       FloatRectangle rectF = _CoordinateSystemUtils::ConvertToFloat(rect);
+       return GetOverlayRegionN(rectF, regionType);
 }
 
 OverlayRegion*
 _Form::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regionType)
 {
-       _OverlayRegionImpl* pOverlayRegionImpl = null;
-       OverlayRegion* pOverlayRegion = null;
-       Color bgColor(0, 0, 0, 0);
-       int idx = 0;
-       int maxCount = 0;
-       _OverlayPanel* pOverlayPanel = null;
-       result r = E_SYSTEM;
-       bool modified = false;
-
        ClearLastResult();
 
-       maxCount = OverlayRegion::GetMaxCount();
-       SysTryReturn(NID_UI_CTRL, maxCount > 0, null, E_SYSTEM, "[E_SYSTEM] maxCount [%d] is invalid", maxCount);
+       int maxCount = OverlayRegion::GetMaxCount();
+       SysTryReturn(NID_UI_CTRL, maxCount > 0, null, E_SYSTEM, "[E_SYSTEM] The maximum count of OverlayRegion is invalid.", maxCount);
 
-       if (__ppOverlayerRegionImplArray == null)
+       //Initialize OverlayRegion array
+       if (__pOverlayerRegionImplArray == null)
        {
-               __ppOverlayerRegionImplArray = new (std::nothrow) _OverlayRegionImpl*[maxCount];
-               SysTryReturn(NID_UI_CTRL, __ppOverlayerRegionImplArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Can not allocate memory for the OverlayRegionList.");
+               __pOverlayerRegionImplArray = new (std::nothrow) _OverlayRegionImpl*[maxCount];
+               SysTryReturn(NID_UI_CTRL, __pOverlayerRegionImplArray != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
 
-               for (int i = 0; i < maxCount; i++)
+               for (int index = 0; index < maxCount; index++)
                {
-                       __ppOverlayerRegionImplArray[i] = null;
+                       __pOverlayerRegionImplArray[index] = null;
                }
                __overlayRegionCount = 0;
        }
 
-       FloatRectangle clientRectF(GetClientBoundsF());
-       FloatPoint overlayPositionF(clientRectF.x + rect.x, clientRectF.y + rect.y);
-       FloatRectangle overlayRectF(overlayPositionF.x, overlayPositionF.y, rect.width, rect.height);
+       //Get bounds of OverlayRegion
+       FloatRectangle formLogicalBoundsF(GetClientBoundsF());
+       FloatRectangle formPhysicalBoundsF = _CoordinateSystemUtils::Transform(CoordinateSystem::AlignToDevice(formLogicalBoundsF));
 
-       FloatRectangle devPhyBoundsF = _CoordinateSystemUtils::Transform(overlayRectF);
-       Rectangle devPhyBounds = _CoordinateSystemUtils::ConvertToInteger(devPhyBoundsF);
+       FloatPoint overlayPositionF(formLogicalBoundsF.x + rect.x, formLogicalBoundsF.y + rect.y);
+       FloatRectangle overlaylLogicalBoundsF(overlayPositionF.x, overlayPositionF.y, rect.width, rect.height);
+       FloatRectangle overlayPhysicalBoundsF = _CoordinateSystemUtils::Transform(CoordinateSystem::AlignToDevice(overlaylLogicalBoundsF));
+       Rectangle overlayPhysicalBounds = _CoordinateSystemUtils::ConvertToInteger(overlayPhysicalBoundsF);
 
-       //org user float
-       SysLog(NID_UI_CTRL, "user rect [%.3f, %.3f, %.3f, %.3f] ", rect.x, rect.y, rect.width, rect.height);
-       //adjustedlogical user float
-       SysLog(NID_UI_CTRL, "overlayRectF [%.3f, %.3f, %.3f, %.3f]", overlayRectF.x, overlayRectF.y, overlayRectF.width, overlayRectF.height);
-       //adjusted logical -> adjusted physical float
-       SysLog(NID_UI_CTRL, "devPhyBoundsF [%.3f, %.3f, %.3f, %.3f]", devPhyBoundsF.x, devPhyBoundsF.y, devPhyBoundsF.width, devPhyBoundsF.height);
-       //adjusted physical float -> physical integer
-       SysLog(NID_UI_CTRL, "devPhyBounds [%d, %.3d, %.3d, %.3d]", devPhyBounds.x, devPhyBounds.y, devPhyBounds.width, devPhyBounds.height);
+       Rectangle formPhysicalBounds = _CoordinateSystemUtils::ConvertToInteger(formPhysicalBoundsF);
+       SysTryReturn(NID_UI_CTRL, overlayPhysicalBounds.width <= formPhysicalBounds.width && overlayPhysicalBounds.height <= formPhysicalBounds.height,
+               null, E_INVALID_ARG, "[E_INVALID_ARG] The size of input rectangle is over maximum size.");
 
-       Rectangle overlayLgcRect = _CoordinateSystemUtils::ConvertToInteger(overlayRectF);
-       Rectangle basePhyBounds = _CoordinateSystemUtils::ConvertToInteger(_CoordinateSystemUtils::Transform(clientRectF));
+       result r = _OverlayRegionImpl::IsValidBounds(overlayPhysicalBounds);
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       // 1. width , height unit check
-       if (_OverlayRegionImpl::IsValidOverlayRect(overlayLgcRect, devPhyBounds, basePhyBounds, modified) != E_SUCCESS)
-       {
-               SysTryReturn(NID_UI_CTRL, 0, null, E_INVALID_ARG, "[E_INVALID_ARG] IsValidOverlayRect is failed!");
-       }
+       bool modified = false;
+       bool evaluated = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_LESS_THAN, overlaylLogicalBoundsF, modified);
+       r = GetLastResult();
+       SysTryReturn(NID_UI_CTRL, evaluated && r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
        if (modified)
        {
-               SysLog(NID_UI_CTRL, "devBounds modified [%d, %d, %d, %d]", devPhyBounds.x, devPhyBounds.y, devPhyBounds.width, devPhyBounds.height);
+               overlayPhysicalBoundsF = _CoordinateSystemUtils::Transform(CoordinateSystem::AlignToDevice(overlaylLogicalBoundsF));
+               overlayPhysicalBounds = _CoordinateSystemUtils::ConvertToInteger(overlayPhysicalBoundsF);
        }
+       SysSecureLog(NID_UI_CTRL, "The current bounds of overlay region is [%.3f, %.3f, %.3f, %.3f]"
+               , overlaylLogicalBoundsF.x, overlaylLogicalBoundsF.y, overlaylLogicalBoundsF.width, overlaylLogicalBoundsF.height);
+
+
 
-       // 2. check for using OverlayPanel simutaneously
-       for (idx = 0 ; idx < GetChildCount() ; idx++)
+       //Check for using OverlayPanel simutaneously
+       for (int index = 0; index < GetChildCount(); index++)
        {
-               pOverlayPanel = dynamic_cast <_OverlayPanel*>(GetChild(idx));
-               SysTryReturn(NID_UI_CTRL, pOverlayPanel == null, null, E_SYSTEM, "[E_SYSTEM] Using OverlayRegion mixed with OverlayPanel is not supported!");
+               _OverlayPanel* pOverlayPanel = dynamic_cast <_OverlayPanel*>(GetChild(index));
+               SysTryReturn(NID_UI_CTRL, pOverlayPanel == null, null, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay Region. Using OverlayRegion mixed with OverlayPanel is not supported.");
        }
 
-       // 3. find the empty slot idx
-       for (idx = 0; idx < maxCount; idx++)
+       //Check count of existing OverlayRegion
+       int index = 0;
+       for (index = 0; index < maxCount; index++)
        {
-               if (__ppOverlayerRegionImplArray[idx] == null)
+               if (__pOverlayerRegionImplArray[index] == null)
                {
                        break;
                }
+               SysTryReturn(NID_UI_CTRL, index < maxCount, null, E_SYSTEM, "[E_SYSTEM] The Overlay Region already exceeds permitted maximum limit.");
        }
 
-       SysTryReturn(NID_UI_CTRL, idx < maxCount, null, E_SYSTEM, "[E_SYSTEM] already used permitted maximum number of OverlayRegion!");
-
-       // 4. make OverlayRegion object
-       pOverlayRegionImpl = new (std::nothrow) _OverlayRegionImpl();
+       //Create OverlayRegion
+       unique_ptr<_OverlayRegionImpl> pOverlayRegionImpl(new (std::nothrow) _OverlayRegionImpl());
        SysTryReturn(NID_UI_CTRL, pOverlayRegionImpl != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] failed to make the OverlayRegionImpl instance!");
 
-       overlayRectF = _CoordinateSystemUtils::InverseTransform(_CoordinateSystemUtils::ConvertToFloat(devPhyBounds));
-       r = pOverlayRegionImpl->Construct(this, regionType, rect, overlayRectF, devPhyBounds);
-       if (r != E_SUCCESS)
-       {
-               delete pOverlayRegionImpl;
-               SysTryReturn(NID_UI_CTRL, 0, null, r, "[%s] Propagating.", GetErrorMessage(r));
-       }
-
-       pOverlayRegion = pOverlayRegionImpl->CreateOverlayRegionN();
-       if (pOverlayRegion == null)
-       {
-               delete pOverlayRegionImpl;
-               SysTryReturn(NID_UI_CTRL, 0, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-       }
+       r = pOverlayRegionImpl->Construct(this, regionType, rect, overlaylLogicalBoundsF, overlayPhysicalBounds);
+       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       __ppOverlayerRegionImplArray[idx] = pOverlayRegionImpl;
-       pOverlayRegionImpl->SetFormArrayIndex(idx);
+       unique_ptr<OverlayRegion> pOverlayRegion(pOverlayRegionImpl->CreateOverlayRegionN());
+       SysTryReturn(NID_UI_CTRL, pOverlayRegion != null, null, r, "[%s] Propagating.", GetErrorMessage(r));
 
+       pOverlayRegionImpl->SetFormArrayIndex(index);
+       __pOverlayerRegionImplArray[index] = pOverlayRegionImpl.release();
        __overlayRegionCount++;
 
-       SetLastResult(E_SUCCESS);
-
-       return pOverlayRegion;
+       return pOverlayRegion.release();
 }
 
 int
@@ -637,21 +526,21 @@ _Form::GetOverlayRegionCount(void) const
 void
 _Form::MoveOverlayRegion(bool top)
 {
-       if (__ppOverlayerRegionImplArray == null)
+       if (__pOverlayerRegionImplArray == null)
        {
                return;
        }
        for (int i = 0; i < OverlayRegion::GetMaxCount(); i++)
        {
-               if (__ppOverlayerRegionImplArray[i] != null)
+               if (__pOverlayerRegionImplArray[i] != null)
                {
                        if (top)
                        {
-                               __ppOverlayerRegionImplArray[i]->GoForeground();
+                               __pOverlayerRegionImplArray[i]->GoForeground();
                        }
                        else
                        {
-                               __ppOverlayerRegionImplArray[i]->GoBackground();
+                               __pOverlayerRegionImplArray[i]->GoBackground();
                        }
                }
        }
index e852a4e..f081c63 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <FBaseResult.h>
 #include <FUiIOrientationEventListener.h>
+#include <FUiAnimDisplayContext.h>
 #include <FGrp_BufferInfoImpl.h>
 #include <FGrp_Screen.h>
 #include <FIo_RegistryImpl.h>
@@ -35,6 +36,7 @@
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUi_EcoreEvas.h"
 #include "FUi_EcoreEvasMgr.h"
+#include "FUi_Window.h"
 #include "FUiAnim_EflNode.h"
 #include "FUiAnim_ControlVisualElement.h"
 #include "FUiAnim_VisualElementSurfaceImpl.h"
@@ -56,14 +58,8 @@ using namespace Tizen::Ui::Animations;
 
 namespace
 {
-const int _ROTATION_0 = 0;
-const int _ROTATION_90 = 90;
-const int _ROTATION_180 = 180;
-const int _ROTATION_270 = 270;
-const int _ROTATION_360 = 360;
-
 bool
-_CheckXvExtension(Display* pDisplay, int* pFirstPort, int* pCountPort)
+CheckXvExtension(Display* pDisplay, int* pFirstPort, int* pCountPort)
 {
        unsigned int version = 0;
        unsigned int release = 0;
@@ -124,8 +120,7 @@ _CheckXvExtension(Display* pDisplay, int* pFirstPort, int* pCountPort)
                {
                        for (unsigned int j = 0; j < pAdaptorInfo[i].num_formats; j++)
                        {
-                               SysSecureLog(NID_UI_CTRL, "The current value of depth is %d and visual is %ld.",
-                                       pAdaptorInfo[i].formats[j].depth, pAdaptorInfo[i].formats[j].visual_id);
+                               SysSecureLog(NID_UI_CTRL, "The current value of depth is %d and visual is %ld.", pAdaptorInfo[i].formats[j].depth, pAdaptorInfo[i].formats[j].visual_id);
                        }
                }
 
@@ -152,28 +147,18 @@ _CheckXvExtension(Display* pDisplay, int* pFirstPort, int* pCountPort)
 Eina_Bool
 OnPixmapDamaged(void* pData, int type, void* pEvent)
 {
-       Tizen::Ui::Controls::_OverlayAgent* pOverlayAgent = static_cast<Tizen::Ui::Controls::_OverlayAgent*>(pData);
-
        Ecore_X_Event_Damage* pDamageEvent = (Ecore_X_Event_Damage*)pEvent;
-       SysTryReturn(NID_UI_CTRL, pDamageEvent != null, ECORE_CALLBACK_PASS_ON, E_INVALID_DATA, "[E_INVALID_DATA] The current value of DamageEvent is an invalid.");
+       SysTryReturn(NID_UI_CTRL, pDamageEvent != null, ECORE_CALLBACK_PASS_ON, E_INVALID_DATA, "[E_INVALID_DATA] The current value of DamageEvent is invalid.");
 
-       Pixmap pixmap = pOverlayAgent->GetPixmap();
-       if (pDamageEvent->drawable != pixmap)
+       Tizen::Ui::Controls::_OverlayAgent* pOverlayAgent = static_cast<Tizen::Ui::Controls::_OverlayAgent*>(pData);
+       SysTryReturn(NID_UI_CTRL, pOverlayAgent != null, ECORE_CALLBACK_PASS_ON, E_INVALID_DATA, "[E_INVALID_DATA] Failed to get OverlayAgent from DamagedEvent.");
+
+       if (pDamageEvent->drawable != pOverlayAgent->GetPixmap())
        {
-               SysSecureLog(NID_UI_CTRL, "The current drawable[%d] is not for this overlay agent's pixmap[%d]", pDamageEvent->drawable, pixmap);
                return ECORE_CALLBACK_PASS_ON;
        }
 
-       Evas_Object* pImageObject = pOverlayAgent->GetPixmapImageObject();
-       SysTryReturn(NID_UI_CTRL, pImageObject != null, ECORE_CALLBACK_PASS_ON, E_INVALID_DATA, "[E_INVALID_DATA] The current value of ImageObject is an invalid.");
-
-       int w = 0;
-       int h = 0;
-       evas_object_geometry_get(pImageObject, null, null, &w, &h);
-       //evas_object_image_pixels_dirty_set(pImageObject, 1);
-       //evas_object_image_fill_set(pImageObject, 0, 0, w, h);
-       evas_object_image_filled_set(pImageObject, EINA_TRUE);
-       evas_object_image_data_update_add(pImageObject, 0, 0, w, h);
+       pOverlayAgent->SetRendererFlushNeeded();
 
        return ECORE_CALLBACK_DONE;
 }
@@ -182,40 +167,37 @@ void
 OnEvasImageDamaged(void* pData, Evas_Object* pImageObject)
 {
        Tizen::Ui::Controls::_OverlayAgent* pOverlayAgent = static_cast<Tizen::Ui::Controls::_OverlayAgent*>(pData);
+       SysTryReturnVoidResult(NID_UI_CTRL, pOverlayAgent != null, E_INVALID_DATA, "[E_INVALID_DATA] Failed to get OverlayAgent from DamagedEvent.");
 
-       Evas_Object* pMyImageObject = pOverlayAgent->GetPixmapImageObject();
-       SysTryReturn(NID_UI_CTRL, pMyImageObject != null, , E_INVALID_DATA, "[E_INVALID_DATA] The current value of ImageObject is an invalid.");
+       Evas_Object* pRendererImageObject = pOverlayAgent->GetRendererImageObject();
+       SysTryReturnVoidResult(NID_UI_CTRL, pRendererImageObject != null, E_INVALID_DATA, "[E_INVALID_DATA] Failed to get Renderer ImageObject of OverlayAgent.");
 
-       if (pMyImageObject == pImageObject)
+       if (pRendererImageObject != pImageObject)
        {
-               Dimension curImgDim(0,0);
-               evas_object_image_size_get(pImageObject, &curImgDim.width, &curImgDim.height);
+               return;
+       }
 
-               Dimension orgImgDim = pOverlayAgent->GetPrevCbImageDimension();
-               if (!orgImgDim.Equals(curImgDim))
-               {
-                       SysSecureLog(NID_UI_CTRL,"org[%d, %d] cur[%d, %d]", orgImgDim.width, orgImgDim.height, curImgDim.width, curImgDim.height);
-                       pOverlayAgent->SetPrevCbImageDimension(curImgDim);
-                       pOverlayAgent->SetEvasImageDirtyFlag(false);
-               }
+       Dimension newImageSize(0,0);
+       evas_object_image_size_get(pImageObject, &newImageSize.width, &newImageSize.height);
 
-               if(!(pOverlayAgent->GetEvasImageDirtyFlag()))
-               {
-                       pOverlayAgent->AdjustImageObject();
-                       pOverlayAgent->SetEvasImageDirtyFlag(true);
-               }
+       Dimension rendererImageSize(0,0);
+       evas_object_image_size_get(pRendererImageObject, &rendererImageSize.width, &rendererImageSize.height);
+
+       if (!newImageSize.Equals(rendererImageSize))
+       {
+               SysSecureLog(NID_UI_CTRL,"newImageSize [%d, %d] rendererImageSize [%d, %d]", newImageSize.width, newImageSize.height, rendererImageSize.width, rendererImageSize.height);
+               pOverlayAgent->SetDestination(FloatDimension(static_cast<float>(newImageSize.width), static_cast<float>(newImageSize.height)));
        }
 }
-
 } // Anonymous
 
 namespace Tizen { namespace Ui { namespace Controls
 {
-int _OverlayAgent::__overlayAgentXvPortCount = 0;
+
 int _OverlayAgent::__baseXvPort = 0;
 bool _OverlayAgent::__isPortGrabbed[]={false,};
 
-int _OverlayAgent::__overlayAgentcount = 0;
+int _OverlayAgent::__overlayAgentCount = 0;
 int _OverlayAgent::__dstRectMinWidth = -1;
 int _OverlayAgent::__dstRectMinHegith = -1;
 int _OverlayAgent::__srcRectMinWidth = -1;
@@ -225,11 +207,19 @@ int _OverlayAgent::__overlayHeightUnit = -1;
 int _OverlayAgent::__overlayMaxCount = -1;
 bool _OverlayAgent::__OverlayAgentBufferPixelFormat[] = {false, };
 
+struct visualElementDeleter
+{
+       void operator()(_VisualElement* pVisualElement)
+       {
+               pVisualElement->Destroy();
+       }
+};
+
 _OverlayAgent*
-_OverlayAgent::CreateInstanceN(_OverlayAgentStyle style, const _Control& control, const FloatRectangle& logBounds, const Rectangle& phyBounds)
+_OverlayAgent::CreateInstanceN(_OverlayAgentStyle style, const _Control& parentControl, const FloatRectangle& logicalBounds, const Rectangle& physicalBounds)
 {
-       unique_ptr<_OverlayAgent> pOverlayAgent(new (std::nothrow) _OverlayAgent(style, control, logBounds, phyBounds));
-       SysTryReturn(NID_UI_CTRL, pOverlayAgent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+       unique_ptr<_OverlayAgent> pOverlayAgent(new (std::nothrow) _OverlayAgent(style, parentControl, logicalBounds, physicalBounds));
+       SysTryReturn(NID_UI_CTRL, pOverlayAgent != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
 
        result r = GetLastResult();
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -237,69 +227,40 @@ _OverlayAgent::CreateInstanceN(_OverlayAgentStyle style, const _Control& control
        return pOverlayAgent.release();
 }
 
-_OverlayAgent::_OverlayAgent(_OverlayAgentStyle style, const _Control& control, const FloatRectangle& logBounds, const Rectangle& bounds)
-       : __pImageObject(null)
-       , __pRenderImageObject(null)
-       , __pSmartObject(null)
+_OverlayAgent::_OverlayAgent(_OverlayAgentStyle style, const _Control& parentControl, const FloatRectangle& logicalBounds, const Rectangle& physicalBounds)
+       : __pParentVE(null)
+       , __pRendererVE(null)
+       , __pImageObject(null)
+       , __style(style)
+       , __currentRotation(_OVERLAY_AGENT_ROTATION_NONE)
+       , __savedColorFormat(FOURCC('R','G','B','4'))
+       , __currentColorFormat(_OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888)
+       , __currentSourceBufferSize(0,0)
+       , __standardRendererBounds(0.0f, 0.0f, 0.0f, 0.0f)
+       , __needToRellaocImage(false)
+       , __pCurrentSourceBuffer(null)
+       , __pConvertedSourceBuffer(null)
        , __pixmapDamageHandle(0)
        , __pPixmapEventHandler(null)
        , __pixmap(0)
-       , __pVisualElement(null)
-       , __bgColor(0xff000000)
        , __xvPort(-1)
-       , __grabXvPort(false)
-       , __colorFormat(0)
-       , __userRotation(_ROTATION_0)
-       , __flushRotate(false)
-       , __udMirroring(0)
-       , __lrMirroring(0)
-       , __aspectRatio(false)
-       , __srcDimension(0, 0)
-       , __pixmapPhyRect(0, 0, 0, 0)
-       , __resizeRect(0, 0, 0, 0)
-       , __style(style)
        , __pXvImage(null)
-       , __newColorFormat(0)
        , __pShmInfo(null)
-       , __overlayAgentColorFormat(_OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888)
-       , __pRefUserByteBuffer(null)
-       , __pOrgUserByteBuffer(null)
-       , __orgUsrImgDimension(0, 0)
-       , __orgCbImgDimension(0, 0)
-       , __logicalOverlayRect(logBounds)
-       , __evasImageDamaged(false)
 {
-       result r = E_SUCCESS;
-
-       switch(style)
-       {
-       case _OVERLAY_AGENT_STYLE_REGION_SW:
-               //fall through
-       case _OVERLAY_AGENT_STYLE_REGION_GL:
-               r = CreateImageObjectForOverlayRegion(control, bounds);
-               break;
-
-       case _OVERLAY_AGENT_STYLE_PANEL_GL:
-               //fall through
-       case _OVERLAY_AGENT_STYLE_PANEL_SW:
-               r = CreateImageObject(control, bounds);
-               break;
-
-       default:
-               r = E_INVALID_ARG;
-       }
+       result r = CreateRendererVisualElement(parentControl, logicalBounds, physicalBounds);
 
        SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-       SysTryReturnVoidResult(NID_UI_CTRL, __pVisualElement != null, E_SYSTEM, "[E_SYSTEM] The VisualElement is null.");
+       SysTryReturnVoidResult(NID_UI_CTRL, __pRendererVE != null, E_SYSTEM, "[E_SYSTEM] The Renderer VisualElement is null.");
+       SysTryReturnVoidResult(NID_UI_CTRL, __pImageObject!= null, E_SYSTEM, "[E_SYSTEM] The Renderder ImageObject is null.");
 
-       __overlayAgentcount++;
-       SysLog(NID_UI_CTRL, "The overlayAgentcount in Constructor is [%d]", __overlayAgentcount);
+       __overlayAgentCount++;
+       SysLog(NID_UI_CTRL, "The current count of OverlayAgent is %d", __overlayAgentCount);
 }
 
 _OverlayAgent::~_OverlayAgent(void)
 {
-       SysLog(NID_UI_CTRL, "The overlayAgentcount in Destructor is [%d] and deleted.", __overlayAgentcount);
-       __overlayAgentcount--;
+       SysLog(NID_UI_CTRL, "The %dth OverlayAgent is deleted.", __overlayAgentCount);
+       __overlayAgentCount--;
 
        UngrabXvPort();
 
@@ -335,616 +296,231 @@ _OverlayAgent::~_OverlayAgent(void)
                __pXvImage = null;
        }
 
-       if (__pOrgUserByteBuffer)
-       {
-               delete __pOrgUserByteBuffer;
-               __pOrgUserByteBuffer = null;
-       }
-
-       if (__pImageObject)
+       if (__pConvertedSourceBuffer)
        {
-               evas_object_smart_member_del(__pImageObject);
-               evas_object_del(__pImageObject);
-               __pImageObject = null;
+               delete __pConvertedSourceBuffer;
+               __pConvertedSourceBuffer = null;
        }
 
-       if (__pRenderImageObject)
+       if (__pCurrentSourceBuffer)
        {
-               evas_object_smart_member_del(__pRenderImageObject);
-               evas_object_del(__pRenderImageObject);
-               __pRenderImageObject = null;
+               delete __pCurrentSourceBuffer;
+               __pCurrentSourceBuffer = null;
        }
 
-       if ((__style == _OVERLAY_AGENT_STYLE_REGION_SW || __style == _OVERLAY_AGENT_STYLE_REGION_GL)
-                       && (__pVisualElement != null))
+       if (__pRendererVE != null)
        {
-               __pVisualElement->Destroy();
-               __pVisualElement = null;
+               __pRendererVE->SetSurface(null);
+               __pRendererVE->Destroy();
+               __pRendererVE = null;
        }
 
-}
-
-result
-_OverlayAgent::Draw(void)
-{
-       SysTryReturnResult(NID_UI_CTRL, __pRefUserByteBuffer->GetPointer() != null, E_SYSTEM, "The current user buffer is null. (nothing to draw)");
-
-       result r = E_SUCCESS;
-       if(__style == _OVERLAY_AGENT_STYLE_REGION_SW || __style == _OVERLAY_AGENT_STYLE_PANEL_SW)
-       {
-               r = PutEvasImage();
-       }
-       else
+       if (__pImageObject)
        {
-               r = PutXvImage();
+               evas_object_del(__pImageObject);
+               __pImageObject = null;
        }
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r) );
-
-       return r;
 }
 
 result
 _OverlayAgent::GetBufferInfo(BufferInfo& bufferInfo) const
 {
-       int w = 0, h = 0;
-       evas_object_geometry_get(__pImageObject, NULL, NULL, &w, &h);
+       SysTryReturnResult(NID_UI_CTRL, __pImageObject != null, E_SYSTEM, "The Renderer ImageObject is null.");
+       SysTryReturnResult(NID_UI_CTRL, __pRendererVE != null, E_SYSTEM, "The Renderer Visual Element is null.");
+
+       int width = 0;
+       int height = 0;
+       evas_object_geometry_get(__pImageObject, NULL, NULL, &width, &height);
 
-       bufferInfo.width = w;
-       bufferInfo.pitch = w;
-       bufferInfo.height = h;
+       bufferInfo.width = width;
+       bufferInfo.pitch = width;
+       bufferInfo.height = height;
        bufferInfo.bitsPerPixel = 32;
        bufferInfo.pixelFormat = PIXEL_FORMAT_ARGB8888;
 
        _BufferInfoImpl* pBufferInfoImpl = _BufferInfoImpl::GetInstance(bufferInfo);
+       SysTryReturnResult(NID_UI_CTRL, pBufferInfoImpl != null, E_SYSTEM, "Failed to get instance of buffer info.");
+
+       result r = E_SUCCESS;
 
        if(__style == _OVERLAY_AGENT_STYLE_REGION_SW || __style == _OVERLAY_AGENT_STYLE_PANEL_SW)
        {
                pBufferInfoImpl->SetHandle(_BufferInfoImpl::HANDLE_TYPE_VE_SURFACE, reinterpret_cast<Handle>(__pImageObject));
-               SysSecureLog(NID_UI_CTRL,"return evas image object");
+               SysSecureLog(NID_UI_CTRL,"The returned handle of BufferInfo is a evas image object (HANDLE_TYPE_VE_SURFACE)");
        }
        else
        {
                pBufferInfoImpl->SetHandle(_BufferInfoImpl::HANDLE_TYPE_OVERLAY_REGION, __pixmap);
-               SysSecureLog(NID_UI_CTRL,"return pixmap ID");
+               SysSecureLog(NID_UI_CTRL,"The returned handle of BufferInfo is a pixmap (HANDLE_TYPE_OVERLAY_REGION)");
        }
 
-       pBufferInfoImpl->SetBounds(Rectangle(0, 0, w, h));
+       pBufferInfoImpl->SetBounds(Rectangle(0, 0, width, height));
 
-       return E_SUCCESS;
+       return r;
 }
 
 result
 _OverlayAgent::SetInputBuffer(const ByteBuffer& srcBuffer, const Dimension& srcDim, _OverlayAgentBufferPixelFormat srcFormat)
 {
-       SysTryReturn(NID_UI_CTRL, srcBuffer.GetPointer() != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The srcBuffer which is input parameter is invalid.");
-       SysTryReturn(NID_UI_CTRL, srcBuffer.GetCapacity() > 0, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The srcBuffer which is input parameter is invalid.");
-       SysTryReturn(NID_UI_CTRL, IsValidSourceDimension(srcDim), E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The srcDim which is input parameter is invalid.");
-
-       switch (srcFormat)
-       {
-       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888:
-               __newColorFormat = FOURCC('R','G','B','4');
-               break;
-       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_RGB565:
-               __newColorFormat = FOURCC('R','G','B','P');
-               break;
-       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_YCbCr420_PLANAR:
-               __newColorFormat = FOURCC('I','4','2','0');
-               break;
-       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_NV12:
-               __newColorFormat = FOURCC('N','V','1','2');
-               break;
-       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_UYVY:
-               __newColorFormat = FOURCC('U','Y','V','Y');
-               break;
-       default:
-               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "The specified pixel format is not supported.");
-               return E_UNSUPPORTED_FORMAT;
-       }
-
-       __srcDimension.width = srcDim.width;
-       __srcDimension.height = srcDim.height;
-
-       __overlayAgentColorFormat = srcFormat;
-       __pRefUserByteBuffer = &srcBuffer;
-
-       SysLog(NID_UI_CTRL,"The current value of buffer is %x, size is %d, new color format is %x",
-               __pRefUserByteBuffer->GetPointer(), __pRefUserByteBuffer->GetCapacity(), __newColorFormat);
-
-       return E_SUCCESS;
-}
-
-result
-_OverlayAgent::SetRotation(_OverlayAgentRotation rotation)
-{
-       SysTryReturnResult(NID_UI_CTRL, (rotation < _OVERLAY_AGENT_ROTATION_MAX), E_INVALID_ARG,
-                                               "[E_INVALID_ARG)] The rotation which is input parameter(%d) is invalid.", rotation);
-
-       int rotate = _ROTATION_0;
+       SysTryReturnResult(NID_UI_CTRL, srcBuffer.GetPointer() != null, E_INVALID_ARG, "The current value of input source buffer is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, srcBuffer.GetCapacity() > 0, E_INVALID_ARG, "The current size of input source buffer is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, srcDim.width >= GetSrcRectMinWidth(), E_INVALID_ARG, "The width of dimension [%d] is under the minimum size.", srcDim.width);
+       SysTryReturnResult(NID_UI_CTRL, srcDim.height >= GetSrcRectMinHeight(), E_INVALID_ARG, "The height of dimension [%d] is under the minimum size.", srcDim.height);
 
-       switch (rotation)
+       if (__currentColorFormat != srcFormat)
        {
-       case _OVERLAY_AGENT_ROTATION_NONE:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_NONE_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_NONE_UD:
-               rotate = _ROTATION_0;
-               break;
-
-       case _OVERLAY_AGENT_ROTATION_90:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_90_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_90_UD:
-               rotate = _ROTATION_90;
-               break;
-
-       case _OVERLAY_AGENT_ROTATION_180:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_180_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_180_UD:
-               rotate = _ROTATION_180;
-               break;
-
-       case _OVERLAY_AGENT_ROTATION_270:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_270_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_270_UD:
-               rotate = _ROTATION_270;
-               break;
-
-       default:
-               rotate = _ROTATION_0;
-               break;
-       }
+               unsigned int colorFormat = 0;
 
-       int udMirroring = 0;
-       int lrMirroring = 0;
+               switch (srcFormat)
+               {
+               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888:
+                       colorFormat = FOURCC('R','G','B','4');
+                       break;
+               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_RGB565:
+                       colorFormat = FOURCC('R','G','B','P');
+                       break;
+               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_YCbCr420_PLANAR:
+                       colorFormat = FOURCC('I','4','2','0');
+                       break;
+               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_NV12:
+                       colorFormat = FOURCC('N','V','1','2');
+                       break;
+               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_UYVY:
+                       colorFormat = FOURCC('U','Y','V','Y');
+                       break;
+               default:
+                       SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "The specified pixel format is not supported.");
+                       return E_UNSUPPORTED_FORMAT;
+               }
 
-       switch (rotation)
-       {
-       case _OVERLAY_AGENT_ROTATION_NONE_UD:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_90_UD:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_180_UD:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_270_UD:
-               udMirroring = 1;
-               lrMirroring = 0;
-               break;
-       case _OVERLAY_AGENT_ROTATION_NONE_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_90_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_180_LR:
-               // fall through
-       case _OVERLAY_AGENT_ROTATION_270_LR:
-               udMirroring = 0;
-               lrMirroring = 1;
-               break;
-       default:
-               udMirroring = 0;
-               lrMirroring = 0;
-               break;
+               __savedColorFormat = colorFormat;
+               __currentColorFormat = srcFormat;
+               __needToRellaocImage = true;
        }
 
-       __userRotation = rotate;
-       __udMirroring = udMirroring;
-       __lrMirroring = lrMirroring;
-       __flushRotate = true;
-
-       result r = AdjustImageObject();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-       SysLog(NID_UI_CTRL, "The current value of userRotation is %d, udMirroring is %d, lrMirroring is %d", __userRotation, __udMirroring, __lrMirroring);
-
-       return E_SUCCESS;
-}
-
-result
-_OverlayAgent::SetDestination(const FloatDimension& dimension)
-{
-       FloatDimension phyDimF = _CoordinateSystemUtils::Transform(dimension);
-       Dimension phyDim = _CoordinateSystemUtils::ConvertToInteger(phyDimF);
-
-       __resizeRect.width = phyDim.width;
-       __resizeRect.height = phyDim.height;
-       SysSecureLog(NID_UI_CTRL, "The current value of resizeRect is (%d, %d, %d, %d)",__resizeRect.x, __resizeRect.y, __resizeRect.width, __resizeRect.height);
-
-       result r = AdjustImageObject();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
-       return r;
-}
-
-result
-_OverlayAgent::SetAspectRatio(bool enable)
-{
-       __aspectRatio = enable;
-
-       return E_SUCCESS;
-}
-
-result
-_OverlayAgent::CreateImageObjectForOverlayRegion(const _Control& control, const Rectangle& phyBounds)
-{
-       _EflNode* pEflNode = null;
-       Evas_Object* pSmartObject = null;
-       Evas* pEvas = null;
-       Ecore_Evas* pEcoreEvas = null;
-       VisualElementSurface* pVisualElementSurface = null;
-       _VisualElementSurfaceImpl* pVisualElementSurfaceImpl = null;
-       Evas_Object* pTemp = null;
-
-       // 1. make VE for OR
-       _VisualElement* pParentVE = control.GetVisualElement();
-       SysTryReturn(NID_UI_CTRL, pParentVE != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] pParentVE is null.");
-
-       _VisualElementImpl* pVisualElementImpl = null;
-       _VisualElement* pVisualElement = new (std::nothrow) _VisualElement();
-
-       SysTryReturn(NID_UI_CTRL, pVisualElement != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pVisualElement : Memory shortage.");
-
-       result r = pVisualElement->Construct();
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r) );
-
-       pVisualElement->SetName("OverlayRegion");
-       pVisualElement->SetShowState(true);
-//     pVisualElement->SetOpacity(1.0f);
-       pVisualElement->SetImplicitAnimationEnabled(false);
-//     pVisualElement->SetBackgroundColor(_Colorf(0.0f, 0.0f, 0.0f, 0.0f));
-
-       pVisualElementImpl = _VisualElementImpl::GetInstance(*pVisualElement);
-
-       pVisualElementImpl->SetZOrderGroup(_CONTROL_LAYER_OVERLAY);
-       r = pParentVE->InsertChild(*pVisualElement, null, true);
-
-       pVisualElement->SetBounds(__logicalOverlayRect);
-
-       // 2. remove origin VE image object buffer
-       pVisualElementSurface = pVisualElementImpl->GetSurfaceN();
-       SysTryCatch(NID_UI_CTRL, pVisualElementSurface != null, , E_SYSTEM, "[E_SYSTEM] pVisualElementSurface is null" );
-
-       pVisualElementSurfaceImpl = _VisualElementSurfaceImpl::GetInstance(*pVisualElementSurface);
-       SysTryCatch(NID_UI_CTRL, pVisualElementSurfaceImpl != null, , E_SYSTEM, "[E_SYSTEM] pVisualElementSurfaceImpl is null" );
-
-       pTemp = (Evas_Object*)pVisualElementSurfaceImpl->GetNativeHandle();
-       SysTryCatch(NID_UI_CTRL, pTemp != null, , E_SYSTEM, "[E_SYSTEM] pTemp is null" );
-
-       evas_object_image_data_set(pTemp, NULL);
-       delete pVisualElementSurface;
-
-       // 3. create image object
-       pEflNode = dynamic_cast<_EflNode*>(pVisualElement->GetNativeNode());
-       SysTryCatch(NID_UI_CTRL, pEflNode != null, , E_SYSTEM, "[E_SYSTEM] pEflNode is null" );
-
-       pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
-       SysTryCatch(NID_UI_CTRL, pSmartObject != null, , E_SYSTEM, "[E_SYSTEM] pSmartObject is null" );
-
-       __pSmartObject = pSmartObject;
-
-       pEvas = evas_object_evas_get(pSmartObject);
-       SysTryCatch(NID_UI_CTRL, pEvas != null, , E_SYSTEM, "[E_SYSTEM] pEvas is null" );
-
-       pEcoreEvas = ecore_evas_ecore_evas_get(pEvas);
-       SysTryCatch(NID_UI_CTRL, pEcoreEvas != null, , E_SYSTEM, "[E_SYSTEM] pEcoreEvas is null" );
-
-       __pImageObject = evas_object_image_add(pEvas);
-       SysTryCatch(NID_UI_CTRL, __pImageObject != null, , E_SYSTEM, "[E_SYSTEM] __pImageObject is null" );
-       evas_object_name_set(__pImageObject, "OverlayRegionImageObj");
-
-       // 4. add image obj to smart object
-       evas_object_smart_member_add(__pImageObject, pSmartObject);
-       //evas_object_lower(__pImageObject);
-
-       SysSecureLog(NID_UI_CTRL, "phyBounds [%d, %d, %d, %d]", phyBounds.x, phyBounds.y, phyBounds.width, phyBounds.height);
-
-       evas_object_image_size_set(__pImageObject, phyBounds.width, phyBounds.height);
-       evas_object_image_filled_set(__pImageObject, EINA_TRUE);
-       evas_object_image_alpha_set(__pImageObject, false);
-       evas_object_resize(__pImageObject, phyBounds.width, phyBounds.height);
-       evas_object_move(__pImageObject, phyBounds.x, phyBounds.y);
-       evas_object_show(__pImageObject);
-
-       r = pVisualElement->SetFlushNeeded();
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-       __pVisualElement = pVisualElement;
-
-       SysSecureLog(NID_UI_CTRL, "ImageObjectForOverlayRegion SUCCESS  __pImageObject : %x, pSmartObject : %x", __pImageObject, pSmartObject);
-
-       return E_SUCCESS;
-
-CATCH:
-       if (__pImageObject)
+       if (!srcDim.Equals(__currentSourceBufferSize))
        {
-               evas_object_del(__pImageObject);
-               __pImageObject = null;
+               __currentSourceBufferSize.width = srcDim.width;
+               __currentSourceBufferSize.height = srcDim.height;
+               __needToRellaocImage = true;
        }
 
-       if (pVisualElementSurface)
+       if (__pCurrentSourceBuffer != &srcBuffer)
        {
-               delete pVisualElementSurface;
-               pVisualElementSurface = null;
+               __pCurrentSourceBuffer = &srcBuffer;
+               __needToRellaocImage = true;
        }
 
-       if (pVisualElement)
+       if (__needToRellaocImage)
        {
-               pVisualElement->Destroy();
-               pVisualElement = null;
+               SysSecureLog(NID_UI_CTRL,"The current buffer pointer is %x, size is %d, color format is %d",
+                       __pCurrentSourceBuffer->GetPointer(), __pCurrentSourceBuffer->GetCapacity(), __savedColorFormat);
        }
 
-       return E_SYSTEM;
-}
-
-result
-_OverlayAgent::CreateImageObject(const _Control& control, const Rectangle& phyBounds)
-{
-       VisualElementSurface* pVisualElementSurface = null;
-       _VisualElementSurfaceImpl* pVisualElementSurfaceImpl = null;
-       _VisualElement* pVisualElement = null;
-       _VisualElementImpl* pVisualElementImpl = null;
-       Evas* pEvas = null;
-       Evas_Object* pTemp = null;
-
-       _EflNode* pEflNode = dynamic_cast<_EflNode*>(control.GetVisualElement()->GetNativeNode());
-       SysTryReturn(NID_UI_CTRL, pEflNode != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pEflNode is null.");
-
-       Evas_Object* pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
-       SysTryReturn(NID_UI_CTRL, pSmartObject != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pSmartObject is null.");
-       __pSmartObject = pSmartObject;
-
-       pVisualElement = control.GetVisualElement();
-       SysTryReturn(NID_UI_CTRL, pVisualElement != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pVisualElement is null.");
-
-       pVisualElementImpl = _VisualElementImpl::GetInstance(*pVisualElement);
-       SysTryReturn(NID_UI_CTRL, pVisualElementImpl != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pVisualElementImpl is null.");
-
-       pVisualElementSurface = pVisualElementImpl->GetSurfaceN();
-       SysTryCatch(NID_UI_CTRL, pVisualElementSurface != null, , E_SYSTEM, "[E_SYSTEM] pVisualElementSurface is null" );
-
-       pVisualElementSurfaceImpl = _VisualElementSurfaceImpl::GetInstance(*pVisualElementSurface);
-       SysTryCatch(NID_UI_CTRL, pVisualElementSurfaceImpl != null, , E_SYSTEM, "[E_SYSTEM] pVisualElementSurfaceImpl is null" );
-
-       pTemp = (Evas_Object*)pVisualElementSurfaceImpl->GetNativeHandle();
-       SysTryCatch(NID_UI_CTRL, pTemp != null, , E_SYSTEM, "[E_SYSTEM] pTemp is null" );
-
-       evas_object_image_data_set(pTemp, NULL);
-       delete pVisualElementSurface;
-       pVisualElementSurface = null;
-
-       pEvas = evas_object_evas_get(pSmartObject);
-       SysTryReturn(NID_UI_CTRL, pEvas != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pEvas is null" );
-
-       // create renderRect object
-       __pRenderImageObject = evas_object_rectangle_add(pEvas);
-       evas_object_name_set(__pRenderImageObject, "OverlayPanelRenderRect");
-       SysTryReturn(NID_UI_CTRL, __pRenderImageObject != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] __pRenderImageObject is null");
-       evas_object_smart_member_add(__pRenderImageObject, pSmartObject);
-       evas_object_color_set(__pRenderImageObject, 0, 0, 0, 255); // 100% opaque black
-       evas_object_resize(__pRenderImageObject, phyBounds.width, phyBounds.height);
-       evas_object_move(__pRenderImageObject, phyBounds.x, phyBounds.y);
-       evas_object_show(__pRenderImageObject);
-
-       // create image object
-       __pImageObject = evas_object_image_add(pEvas);
-       //__pImageObject = evas_object_image_filled_add(pEvas);
-       SysTryCatch(NID_UI_CTRL, __pImageObject != null, , E_SYSTEM, "[E_SYSTEM] __pImageObject is null");
-
-       evas_object_smart_member_add(__pImageObject, pSmartObject);
-       evas_object_name_set(__pImageObject, "OverlayPanelImageObj");
-       evas_object_image_size_set(__pImageObject, phyBounds.width, phyBounds.height);
-       //evas_object_image_fill_set(__pImageObject, 0, 0, phyBounds.width, phyBounds.height);
-       evas_object_image_alpha_set(__pImageObject, false);
-       evas_object_image_filled_set(__pImageObject, EINA_TRUE);
-       evas_object_resize(__pImageObject, phyBounds.width, phyBounds.height);
-       evas_object_move(__pImageObject, phyBounds.x, phyBounds.y);
-       evas_object_show(__pImageObject);
-
-       __pVisualElement = control.GetVisualElement();
-
        return E_SUCCESS;
-
-CATCH:
-
-       if (pVisualElementSurface)
-       {
-               delete pVisualElementSurface;
-               pVisualElementSurface = null;
-       }
-
-       if (__pRenderImageObject)
-       {
-               evas_object_del(__pRenderImageObject);
-               __pRenderImageObject = null;
-       }
-
-       return E_SYSTEM;
 }
 
 result
-_OverlayAgent::CreatePixmap(void)
+_OverlayAgent::Draw(void)
 {
-       SysTryReturnResult(NID_UI_CTRL, __pImageObject != null, E_SYSTEM, "[E_SYSTEM] __pImageObject is null");
-
-       int x = 0;
-       int y = 0;
-       int w = 0;
-       int h = 0;
-
-       evas_object_geometry_get(__pImageObject, &x, &y, &w, &h);
-       SysSecureLog(NID_UI_CTRL,"__pImageObject rect is [%d, %d, %d, %d]", x, y, w, h);
-
-       Rectangle phyRect(x, y, w, h);
-       SysTryReturnResult(NID_UI_CTRL, (phyRect.width >= GetDstRectMinWidth()) && (phyRect.height >= GetDstRectMinHeight()), E_SYSTEM, "[E_SYSTEM] can't make a pixmap. dimension[%d, %d] is not proper",phyRect.width, phyRect.height);
-
-// Create pixmap.
-       Display *pDisplay = (Display*)ecore_x_display_get();
-       SysTryReturnResult(NID_UI_CTRL, pDisplay != null, E_SYSTEM, "[E_SYSTEM] pDisplay is null");
-
-       __pixmap = XCreatePixmap(pDisplay, DefaultRootWindow(pDisplay), phyRect.width, phyRect.height, DefaultDepth(pDisplay, DefaultScreen(pDisplay)));
-       SysTryReturnResult(NID_UI_CTRL, __pixmap != 0, E_SYSTEM, "[E_SYSTEM] failed to create a pixmap");
-
-       GC gc = XCreateGC(pDisplay, __pixmap, 0,0);
-       SysTryReturnResult(NID_UI_CTRL, gc > 0, E_SYSTEM, "[E_SYSTEM] failed to create GC");
-
-       XSetForeground(pDisplay, gc, (long unsigned int)(__bgColor.GetRGB32()));
-       XFillRectangle(pDisplay, __pixmap, gc, 0, 0, phyRect.width, phyRect.height);
-       XSync(pDisplay, 0);
-       XFreeGC(pDisplay, gc);
-
-// Set native surface.
-       Evas_Native_Surface surf = {0,};
-
-       surf.version = EVAS_NATIVE_SURFACE_VERSION;
-       surf.type = EVAS_NATIVE_SURFACE_X11;
-       surf.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
-       surf.data.x11.pixmap = __pixmap;
-
-       evas_object_lower(__pImageObject);
-       if (__style == _OVERLAY_AGENT_STYLE_PANEL_SW || __style == _OVERLAY_AGENT_STYLE_PANEL_GL)
-       {
-               if(__pRenderImageObject)
-               {
-                       evas_object_lower(__pRenderImageObject);
-               }
-       }
-
-       evas_object_image_native_surface_set(__pImageObject, &surf);
-
-// Create damage.
-       __pixmapDamageHandle = ecore_x_damage_new(__pixmap, ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES);
-       SysTryCatch(NID_UI_CTRL, __pixmapDamageHandle != 0, , E_SYSTEM, "[E_SYSTEM] failed to create a damage object");
-
-       __pPixmapEventHandler = ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY, OnPixmapDamaged, (void*)this);
-       SysTryCatch(NID_UI_CTRL, __pPixmapEventHandler != null, , E_SYSTEM, "[E_SYSTEM] failed to add a pixmap damage event handle");
-
-       __pixmapPhyRect = Rectangle(0, 0, phyRect.width, phyRect.height);
-
-       SysSecureLog(NID_UI_CTRL, "__pixmap : %d.", __pixmap);
-
-       return E_SUCCESS;
+       SysTryReturnResult(NID_UI_CTRL, __pCurrentSourceBuffer->GetPointer() != null, E_SYSTEM, "The current input user buffer is null. (nothing to draw)");
 
-CATCH:
-       if (__pPixmapEventHandler)
-       {
-               ecore_event_handler_del(__pPixmapEventHandler);
-               __pPixmapEventHandler = null;
-       }
+       result r = E_SUCCESS;
 
-       if (__pixmapDamageHandle)
+       if(__style == _OVERLAY_AGENT_STYLE_REGION_SW || __style == _OVERLAY_AGENT_STYLE_PANEL_SW)
        {
-               ecore_x_damage_free(__pixmapDamageHandle);
-               __pixmapDamageHandle = 0;
+               r = PutEvasImage();
        }
-
-       if (__pixmap)
+       else
        {
-               XFreePixmap((Display*)ecore_x_display_get(), __pixmap);
-               __pixmap = 0;
+               r = PutXvImage();
        }
 
-       return E_SYSTEM;
-}
-
-Pixmap
-_OverlayAgent::GetPixmap(void) const
-{
-       return __pixmap;
-}
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
 
-Evas_Object*
-_OverlayAgent::GetPixmapImageObject(void) const
-{
-       return __pImageObject;
+       return r;
 }
 
-result
-_OverlayAgent::Show(void) const
-{
-       return E_SUCCESS;
-}
 
 result
 _OverlayAgent::GrabXvPort(void)
 {
-       int firstXvPort = -1;
-       int portCount = -1;
-
        Display* pDisplay = (Display*)ecore_x_display_get();
-       SysTryReturn(NID_UI_CTRL, pDisplay != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
+       SysTryReturnResult(NID_UI_CTRL, pDisplay != null, E_SYSTEM, "The current value of Display is null");
 
-       if (!_CheckXvExtension(pDisplay, &firstXvPort, &portCount))
+       int baseXvPort = -1;
+       int portCount = -1;
+       if (!CheckXvExtension(pDisplay, &baseXvPort, &portCount))
        {
-               SysTryReturn(NID_UI_CTRL, false, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] _CheckXvExtension is failed.");
+               SysTryReturnResult(NID_UI_CTRL, false, E_SYSTEM, "Failed to check XvExtension");
        }
 
-       SysTryReturn(NID_UI_CTRL, firstXvPort != -1, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] first XvPort[%d] is invalid.", firstXvPort);
-       SysTryReturn(NID_UI_CTRL, portCount >= 1 && portCount <= _OVERLAYAGENT_XV_PORT , E_SYSTEM, E_SYSTEM, "[E_SYSTEM] portCount[%d] is invalid.", portCount);
+       SysTryReturnResult(NID_UI_CTRL, baseXvPort != -1, E_SYSTEM, "The current value of base XvPort is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, portCount >= 1 && portCount <= _OVERLAYAGENT_XV_PORT, E_SYSTEM, "The current count of available XvPort[%d] is invalid.", portCount);
 
-       _OverlayAgent::__baseXvPort = firstXvPort;
+       _OverlayAgent::__baseXvPort = baseXvPort;
 
-       int i, tempPort = 0;
-       for (i = 0; i < portCount; i++)
+       for (int index = 0; index < portCount; index++)
        {
-               if(!__isPortGrabbed[i])
+               if(!__isPortGrabbed[index])
                {
-                       tempPort = firstXvPort + i;
+                       int tempPort = __baseXvPort + index;
                        if (XvGrabPort(pDisplay, tempPort, 0) != Success)
                        {
-                               SysSecureLog(NID_UI_CTRL, "this port[%d] is alreadly used by another process", tempPort);
+                               SysSecureLog(NID_UI_CTRL, "The current XvPort[%d] has been alreadly used by another process", tempPort);
                        }
                        else
                        {
                                __xvPort = tempPort;
-                               __grabXvPort = true;
-                               __isPortGrabbed[i] = true;
+                               __isPortGrabbed[index] = true;
                                break;
                        }
                }
        }
 
-       SysTryReturn(NID_UI_CTRL, __xvPort != -1 , E_SYSTEM, E_SYSTEM, "XvGrabPort fail for pixmap : %d", __pixmap);
+       SysTryReturnResult(NID_UI_CTRL, __xvPort != -1, E_SYSTEM, "Failed to grab pixmap[%d]", __pixmap);
+       SysSecureLog(NID_UI_CTRL, "The current value of grabbed XvPort is [%d] and pixmap is [%d]", __xvPort, __pixmap);
 
-       SysSecureLog(NID_UI_CTRL, "XvGrabPort port: %d pixmap: %d style: %d", __xvPort, __pixmap, __style);
+       return E_SUCCESS;
+}
 
-       __overlayAgentXvPortCount++;
+void
+_OverlayAgent::UngrabXvPort(void)
+{
+       ClearLastResult();
 
-       return E_SUCCESS;
+       if (__isPortGrabbed[__xvPort - __baseXvPort])
+       {
+               Display* pDisplay = (Display*) ecore_x_display_get();
+               Atom atom = XInternAtom(pDisplay, "_USER_WM_PORT_ATTRIBUTE_STREAM_OFF", False);
+               XvSetPortAttribute(pDisplay, __xvPort, atom, 1);
+               XvUngrabPort(pDisplay, __xvPort, 0);
+
+               SysSecureLog(NID_UI_CTRL, "The current value of ungrabbed XvPort is %d, and pixmap is %d", __xvPort, __pixmap);
+
+               __isPortGrabbed[__xvPort - __baseXvPort] = false;
+               __xvPort = -1;
+       }
 }
 
 result
 _OverlayAgent::PutXvImage(void)
 {
-       SysTryReturnResult(NID_UI_CTRL, __pixmap != 0, E_SYSTEM, "[E_SYSTEM] __pixmap is invalid. something wrong!");
+       SysTryReturnResult(NID_UI_CTRL, __pixmap != 0, E_SYSTEM, "The current value of pixmap is null");
 
        Display* pDisplay = (Display*)ecore_x_display_get();
-       SysTryReturn(NID_UI_CTRL, pDisplay != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pDisplay is null.");
-
-       GC gc = DefaultGCOfScreen(DefaultScreenOfDisplay(pDisplay));
+       SysTryReturnResult(NID_UI_CTRL, pDisplay != null, E_SYSTEM, "The current value of Display is null");
 
-       bool needRealloc = false;
-       Dimension usrDim(__srcDimension.width,__srcDimension.height);
-       if (__pXvImage == null
-                       || __newColorFormat != __colorFormat
-                       || !usrDim.Equals(__orgUsrImgDimension) /*|| __pXvImage->data_size != __pRefUserByteBuffer->GetCapacity()*/)
+       if (__pXvImage == null || __needToRellaocImage)
+               //||(__pXvImage && __pXvImage->data_size != currentSourceBufferSize->GetCapacity()) )
        {
-               needRealloc = true;
-
                if (__xvPort != -1)
                {
-                               SysSecureLog(NID_UI_CTRL, "Need to unGrap port[%d]!", __xvPort);
-                               UngrabXvPort();
+                       UngrabXvPort();
                }
 
-               if(__pXvImage != null)
+               if (__pXvImage != null)
                {
-                       SysSecureLog(NID_UI_CTRL,"pXvImage->data_size : %d, userBufferSize : %d", __pXvImage->data_size, __pRefUserByteBuffer->GetCapacity());
-                       SysSecureLog(NID_UI_CTRL,"__newColorFormat : %x, __colorFormat : %x", __newColorFormat, __colorFormat);
-
                        if (__pShmInfo)
                        {
                                XShmDetach(pDisplay, __pShmInfo);
@@ -960,33 +536,21 @@ _OverlayAgent::PutXvImage(void)
                                __pXvImage = null;
                        }
                }
-               else
-               {
-                       SysSecureLog(NID_UI_CTRL, "__pXvImage is null!");
-               }
        }
 
        if (__xvPort == -1)
        {
-               SysSecureLog(NID_UI_CTRL, "port[%d] is invalid!", __xvPort);
                result r = GrabXvPort();
-               SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r) );
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
        }
 
-       if (needRealloc)
+       if (__needToRellaocImage)
        {
-               XvImage* pXvImage = null;
-               XShmSegmentInfo* pShmInfo = null;
-
-               pShmInfo = new (std::nothrow) XShmSegmentInfo();
-               if (pShmInfo == null)
-               {
-                       SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM]pShmInfo is null.");
-                       return E_SYSTEM;
-               }
+               XShmSegmentInfo* pShmInfo = new (std::nothrow) XShmSegmentInfo();
+               SysTryReturnResult(NID_UI_CTRL, pShmInfo != null, E_SYSTEM, "Failed to create XShmSegmentInfo");
 
-               pXvImage = XvShmCreateImage(pDisplay, __xvPort, __newColorFormat, 0, __srcDimension.width, __srcDimension.height, pShmInfo);
-               SysTryReturn(NID_UI_CTRL, pXvImage != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] failed to create a XvImage.");
+               XvImage* pXvImage = XvShmCreateImage(pDisplay, __xvPort, __savedColorFormat, 0, __currentSourceBufferSize.width, __currentSourceBufferSize.height, pShmInfo);
+               SysTryReturnResult(NID_UI_CTRL, pXvImage != null, E_SYSTEM, "Failed to create pXvImage");
 
                pShmInfo->shmid = shmget(IPC_PRIVATE, pXvImage->data_size, IPC_CREAT | 0777);
                pShmInfo->shmaddr = pXvImage->data = (char*)shmat(pShmInfo->shmid, 0, 0);
@@ -995,526 +559,499 @@ _OverlayAgent::PutXvImage(void)
                if (!XShmAttach(pDisplay, pShmInfo))
                {
                        XFree(pXvImage);
-                       SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] failed to XShmAttach.");
+                       SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] Failed to XShmAttach.");
                        return E_SYSTEM;
                }
 
                __pXvImage = pXvImage;
                __pShmInfo = pShmInfo;
-               __colorFormat = __newColorFormat;
+               SysSecureLog(NID_UI_CTRL,"The current value of XvImage's data size is [%d] and input buffer size is [%d]", __pXvImage->data_size, __pCurrentSourceBuffer->GetCapacity());
        }
 
-       memcpy(__pXvImage->data, __pRefUserByteBuffer->GetPointer(), __pXvImage->data_size);
-       __pRefUserByteBuffer = null;
-       __orgUsrImgDimension = usrDim;
+       memcpy(__pXvImage->data, __pCurrentSourceBuffer->GetPointer(), __pXvImage->data_size);
+       __pCurrentSourceBuffer = null;
 
-       XvShmPutImage(pDisplay, __xvPort, __pixmap, gc, __pXvImage, 0, 0, __srcDimension.width, __srcDimension.height,
-                       __pixmapPhyRect.x, __pixmapPhyRect.y, __pixmapPhyRect.width, __pixmapPhyRect.height, False);
+       int pixmapWidth = 0;
+       int pixmapHeight = 0;
+       evas_object_geometry_get(__pImageObject, null, null, &pixmapWidth, &pixmapHeight);
 
+       GC gc= DefaultGCOfScreen(DefaultScreenOfDisplay(pDisplay));
+       XvShmPutImage(pDisplay, __xvPort, __pixmap, gc, __pXvImage, 0, 0, __currentSourceBufferSize.width, __currentSourceBufferSize.height, 0, 0, pixmapWidth, pixmapHeight, False);
        XSync(pDisplay, 0);
 
-       SysSecureLog(NID_UI_CTRL, "colorFormat : %x, src[%d,%d,%d, %d], dst [%d,%d,%d,%d]", __colorFormat, 0, 0, __srcDimension.width, __srcDimension.height,__pixmapPhyRect.x, __pixmapPhyRect.y, __pixmapPhyRect.width, __pixmapPhyRect.height);
+       if (__needToRellaocImage)
+       {
+               SysSecureLog(NID_UI_CTRL, "The current value of source buffer size is [%d,%d]", __currentSourceBufferSize.width, __currentSourceBufferSize.height);
+               SysSecureLog(NID_UI_CTRL, "The current value of destination XvImage size is [%d,%d]", pixmapWidth, pixmapHeight);
+               __needToRellaocImage = false;
+       }
+
+       result r = __pRendererVE->SetFlushNeeded();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r,"[%s] Propagating.", GetErrorMessage(r));
 
-       return E_SUCCESS;
+       return r;
 }
 
 result
 _OverlayAgent::PutEvasImage(void)
 {
-       SysTryReturn(NID_UI_CTRL, __pImageObject, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] __pImageObject is null.");
-       SysTryReturn(NID_UI_CTRL, __pRefUserByteBuffer->GetPointer(), E_SYSTEM, E_SYSTEM, "[E_SYSTEM] __pUserBuffer is null.");
+       SysTryReturnResult(NID_UI_CTRL, __pImageObject != null, E_SYSTEM, "The current value of Renderer ImageObject is null");
+       SysTryReturnResult(NID_UI_CTRL, __pCurrentSourceBuffer->GetPointer() != null, E_SYSTEM, "The current value of Renderer byte buffer is null");
 
-       result r = E_SYSTEM;
+       result r = E_SUCCESS;
 
-       Dimension usrDim(__srcDimension.width,__srcDimension.height);
-       if(!usrDim.Equals(__orgUsrImgDimension) || __pOrgUserByteBuffer == null)
+       // Create new buffer to convert pixel format
+       if (__needToRellaocImage || __pConvertedSourceBuffer == null ||
+               !(__pConvertedSourceBuffer && (__pConvertedSourceBuffer->GetCapacity() == __pCurrentSourceBuffer->GetCapacity())))
        {
-               if(__pOrgUserByteBuffer)
+               if (__pConvertedSourceBuffer != null)
                {
-                       __pOrgUserByteBuffer->SetPosition(0);
-                       delete __pOrgUserByteBuffer;
-                       __pOrgUserByteBuffer = null;
+                       __pConvertedSourceBuffer->SetPosition(0);
+                       delete __pConvertedSourceBuffer;
+                       __pConvertedSourceBuffer = null;
                }
 
-               int bufSize = __srcDimension.width *__srcDimension.height * 4;
-               __pOrgUserByteBuffer = new (std::nothrow) ByteBuffer;
-               SysTryReturn(NID_UI_CTRL, __pOrgUserByteBuffer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] __pOrgUserByteBuffer is null.");
+               __pConvertedSourceBuffer = new (std::nothrow) ByteBuffer;
+               SysTryReturnResult(NID_UI_CTRL, __pConvertedSourceBuffer != null, E_OUT_OF_MEMORY, "Failed to create a ByteBuffer for Evas Image Object.");
 
-               r = __pOrgUserByteBuffer->Construct(bufSize);
-               if(r != E_SUCCESS)
+               r = __pConvertedSourceBuffer->Construct(__currentSourceBufferSize.width * __currentSourceBufferSize.height * 4);
+               if (r != E_SUCCESS)
                {
-                       SysLogException(NID_UI_CTRL, r, "[%s] Failed to construct a __pOrgUserByteBuffer.", GetErrorMessage(r));
-                       delete __pOrgUserByteBuffer;
-                       __pOrgUserByteBuffer = null;
+                       delete __pConvertedSourceBuffer;
+                       __pConvertedSourceBuffer = null;
+                       SysLogException(NID_UI_CTRL, r, "[%s] Failed to construct a byte buffer for EvasImageObject.", GetErrorMessage(r));
+
                        return r;
                }
        }
 
-       __pOrgUserByteBuffer->SetPosition(0);
+       __pConvertedSourceBuffer->SetPosition(0);
 
-       void* pImg = null;
-       if(__overlayAgentColorFormat == _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888)
-       {
-               r = __pOrgUserByteBuffer->SetArray(__pRefUserByteBuffer->GetPointer(), 0, __pOrgUserByteBuffer->GetCapacity());
-               SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r,"[%s] Propagating.", GetErrorMessage(r));
-
-               pImg = (void*)__pOrgUserByteBuffer->GetPointer();
-               //_ImageUtil::ConvertPixelFormat(srcBuffer, MEDIA_PIXEL_FORMAT_RGBA8888, __srcDimension.width, __srcDimension.height, *pDstbuf, MEDIA_PIXEL_FORMAT_RGBA8888);
-       }
-       else
+       switch (__currentColorFormat)
        {
-               switch (__overlayAgentColorFormat)
-               {
-               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_RGB565:
-                       r = _ImageUtil::ConvertPixelFormat(*__pRefUserByteBuffer, MEDIA_PIXEL_FORMAT_RGB565LE, __srcDimension.width, __srcDimension.height, *__pOrgUserByteBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
-                       break;
-               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_YCbCr420_PLANAR:
-                       r = _ImageUtil::ConvertPixelFormat(*__pRefUserByteBuffer, MEDIA_PIXEL_FORMAT_YUV420P, __srcDimension.width, __srcDimension.height, *__pOrgUserByteBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
-                       break;
-               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_NV12:
-                       r = _ImageUtil::ConvertPixelFormat(*__pRefUserByteBuffer, MEDIA_PIXEL_FORMAT_NV12, __srcDimension.width, __srcDimension.height, *__pOrgUserByteBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
-                       break;
-               case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_UYVY:
-                       r = _ImageUtil::ConvertPixelFormat(*__pRefUserByteBuffer, MEDIA_PIXEL_FORMAT_UYVY422, __srcDimension.width, __srcDimension.height, *__pOrgUserByteBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
-                       break;
-               default:
-                       SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "The specified pixel format is not supported.");
-                       return E_UNSUPPORTED_FORMAT;
-               }
-
-               SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r,"[%s] Propagating.", GetErrorMessage(r));
-
-               pImg = (void*)(__pOrgUserByteBuffer->GetPointer());
-
+       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888:
+               r = __pConvertedSourceBuffer->SetArray(__pCurrentSourceBuffer->GetPointer(), 0, __pConvertedSourceBuffer->GetCapacity());
+               break;
+       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_RGB565:
+               r = _ImageUtil::ConvertPixelFormat(*__pCurrentSourceBuffer, MEDIA_PIXEL_FORMAT_RGB565LE, __currentSourceBufferSize.width, __currentSourceBufferSize.height, *__pConvertedSourceBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
+               break;
+       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_YCbCr420_PLANAR:
+               r = _ImageUtil::ConvertPixelFormat(*__pCurrentSourceBuffer, MEDIA_PIXEL_FORMAT_YUV420P, __currentSourceBufferSize.width, __currentSourceBufferSize.height, *__pConvertedSourceBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
+               break;
+       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_NV12:
+               r = _ImageUtil::ConvertPixelFormat(*__pCurrentSourceBuffer, MEDIA_PIXEL_FORMAT_NV12, __currentSourceBufferSize.width, __currentSourceBufferSize.height, *__pConvertedSourceBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
+               break;
+       case _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_UYVY:
+               r = _ImageUtil::ConvertPixelFormat(*__pCurrentSourceBuffer, MEDIA_PIXEL_FORMAT_UYVY422, __currentSourceBufferSize.width, __currentSourceBufferSize.height, *__pConvertedSourceBuffer, MEDIA_PIXEL_FORMAT_BGRA8888);
+               break;
+       default:
+               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The specified pixel format is not supported.");
+               return E_UNSUPPORTED_FORMAT;
        }
 
-       SysTryReturnResult(NID_UI_CTRL, pImg != null, E_SYSTEM, "[E_SYSTEM] converted image data is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r,"Propagating.");
 
-//     SysLog(NID_UI_CTRL, "__pUserBuffer : %x, size : %d", __pRefUserByteBuffer->GetPointer(),  __pRefUserByteBuffer->GetCapacity());
-//     SysLog(NID_UI_CTRL, "__pOrgBuffer : %x, size : %d", __pOrgUserByteBuffer->GetPointer(),  __pOrgUserByteBuffer->GetCapacity());
-//     SysLog(NID_UI_CTRL, "__srcDimension[%d, %d]",__srcDimension.width, __srcDimension.height);
+       __pCurrentSourceBuffer = null;
+       void* pImageData = (void*)(__pConvertedSourceBuffer->GetPointer());
+       SysTryReturnResult(NID_UI_CTRL, pImageData != null, E_SYSTEM, "The converted image data for Overlay Renderer VisualElement is invalid.");
 
-       evas_object_image_size_set(__pImageObject, __srcDimension.width, __srcDimension.height);
-       evas_object_image_filled_set(__pImageObject, EINA_TRUE);
-       evas_object_image_alpha_set(__pImageObject, false);
-       evas_object_image_data_set(__pImageObject, pImg);
-       evas_object_image_data_update_add(__pImageObject, 0, 0, __srcDimension.width, __srcDimension.height);
+       evas_object_image_size_set(__pImageObject, __currentSourceBufferSize.width, __currentSourceBufferSize.height);
+       evas_object_image_data_set(__pImageObject, pImageData);
+       evas_object_image_data_update_add(__pImageObject, 0, 0, __currentSourceBufferSize.width, __currentSourceBufferSize.height);
        evas_object_show(__pImageObject);
 
-       AdjustImageObject();
+       if (__needToRellaocImage)
+       {
+               SysSecureLog(NID_UI_CTRL, "The current value of source buffer bounds is [%d,%d,%d, %d]", 0, 0, __currentSourceBufferSize.width, __currentSourceBufferSize.height);
+               __needToRellaocImage = false;
+       }
 
-       __pVisualElement->SetFlushNeeded();
+       r = __pRendererVE->SetFlushNeeded();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r,"[%s] Propagating.", GetErrorMessage(r));
 
-       __orgUsrImgDimension = usrDim;
-       __pRefUserByteBuffer = null;
+       return r;
+}
 
-       return E_SUCCESS;
+result
+_OverlayAgent::SetRendererFlushNeeded(void)
+{
+       return __pRendererVE->SetFlushNeeded();
 }
 
-void
-_OverlayAgent::UngrabXvPort(void)
+result
+_OverlayAgent::SetRotation(_OverlayAgentRotation rotation)
 {
-       if (__grabXvPort)
+       SysTryReturnResult(NID_UI_CTRL, __pRendererVE != null, E_SYSTEM, "The Renderer Visual Element is null");
+       SysTryReturnResult(NID_UI_CTRL, rotation < _OVERLAY_AGENT_ROTATION_MAX, E_INVALID_ARG, "The value of input rotation [%d] is invalid.", rotation);
+
+       if (rotation == __currentRotation)
        {
-               Display* pDisplay = (Display*) ecore_x_display_get();
-               Atom atom = XInternAtom(pDisplay, "_USER_WM_PORT_ATTRIBUTE_STREAM_OFF", False);
-               XvSetPortAttribute(pDisplay, __xvPort, atom, 1);
-               XvUngrabPort(pDisplay, __xvPort, 0);
+               return E_SUCCESS;
+       }
+
+       float initialZAngle = __pRendererVE->GetProperty(L"transform.rotation.z").ToFloat();
+       float rotatedZAngle = initialZAngle;
+
+       switch (rotation)
+       {
+       case _OVERLAY_AGENT_ROTATION_NONE: // fall through
+       case _OVERLAY_AGENT_ROTATION_NONE_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_NONE_UD:
+               rotatedZAngle = 0.0f;
+               break;
+
+       case _OVERLAY_AGENT_ROTATION_90: // fall through
+       case _OVERLAY_AGENT_ROTATION_90_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_90_UD:
+               rotatedZAngle = 90.0f;
+               break;
+
+       case _OVERLAY_AGENT_ROTATION_180: // fall through
+       case _OVERLAY_AGENT_ROTATION_180_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_180_UD:
+               rotatedZAngle = 180.0f;
+               break;
 
-               SysSecureLog(NID_UI_CTRL, "The current value of UngrabXvPort port is %d, pixmap is %d and style is %d", __xvPort, __pixmap, __style);
+       case _OVERLAY_AGENT_ROTATION_270: // fall through
+       case _OVERLAY_AGENT_ROTATION_270_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_270_UD:
+               rotatedZAngle = 270.0f;
+               break;
 
-               __isPortGrabbed[__xvPort-__baseXvPort] = false;
-               __xvPort = -1;
-               __grabXvPort = false;
-               __overlayAgentXvPortCount--;
+       default:
+               break;
        }
-}
 
-bool
-_OverlayAgent::IsValidSourceDimension(const Dimension& dimension) const
-{
-       SysTryReturn(NID_UI_CTRL, dimension.width >= GetSrcRectMinWidth(), false, E_INVALID_ARG, "[E_INVALID_ARG] The width of dimension [%d] is under the minimum size.", dimension.width);
-       SysTryReturn(NID_UI_CTRL, dimension.height >= GetSrcRectMinHeight(), false, E_INVALID_ARG, "[E_INVALID_ARG] The height of dimension [%d] is under the minimum size.", dimension.height);
+       //Set bounds of rotated renderer
+       FloatRectangle rendererBounds = __standardRendererBounds;
+       if (rotatedZAngle == 90.0f || rotatedZAngle == 270.0f )
+       {
+               rendererBounds.x = __standardRendererBounds.x - ((__standardRendererBounds.height - __standardRendererBounds.width) / 2.0f);
+               rendererBounds.y = __standardRendererBounds.y + ((__standardRendererBounds.height - __standardRendererBounds.width) / 2.0f);
+               std::swap(rendererBounds.height, rendererBounds.width);
+       }
 
-       SetLastResult(E_SUCCESS);
+       result r = __pRendererVE->SetBounds(rendererBounds);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-       return true;
-}
+       r = __pRendererVE->SetProperty(L"transform.rotation.z", rotatedZAngle);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+       SysLog(NID_UI_CTRL, "The current Overlay Renderer is rotated (%d -> %d)", static_cast<int>(initialZAngle), static_cast<int>(rotatedZAngle));
 
-bool
-_OverlayAgent::IsValidDestinationDimension(const FloatDimension& dimension) const
-{
-       FloatDimension phyDimF = _CoordinateSystemUtils::Transform(dimension);
-       Dimension phyDim = _CoordinateSystemUtils::ConvertToInteger(phyDimF);
+       switch (rotation)
+       {
+       case _OVERLAY_AGENT_ROTATION_NONE: // fall through
+       case _OVERLAY_AGENT_ROTATION_90: // fall through
+       case _OVERLAY_AGENT_ROTATION_180: // fall through
+       case _OVERLAY_AGENT_ROTATION_270:
+               r = __pRendererVE->SetProperty(L"transform.rotation.x", 0.0f);
+               r = __pRendererVE->SetProperty(L"transform.rotation.y", 0.0f);
+               break;
 
-       SysTryReturn(NID_UI_CTRL, (phyDim.width >= GetDstRectMinWidth() && phyDim.height >= GetDstRectMinHeight()), false, E_INVALID_ARG,
-                       "[E_INVALID_ARG] Dimension L[%.3f, %.3f] P[%d,%d] is over minimun size.", dimension.width, dimension.height, phyDim.width, phyDim.height);
+       case _OVERLAY_AGENT_ROTATION_NONE_UD: // fall through
+       case _OVERLAY_AGENT_ROTATION_180_UD: // fall through
+       case _OVERLAY_AGENT_ROTATION_90_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_270_LR:
+               r = __pRendererVE->SetProperty(L"transform.rotation.x", 180.0f);
+               r = __pRendererVE->SetProperty(L"transform.rotation.y", 0.0f);
+               SysLog(NID_UI_CTRL, "The current Overlay Renderer is flipped over up side down.");
+               break;
+
+       case _OVERLAY_AGENT_ROTATION_NONE_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_180_LR: // fall through
+       case _OVERLAY_AGENT_ROTATION_90_UD: // fall through
+       case _OVERLAY_AGENT_ROTATION_270_UD:
+               r = __pRendererVE->SetProperty(L"transform.rotation.x", 0.0f);
+               r = __pRendererVE->SetProperty(L"transform.rotation.y", 180.0f);
+               SysLog(NID_UI_CTRL, "The current Overlay Renderer is flipped over left side right.");
+               break;
 
-       SysTryReturn(NID_UI_CTRL, __pSmartObject != null, false, E_SYSTEM, "[E_SYSTEM] __pSmartObject is null");
+       default:
+               break;
+       }
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-       FloatRectangle testRect = __pVisualElement->GetBounds();
-       FloatRectangle containerPhyRectF = _CoordinateSystemUtils::Transform(testRect);
-       Dimension containerDim = _CoordinateSystemUtils::ConvertToInteger(FloatDimension(containerPhyRectF.width, containerPhyRectF.height));
+       __currentRotation = rotation;
 
-       SysTryReturn(NID_UI_CTRL, (phyDim.width <= containerDim.width && phyDim.height <= containerDim.height), false, E_INVALID_ARG,
-                       "[E_INVALID_ARG] RenderRect L[%.3f, %.3f] P[%d,%d] is bigger than container size [%d, %d]", dimension.width, dimension.height, phyDim.width, phyDim.height, containerDim.width, containerDim.height);
+       r = __pRendererVE->SetFlushNeeded();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-       return true;
+       return r;
 }
 
 result
-_OverlayAgent::AdjustImageObject(void)
+_OverlayAgent::SetDestination(const FloatDimension& dimension)
 {
-       SysTryReturn(NID_UI_CTRL, __pSmartObject != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The SmartObject is null");
-       SysTryReturn(NID_UI_CTRL, __pImageObject != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The ImageObject is null");
-       SysTryReturn(NID_UI_CTRL, __pVisualElement != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] The VisualElement is null");
-
-       int x = 0;
-       int y = 0;
-       int w = 0;
-       int h = 0;
-       int resizeRectX = 0;
-       int resizeRectY = 0;
-       int resizeRectW = 0;
-       int resizeRectH = 0;
-       int noImage = false;
-       int imgWidth = 0, imgHeight = 0;
-       //int orgX, orgY, orgW, orgH;
+       SysTryReturnResult(NID_UI_CTRL, __pParentVE != null, E_SYSTEM, "The Renderer Visual Element is null");
+       SysTryReturnResult(NID_UI_CTRL, __pRendererVE != null, E_SYSTEM, "The Renderer Visual Element is null");
 
-       FloatRectangle curRectF = __pVisualElement->GetBounds();
-       FloatRectangle curPhyRectF = _CoordinateSystemUtils::Transform(curRectF);
-       Rectangle curPhyRect = _CoordinateSystemUtils::ConvertToInteger(curPhyRectF);
-       SysLog(NID_UI_CTRL, "The current value of curPhyRect [%d, %d]", curPhyRect.width, curPhyRect.height);
+       //Set bounds of saved renderer
+       FloatRectangle parentBounds= __pParentVE->GetBounds();
 
-       if (__srcDimension.width == 0 || __srcDimension.height == 0)
+       if (parentBounds.width >= dimension.width)
        {
-               SysSecureLog(NID_UI_CTRL, "src dimension[%d, %d] is an initialized state", __srcDimension.width, __srcDimension.height);
-               noImage = true;
+               __standardRendererBounds.x = (parentBounds.width - dimension.width) / 2.0f;
+               __standardRendererBounds.width = dimension.width;
+       }
+       else
+       {
+               __standardRendererBounds.x = 0.0f;
+               __standardRendererBounds.width = parentBounds.width;
        }
 
-       // 1. setting renderRect resize region
-       if(__resizeRect.width == 0 || __resizeRect.height == 0)
+       if (parentBounds.height >= dimension.height)
        {
-               if (__pRenderImageObject)
-               {
-                       evas_object_geometry_get(__pRenderImageObject, NULL, NULL, &resizeRectW, &resizeRectH);
-               }
-               else
-               {
-                       resizeRectW = curPhyRect.width;
-                       resizeRectH = curPhyRect.height;
-               }
+               __standardRendererBounds.y = (parentBounds.height - dimension.height) / 2.0f;
+               __standardRendererBounds.height = dimension.height;
        }
        else
        {
-               resizeRectW = __resizeRect.width;
-               resizeRectH = __resizeRect.height;
+               __standardRendererBounds.y = 0.0f;
+               __standardRendererBounds.height = parentBounds.height;
        }
 
-       // 2. adjust RenderRect
-       x = curPhyRect.x;
-       y = curPhyRect.y;
-       w = curPhyRect.width;
-       h = curPhyRect.height;
-       SysSecureLog(NID_UI_CTRL, "container [%d, %d, %d, %d]", x, y, w, h);
+       //Set bounds of resizing renderer
+       float parentWidth = parentBounds.width;
+       float parentHeight = parentBounds.height;
+       FloatDimension inputDimension(dimension.width, dimension.height);
 
-       if(__pRenderImageObject)
+       Variant rotationAngle = __pRendererVE->GetProperty(L"transform.rotation.z");
+       if(rotationAngle.ToFloat() == 90.0f || rotationAngle.ToFloat() == 270.0f)
        {
-//             evas_object_geometry_get(__pRenderImageObject, &orgX, &orgY, &orgW, &orgH);
-//             SysLog(NID_UI_CTRL, "renderRect before [%d, %d, %d, %d]", orgX, orgY, orgW, orgH);
-
-               evas_object_resize(__pRenderImageObject, resizeRectW, resizeRectH);
-
-               resizeRectX = x + ((w - resizeRectW)/2);
-               resizeRectY = y + ((h - resizeRectH)/2);
-               evas_object_move(__pRenderImageObject, resizeRectX, resizeRectY);
-               evas_object_show(__pRenderImageObject);
+               std::swap(parentWidth, parentHeight);
+               std::swap(inputDimension.width, inputDimension.height);
+       }
 
-               SysSecureLog(NID_UI_CTRL, "renderRect [%d, %d, %d, %d]", resizeRectX, resizeRectY, resizeRectW, resizeRectH);
+       FloatRectangle rendererBounds = __standardRendererBounds;
 
-//             evas_object_geometry_get(__pRenderImageObject, &orgX, &orgY, &orgW, &orgH);
-//             SysLog(NID_UI_CTRL, "renderRect after adjust [%d, %d, %d, %d]", orgX, orgY, orgW, orgH);
+       if (parentWidth >= inputDimension.width)
+       {
+               rendererBounds.x = (parentBounds.width - inputDimension.width) / 2.0f;
+               rendererBounds.width = inputDimension.width;
        }
        else
        {
-               //evas_object_geometry_get(__pImageObject, &orgX, &orgY, &orgW, &orgH);
-               //SysLog(NID_UI_CTRL, "__pImageObject rect [%d, %d, %d, %d]", orgX, orgY, orgW, orgH);
+               rendererBounds.x = 0.0f;
+               rendererBounds.width = parentBounds.width;
+       }
 
-               // set region base x, y
-               resizeRectX = x;
-               resizeRectY = y;
+       if (parentHeight >= inputDimension.height)
+       {
+               rendererBounds.y = (parentBounds.height - inputDimension.height) / 2.0f;
+               rendererBounds.height = inputDimension.height;
+       }
+       else
+       {
+               rendererBounds.y = 0.0f;
+               rendererBounds.height = parentBounds.height;
        }
+       SysLog(NID_UI_CTRL, "The current bounds of resized renderer is [%.3f, %.3f, %.3f, %.3f]", 
+               __standardRendererBounds.x, __standardRendererBounds.y, __standardRendererBounds.width, __standardRendererBounds.height);
 
-       SysSecureLog(NID_UI_CTRL, "resizeRect is [%d, %d, %d, %d]", resizeRectX, resizeRectY, resizeRectW, resizeRectH);
+       result r = __pRendererVE->SetBounds(rendererBounds);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-       if (__flushRotate)
-       {
-               int finalX, finalY, finalW, finalH;
+       r = __pRendererVE->SetFlushNeeded();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-               SysSecureLog(NID_UI_CTRL, "for rotate status operation");
+       return r;
+}
 
-               // 3. image object rotate
-               Evas_Map* pMap = evas_map_new(4);
-               evas_map_util_points_populate_from_object(pMap, __pImageObject);
+result
+_OverlayAgent::SetAspectRatio(bool enable)
+{
+       return E_SUCCESS;
+}
 
-               SysSecureLog(NID_UI_CTRL, "center [%d, %d]", resizeRectX + (resizeRectW/2), resizeRectY + (resizeRectH/2));
-               evas_map_util_rotate(pMap, __userRotation, resizeRectX + (resizeRectW/2), resizeRectY + (resizeRectH/2));
+FloatRectangle
+_OverlayAgent::GetBounds(void) const
+{
+       SysTryReturn(NID_UI_CTRL, __pRendererVE != null, FloatRectangle(0.0f, 0.0f, 0.1f, 0.1f), E_SYSTEM, "The Renderer Visual Element is null");
+       return __standardRendererBounds;
+}
 
-               evas_object_map_set(__pImageObject, pMap);
-               evas_object_map_enable_set(__pImageObject, EINA_TRUE);
+result
+_OverlayAgent::CreateRendererVisualElement(const _Control& parentControl, const FloatRectangle& logicalBounds, const Rectangle& physicalBounds)
+{
+       //Create new VisualElement and insert it to Parent's VisualElement
+       unique_ptr<_VisualElement, visualElementDeleter> pRendererVE(new (std::nothrow) _VisualElement());
+       SysTryReturnResult(NID_UI_CTRL, pRendererVE != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient");
 
-               evas_object_image_filled_set(__pImageObject, EINA_TRUE);
-               evas_object_show(__pImageObject);
-               evas_map_free(pMap);
+       result r = pRendererVE->Construct();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-               SysSecureLog(NID_UI_CTRL, "rotate value is [%d]",__userRotation);
+       pRendererVE->SetName("OverlayRenderer");
+       pRendererVE->SetShowState(true);
+       //pRendererVE->SetImplicitAnimationEnabled(true);
+       pRendererVE->SetImplicitAnimationEnabled(false);
+       pRendererVE->SetZOrderGroup(_CONTROL_LAYER_OVERLAY);
 
-               // 4. reset map coordinate
-               if (!noImage && __aspectRatio && __pRenderImageObject != null)
-               {
-                       //  don't do anything for a Render Rect,  only adjust an image object coordination again
-                       Dimension srcDim(__srcDimension.width, __srcDimension.height);
-                       if (__userRotation == _ROTATION_90 || __userRotation == _ROTATION_270 )
-                       {
-                               int tmp = srcDim.width;
-                               srcDim.width = srcDim.height;
-                               srcDim.height = tmp;
-//                     SysLog(NID_UI_CTRL, "src dim is swapped");
-                       }
+       FloatPoint logicalPoint(0.0f, 0.0f);
+       if(__style == _OVERLAY_AGENT_STYLE_REGION_SW || __style == _OVERLAY_AGENT_STYLE_REGION_GL)
+       {
+               logicalPoint.x = logicalBounds.x;
+               logicalPoint.y = logicalBounds.y;
+       }
+       pRendererVE->SetBounds(FloatRectangle(logicalPoint.x, logicalPoint.y, logicalBounds.width, logicalBounds.height));
 
-                       SysSecureLog(NID_UI_CTRL, "src dimension [%d, %d]", srcDim.width, srcDim.height);
 
-                       float srcRatio = ((float)srcDim.width) / ((float)srcDim.height);
+       __pParentVE = parentControl.GetVisualElement();
+       SysTryReturnResult(NID_UI_CTRL, __pParentVE != null, E_SYSTEM, "[E_SYSTEM] The current value of OverlayPanel's VisualElement is null.");
 
-                       float tmpWidth = (float)resizeRectW;
-                       float tmpHeight = tmpWidth / srcRatio;
+       __pParentVE->SetName("OverlayPanel");
+       r = __pParentVE->InsertChild(pRendererVE.get(), null, true);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-                       if (resizeRectH < (int)tmpHeight)
-                       {
-                               finalH = resizeRectH;
-                               finalW = (int)((float)finalH * srcRatio);
-                       }
-                       else
-                       {
-                               finalW = resizeRectW;
-                               finalH = (int)((float)finalW / srcRatio);
-                       }
+       r = __pParentVE->SetSurfaceOpaque(true);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-                       finalX = resizeRectX + ((resizeRectW - finalW) / 2);
-                       finalY = resizeRectY + ((resizeRectH - finalH) / 2);
-               }
-               else
-               {
-                       finalX = resizeRectX;
-                       finalY = resizeRectY;
-                       finalW = resizeRectW;
-                       finalH = resizeRectH;
-               }
 
-               //int p1, p2, p3, p4;
-               //evas_object_geometry_get(__pImageObject, &p1, &p2, &p3, &p4);
-               //SysLog(NID_UI_CTRL, "__pImageObject after rotate [%d, %d, %d, %d]", p1, p2, p3, p4);
+       // Get and Set ImageObject of Renderer VisualElement
+       _EflNode* pEflNode = dynamic_cast<_EflNode*>(pRendererVE->GetNativeNode());
+       SysTryReturnResult(NID_UI_CTRL, pEflNode != null, E_SYSTEM, "Failed to get EflNode from Renderer VisualElement.");
 
-               SysSecureLog(NID_UI_CTRL, "final image object [%d, %d, %d, %d]", finalX, finalY, finalW, finalH);
+       Evas_Object* pSmartObject = (Evas_Object*) pEflNode->GetGroupContainer();
+       SysTryReturnResult(NID_UI_CTRL, pSmartObject != null, E_SYSTEM, "Failed to get Group Container of Renderer VisualElement.");
 
-               pMap = evas_map_new(4);
-               evas_map_util_points_populate_from_object(pMap, __pImageObject);
+       Evas* pEvas = evas_object_evas_get(pSmartObject);
+       SysTryReturnResult(NID_UI_CTRL, pEvas != null, E_SYSTEM, "Failed to get Evas of Renderer VisualElement.");
 
-               evas_object_image_size_get(__pImageObject, &imgWidth, &imgHeight);
-               SysSecureLog(NID_UI_CTRL, "image object size is [%d, %d]", imgWidth, imgHeight);
+       Ecore_Evas* pEcoreEvas = ecore_evas_ecore_evas_get(pEvas);
+       SysTryReturnResult(NID_UI_CTRL, pEcoreEvas != null, E_SYSTEM, "Failed to get Ecore Evas of Renderer VisualElement.");
 
-               switch(__userRotation)
-               {
-               case _ROTATION_0:
-                       if(__lrMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 1, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX, finalY + finalH, 0);
-                       }
-                       else if(__udMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 3, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX, finalY + finalH, 0);
-                       }
-                       else
-                       {
-                               evas_map_point_coord_set(pMap, 0, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX, finalY + finalH, 0);
-                       }
-                       break;
-               case _ROTATION_90:
-                       if(__lrMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 2, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX, finalY + finalH, 0);
-                       }
-                       else if(__udMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 0, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX, finalY + finalH, 0);
-                       }
-                       else
-                       {
-                               evas_map_point_coord_set(pMap, 3, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX, finalY + finalH, 0);
-                       }
-                       break;
-               case _ROTATION_180:
-                       if(__lrMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 3, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX, finalY + finalH, 0);
-                       }
-                       else if(__udMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 1, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX, finalY + finalH, 0);
-                       }
-                       else
-                       {
-                               evas_map_point_coord_set(pMap, 2, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX, finalY + finalH, 0);
-                       }
-                       break;
-               case _ROTATION_270:
-                       if(__lrMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 0, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX, finalY + finalH, 0);
-                       }
-                       else if(__udMirroring)
-                       {
-                               evas_map_point_coord_set(pMap, 2, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 1, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX, finalY + finalH, 0);
-                       }
-                       else
-                       {
-                               evas_map_point_coord_set(pMap, 1, finalX, finalY, 0);
-                               evas_map_point_coord_set(pMap, 2, finalX + finalW, finalY, 0);
-                               evas_map_point_coord_set(pMap, 3, finalX + finalW, finalY + finalH, 0);
-                               evas_map_point_coord_set(pMap, 0, finalX, finalY + finalH, 0);
-                       }
-                       break;
-               default:
-                       SysSecureLog(NID_UI_CTRL, "__userRotation[%d] is invalid", __userRotation);
-                       break;
-               }
+       __pImageObject = evas_object_image_add(pEvas);
+       SysTryReturnResult(NID_UI_CTRL, __pImageObject != null, E_SYSTEM, "Failed to get Renderer Image Object.");
 
-               if(imgWidth > 0 && imgHeight > 0)
-               {
-                       evas_map_point_image_uv_set(pMap, 0, 0, 0);
-                       evas_map_point_image_uv_set(pMap, 1, imgWidth, 0);
-                       evas_map_point_image_uv_set(pMap, 2, imgWidth, imgHeight);
-                       evas_map_point_image_uv_set(pMap, 3, 0, imgHeight);
-               }
+       evas_object_name_set(__pImageObject, "OverlayRenderer");
+       evas_object_image_size_set(__pImageObject, physicalBounds.width, physicalBounds.height);
+       evas_object_image_alpha_set(__pImageObject, false);
+       evas_object_image_filled_set(__pImageObject, EINA_TRUE);
+       evas_object_resize(__pImageObject, physicalBounds.width, physicalBounds.height);
+       evas_object_move(__pImageObject, physicalBounds.x, physicalBounds.y);
+       evas_object_show(__pImageObject);
 
-               evas_object_map_set(__pImageObject, pMap);
-               evas_object_map_enable_set(__pImageObject, EINA_TRUE);
-               evas_map_free(pMap);
+       DisplayContext* pDisplayContext = parentControl.GetRootWindow()->GetDisplayContext();
+       SysTryReturnResult(NID_UI_CTRL, pDisplayContext != null, E_SYSTEM, "[E_SYSTEM] The current value of RootWindow's DisplayContext is null.");
 
-               evas_object_image_filled_set(__pImageObject, EINA_TRUE);
-               evas_object_show(__pImageObject);
-       }
-       else
+       unique_ptr<VisualElementSurface> pRendererSurface(_VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(*pDisplayContext, (Handle)__pImageObject, Dimension(physicalBounds.width, physicalBounds.height)));
+       SysTryReturnResult(NID_UI_CTRL, pRendererSurface != null, E_SYSTEM, "[E_SYSTEM] The current value of RootWindow's DisplayContext is null.");
+
+       r = pRendererVE->SetSurface(pRendererSurface.release());
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       r = pRendererVE->SetFlushNeeded();
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       pRendererVE->SetAnchor(FloatPoint(0.5f, 0.5f));
+       __pRendererVE = pRendererVE.release();
+       __standardRendererBounds = __pRendererVE->GetBounds();
+
+       if (__style == _OVERLAY_AGENT_STYLE_REGION_SW || __style == _OVERLAY_AGENT_STYLE_PANEL_SW)
        {
-               SysSecureLog(NID_UI_CTRL, "not for rotate status operation");
+               evas_object_image_pixels_get_callback_set(__pImageObject, OnEvasImageDamaged,(void*)this);
+       }
 
-               if (!noImage && __aspectRatio && __pRenderImageObject != null)
-               {
-                       Dimension srcDim(__srcDimension.width, __srcDimension.height);
-                       SysSecureLog(NID_UI_CTRL, "src dimension is [%d, %d]", srcDim.width, srcDim.height);
+       return r;
+}
 
-                       float srcRatio = ((float)srcDim.width) / ((float)srcDim.height);
-                       float tmpWidth = (float)resizeRectW;
-                       float tmpHeight = tmpWidth / srcRatio;
+result
+_OverlayAgent::CreatePixmap(const Rectangle& physicalBounds)
+{
+       //Set size of pixmap
+       Dimension pixmapSize(physicalBounds.width, physicalBounds.height);
+       SysTryReturnResult(NID_UI_CTRL, (pixmapSize.width >= GetDstRectMinWidth()) && (pixmapSize.height >= GetDstRectMinHeight()),
+               E_SYSTEM, "input size (%d, %d) is too small to create a pixmap",pixmapSize.width, pixmapSize.height);
 
-                       Rectangle lastDst;
-                       if (resizeRectH < (int)tmpHeight)
-                       {
-                               lastDst.height = resizeRectH;
-                               lastDst.width = (int)((float)lastDst.height * srcRatio);
-                       }
-                       else
-                       {
-                               lastDst.width = resizeRectW;
-                               lastDst.height = (int)((float)lastDst.width / srcRatio);
-                       }
+       // Create pixmap
+       Display *pDisplay = (Display*)ecore_x_display_get();
+       SysTryReturnResult(NID_UI_CTRL, pDisplay != null, E_SYSTEM, "The current value of Display is null");
+
+       __pixmap = XCreatePixmap(pDisplay, DefaultRootWindow(pDisplay), pixmapSize.width, pixmapSize.height, DefaultDepth(pDisplay, DefaultScreen(pDisplay)));
+       SysTryReturnResult(NID_UI_CTRL, __pixmap != 0, E_SYSTEM, "Failed to create a pixmap of Overlay Agent");
 
-                       lastDst.x = resizeRectX + ((resizeRectW - lastDst.width) / 2);
-                       lastDst.y = resizeRectY + ((resizeRectH - lastDst.height) / 2);
+       GC gc = XCreateGC(pDisplay, __pixmap, 0,0);
+       SysTryReturnResult(NID_UI_CTRL, gc > 0, E_SYSTEM, "Failed to create Graphic Contexts");
 
-//                     evas_object_geometry_get(__pImageObject, &orgX, &orgY, &orgW, &orgH);
-//                     SysLog(NID_UI_CTRL, "__pImageObject before [%d, %d, %d, %d]", orgX, orgY, orgW, orgH);
+       //Set initial color
+       XSetForeground(pDisplay, gc, (long unsigned int)(Color(0xff000000).GetRGB32()));
+       XFillRectangle(pDisplay, __pixmap, gc, 0, 0, pixmapSize.width, pixmapSize.height);
+       XSync(pDisplay, 0);
+       XFreeGC(pDisplay, gc);
 
-                       evas_object_resize(__pImageObject, lastDst.width, lastDst.height);
-                       evas_object_move(__pImageObject, lastDst.x, lastDst.y);
+       //Set evas native surface
+       Evas_Native_Surface evasNativeSuface = {0,};
 
-//                     evas_object_geometry_get(__pImageObject, &orgX, &orgY, &orgW, &orgH);
-//                     SysLog(NID_UI_CTRL, "__pImageObject after [%d, %d, %d, %d]", orgX, orgY, orgW, orgH);
+       evasNativeSuface.version = EVAS_NATIVE_SURFACE_VERSION;
+       evasNativeSuface.type = EVAS_NATIVE_SURFACE_X11;
+       evasNativeSuface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
+       evasNativeSuface.data.x11.pixmap = __pixmap;
 
-                       SysSecureLog(NID_UI_CTRL, "Ratio on / lastDst [%d, %d, %d, %d]",lastDst.x, lastDst.y, lastDst.width, lastDst.height);
-               }
-               else
-               {
-                       evas_object_image_size_get(__pImageObject, &imgWidth, &imgHeight);
-                       SysSecureLog(NID_UI_CTRL, "image object size is [%d, %d]", imgWidth, imgHeight);
+       evas_object_lower(__pImageObject);
+       evas_object_image_native_surface_set(__pImageObject, &evasNativeSuface);
 
-                       Evas_Map* pMap = evas_map_new(4);
-                       evas_map_util_points_populate_from_object(pMap, __pImageObject);
+       __pixmapDamageHandle = ecore_x_damage_new(__pixmap, ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES);
+       SysTryCatch(NID_UI_CTRL, __pixmapDamageHandle != 0, , E_SYSTEM, "[E_SYSTEM] Failed to create a damage object");
 
-                       evas_map_point_coord_set(pMap, 0, resizeRectX, resizeRectY, 0);
-                       evas_map_point_coord_set(pMap, 1, resizeRectX+resizeRectW, resizeRectY, 0);
-                       evas_map_point_coord_set(pMap, 2, resizeRectX+resizeRectW, resizeRectY+resizeRectH, 0);
-                       evas_map_point_coord_set(pMap, 3, resizeRectX, resizeRectY+resizeRectH, 0);
+       __pPixmapEventHandler = ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY, OnPixmapDamaged, (void*)this);
+       SysTryCatch(NID_UI_CTRL, __pPixmapEventHandler != null, , E_SYSTEM, "[E_SYSTEM] Failed to add a pixmap damage event handle");
 
-                       if(imgWidth > 0 && imgHeight > 0)
-                       {
-                               evas_map_point_image_uv_set(pMap, 0, 0, 0);
-                               evas_map_point_image_uv_set(pMap, 1, imgWidth, 0);
-                               evas_map_point_image_uv_set(pMap, 2, imgWidth, imgHeight);
-                               evas_map_point_image_uv_set(pMap, 3, 0, imgHeight);
-                       }
+       return E_SUCCESS;
 
-                       evas_object_map_set(__pImageObject, pMap);
-                       evas_object_map_enable_set(__pImageObject, EINA_TRUE);
-                       evas_map_free(pMap);
-               }
+CATCH:
+       if (__pPixmapEventHandler)
+       {
+               ecore_event_handler_del(__pPixmapEventHandler);
+               __pPixmapEventHandler = null;
+       }
+
+       if (__pixmapDamageHandle)
+       {
+               ecore_x_damage_free(__pixmapDamageHandle);
+               __pixmapDamageHandle = 0;
+       }
 
-               evas_object_image_filled_set(__pImageObject, EINA_TRUE);
-               evas_object_show(__pImageObject);
+       if (__pixmap)
+       {
+               XFreePixmap((Display*)ecore_x_display_get(), __pixmap);
+               __pixmap = 0;
        }
 
-       __pVisualElement->SetFlushNeeded();
+       return E_SYSTEM;
+}
 
-       return E_SUCCESS;
+Pixmap
+_OverlayAgent::GetPixmap(void) const
+{
+       return __pixmap;
+}
+
+Evas_Object*
+_OverlayAgent::GetRendererImageObject(void) const
+{
+       return __pImageObject;
+}
+
+bool
+_OverlayAgent::IsValidDestinationDimension(const FloatDimension& dimension) const
+{
+       FloatDimension physicalDimensionF = _CoordinateSystemUtils::Transform(dimension);
+       Dimension physicalDimension = _CoordinateSystemUtils::ConvertToInteger(physicalDimensionF);
+       SysTryReturn(NID_UI_CTRL, (physicalDimension.width >= GetDstRectMinWidth() && physicalDimension.height >= GetDstRectMinHeight()), false, E_INVALID_ARG,
+                       "[E_INVALID_ARG] The size of input dimension (logical size : [%.3f, %.3f], physical size : [%d,%d]) is under minimun size."
+                       ,dimension.width, dimension.height, physicalDimension.width, physicalDimension.height);
+
+       FloatRectangle parentBounds = __pParentVE->GetBounds();
+       SysTryReturn(NID_UI_CTRL, (dimension.width <= parentBounds.width || dimension.height <= parentBounds.height), false, E_INVALID_ARG,
+                       "[E_INVALID_ARG] The size of input dimension[%.3f, %.3f] is over maximum size[%.3f,%.3f]."
+                       ,dimension.width, dimension.height, parentBounds.width, parentBounds.height);
+
+       return true;
 }
 
 int
 _OverlayAgent::GetOverlayAgentCount(void)
 {
-       return __overlayAgentcount;
+       return __overlayAgentCount;
 }
 
 IListT<bool>*
@@ -1585,16 +1122,33 @@ _OverlayAgent::GetPixelFormatListN(void)
 }
 
 result
-_OverlayAgent::EvaluateBounds(OverlayAgentEvaluationOption option, Rectangle& rect, bool& modified)
+_OverlayAgent::EvaluateBounds(OverlayAgentEvaluationOption option, FloatRectangle& rect, bool& modified)
 {
        modified = false;
-       SysTryReturnResult(NID_UI_CTRL, rect.width > 0 && rect.height > 0, E_INVALID_ARG, "[E_INVALID_ARG] The size of input rectangle(%d, %d) is invalid.", rect.width, rect.height);
+       SysTryReturnResult(NID_UI_CTRL, rect.width > 0.0f && rect.height > 0.0f,
+               E_INVALID_ARG, "The size of input rectangle(%.3f, %.3f) is invalid.", rect.width, rect.height);
+
+       Rectangle logicalEvaluatingBounds = _CoordinateSystemUtils::ConvertToInteger(rect);
+       SysTryReturnResult(NID_UI_CTRL, logicalEvaluatingBounds.width > 0 && logicalEvaluatingBounds.height > 0,
+               E_INVALID_ARG, "The size of logical rectangle(%d, %d) is invalid.", logicalEvaluatingBounds.width, logicalEvaluatingBounds.height);
+
+       Rectangle physicalRect(_CoordinateSystemUtils::Transform(logicalEvaluatingBounds));
+       SysTryReturnResult(NID_UI_CTRL, physicalRect.width > 0 && physicalRect.height > 0,
+               E_INVALID_ARG, "The size of physical rectangle(%d, %d) is invalid.", physicalRect.width, physicalRect.height);
+
+       int physicalMinWidth = GetDstRectMinWidth();
+       int physicalMinHeight = GetDstRectMinHeight();
+       SysTryReturnResult(NID_UI_CTRL, physicalMinWidth > 0 && physicalMinHeight > 0, E_SYSTEM, "The value of overlay control's Min width and Min height are invalid.");
+
+       const int widthUnit = GetWidthUnit();
+       const int heightUnit = GetHeightUnit();
+       SysTryReturnResult(NID_UI_CTRL, widthUnit > 0 && heightUnit > 0, E_SYSTEM, "The value of overlay control's width Unit and height Unit are invalid.");
 
        int screenWidth = _Screen::GetWidth();
        int screenHeight = _Screen::GetHeight();
-       SysTryReturnResult(NID_UI_CTRL, screenWidth > 0 && screenHeight > 0, E_INVALID_ARG, "[E_SYSTEM] The value of screen size is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, screenWidth > 0 && screenHeight > 0, E_SYSTEM, "The value of screen size is invalid.");
 
-       // if orientation status of screen is landscape mode, swap width and height.
+       //If orientation status of screen is landscape mode, swap width and height.
        {
                _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
                int orientation = ecore_evas_rotation_get(pEcoreEvas->GetEcoreEvas());
@@ -1607,41 +1161,41 @@ _OverlayAgent::EvaluateBounds(OverlayAgentEvaluationOption option, Rectangle& re
                        SysSecureLog(NID_UI_CTRL, "The current value of device screen width is %d, device screen height is %d and orientation is %d", screenWidth, screenHeight, orientation);
                }
        }
-       const int widthUnit = GetWidthUnit();
-       const int heightUnit = GetHeightUnit();
-       SysTryReturnResult(NID_UI_CTRL, widthUnit > 0 && heightUnit > 0, E_SYSTEM, "[E_SYSTEM] The value of overlay control's width Unit and height Unit are invalid.");
 
        int physicalMaxWidth= screenWidth - (screenWidth % widthUnit);
        int physicalMaxHeight = screenHeight - (screenHeight % heightUnit);
        int logicalMaxWidth = _CoordinateSystemUtils::InverseHorizontalTransform(physicalMaxWidth);
        int logicalMaxHeight = _CoordinateSystemUtils::InverseVerticalTransform(physicalMaxHeight);
-       SysSecureLog(NID_UI_CTRL, "The physical Max size of overlay control is (%d, %d) and logical Max size of overlay control is (%d, %d)", physicalMaxWidth, physicalMaxHeight, logicalMaxWidth, logicalMaxHeight);
-
-       int dstMinWidth = GetDstRectMinWidth();
-       int dstMinHeight = GetDstRectMinHeight();
-       SysTryReturnResult(NID_UI_CTRL, dstMinWidth > 0 && dstMinHeight > 0, E_SYSTEM, "[E_SYSTEM] The value of overlay control's Min width and Min height are invalid.");
 
-       Rectangle physicalRect(_CoordinateSystemUtils::Transform(rect));
        int widthReminder = physicalRect.width % widthUnit;
        int heightReminder = physicalRect.height % heightUnit;
 
+       //Fix one pixel error when coordinate system transform
+       if (widthReminder == 1)
+       {
+               physicalRect.width -= 1;
+               widthReminder = physicalRect.width % widthUnit;
+       }
+
+       if (heightReminder == 1)
+       {
+               physicalRect.height -= 1;
+               heightReminder = physicalRect.height % heightUnit;
+       }
+
        switch (option)
        {
        case OVERLAY_AGENT_EVALUATION_OPTION_GREATER_THAN:
                {
-                       if (physicalRect.width > physicalMaxWidth || physicalRect.height > physicalMaxHeight)
+                       if (logicalEvaluatingBounds.width > logicalMaxWidth || logicalEvaluatingBounds.height > logicalMaxHeight)
                        {
-                               modified = false;
-                               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_OPTION, "[E_UNSUPPORTED_OPTION] The size of input rect exceeds physical maximun size.");
-
+                               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_OPTION, "[E_UNSUPPORTED_OPTION] The size of input rect exceeds logical maximun size.");
                                return E_UNSUPPORTED_OPTION;
                        }
 
-                       if (rect.width > logicalMaxWidth || rect.height > logicalMaxHeight)
+                       if (physicalRect.width > physicalMaxWidth || physicalRect.height > physicalMaxHeight)
                        {
-                               modified = false;
-                               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_OPTION, "[E_UNSUPPORTED_OPTION] The size of input rect exceeds logical maximun size.");
-
+                               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_OPTION, "[E_UNSUPPORTED_OPTION] The size of input rect exceeds physical maximun size.");
                                return E_UNSUPPORTED_OPTION;
                        }
 
@@ -1658,22 +1212,21 @@ _OverlayAgent::EvaluateBounds(OverlayAgentEvaluationOption option, Rectangle& re
                        physicalRect.width -= widthReminder;
                        physicalRect.height -= heightReminder;
 
-                       if (physicalRect.width < dstMinWidth)
+                       if (physicalRect.width < physicalMinWidth)
                        {
-                               physicalRect.width = dstMinWidth;
+                               physicalRect.width = physicalMinWidth;
                        }
 
-                       if (physicalRect.height < dstMinHeight)
+                       if (physicalRect.height < physicalMinHeight)
                        {
-                               physicalRect.height = dstMinHeight;
+                               physicalRect.height = physicalMinHeight;
                        }
                }
                break;
        case OVERLAY_AGENT_EVALUATION_OPTION_LESS_THAN:
                {
-                       if (physicalRect.width < dstMinWidth || physicalRect.height < dstMinHeight)
+                       if (physicalRect.width < physicalMinWidth || physicalRect.height < physicalMinHeight)
                        {
-                               modified = false;
                                SysLogException(NID_UI_CTRL, E_UNSUPPORTED_OPTION, "[E_UNSUPPORTED_OPTION] The size of input rect is under minimun size.");
 
                                return E_UNSUPPORTED_OPTION;
@@ -1695,28 +1248,30 @@ _OverlayAgent::EvaluateBounds(OverlayAgentEvaluationOption option, Rectangle& re
                break;
        default:
                {
-                       modified = false;
                        SysLogException(NID_UI_CTRL, E_UNSUPPORTED_OPTION, "[E_UNSUPPORTED_OPTION] The input option is an invalid.");
 
                        return E_UNSUPPORTED_OPTION;
                }
        }
 
-       Rectangle originalInputRect(rect);
-       rect = _CoordinateSystemUtils::InverseTransform(physicalRect);
+       FloatRectangle originalInputRect(rect);
+       rect = _CoordinateSystemUtils::ConvertToFloat(_CoordinateSystemUtils::InverseTransform(physicalRect));
 
        if (rect != originalInputRect)
        {
-               SysSecureLog(NID_UI_CTRL, "The rect as a input parameter is adjusted. original rect(%d, %d, %d, %d) is changed to (%d, %d, %d, %d)",
+               modified = true;
+               SysLog(NID_UI_CTRL, "The input bounds [%.3f, %.3f, %.3f, %.3f] is modified to [%.3f, %.3f, %.3f, %.3f]",
                                originalInputRect.x, originalInputRect.y, originalInputRect.width, originalInputRect.height,
                                rect.x, rect.y, rect.width, rect.height);
-               modified = true;
        }
-
-       SysLog(NID_UI_CTRL, "The current size of valid bounds that is evaluated is (%d, %d, %d, %d)", rect.x, rect.y, rect.width, rect.height);
+       else
+       {
+               SysLog(NID_UI_CTRL, "The evaluated bounds [%.3f, %.3f, %.3f, %.3f] is valid.",
+                       rect.x, rect.y, rect.width, rect.height);
+       }
 
        result r = GetLastResult();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        return r;
 }
@@ -1751,6 +1306,7 @@ _OverlayAgent::GetDstRectMinWidth(void)
                SysTryReturn(NID_UI_CTRL, value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __dstRectMinWidth = value;
+               SysLog(NID_UI_CTRL, "The overlay control's minimum width of destination is [%d]", __dstRectMinWidth);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1767,6 +1323,7 @@ _OverlayAgent::GetDstRectMinHeight(void)
                SysTryReturn(NID_UI_CTRL, value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __dstRectMinHegith = value;
+               SysLog(NID_UI_CTRL, "The overlay control's minimum height of destination is [%d]", __dstRectMinHegith);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1783,6 +1340,7 @@ _OverlayAgent::GetSrcRectMinWidth(void)
                SysTryReturn(NID_UI_CTRL,  value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __srcRectMinWidth = value;
+               SysLog(NID_UI_CTRL, "The overlay control's minimum width of source buffer is [%d]", __srcRectMinWidth);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1799,6 +1357,7 @@ _OverlayAgent::GetSrcRectMinHeight(void)
                SysTryReturn(NID_UI_CTRL,  value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __srcRectMinHegith = value;
+               SysLog(NID_UI_CTRL, "The overlay control's minimum height of source buffer is [%d]", __srcRectMinHegith);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1815,6 +1374,7 @@ _OverlayAgent::GetWidthUnit(void)
                SysTryReturn(NID_UI_CTRL,  value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __overlayWidthUnit = value;
+               SysLog(NID_UI_CTRL, "The overlay control's unit width is [%d]", __overlayWidthUnit);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1831,6 +1391,7 @@ _OverlayAgent::GetHeightUnit(void)
                SysTryReturn(NID_UI_CTRL,  value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __overlayHeightUnit = value;
+               SysLog(NID_UI_CTRL, "The overlay control's unit height is [%d]", __overlayHeightUnit);
        }
 
        SetLastResult(E_SUCCESS);
@@ -1847,66 +1408,12 @@ _OverlayAgent::GetMaxCount(void)
                SysTryReturn(NID_UI_CTRL,  value > 0, -1, E_SYSTEM, "[E_SYSTEM] Failed to get Overlay info from registry");
 
                __overlayMaxCount = value;
+               SysLog(NID_UI_CTRL, "The overlay control's maximum count is [%d]", __overlayMaxCount);
        }
 
        SetLastResult(E_SUCCESS);
 
        return __overlayMaxCount;
 }
-
-void
-_OverlayAgent::SetEvasImageDirtyCallback(void)
-{
-       if (__pImageObject)
-       {
-               evas_object_image_pixels_get_callback_set(__pImageObject, OnEvasImageDamaged,(void*)this);
-       }
-}
-
-bool
-_OverlayAgent::GetEvasImageDirtyFlag(void) const
-{
-       return __evasImageDamaged;
-}
-
-void
-_OverlayAgent::SetEvasImageDirtyFlag(bool dirty)
-{
-       __evasImageDamaged = dirty;
-}
-
-result
-_OverlayAgent::MoveChildToTop(const _Control& child)
-{
-       _EflNode* pEflNode = null;
-       Evas_Object* pSmartObject = null;
-
-       _VisualElement* pChildVE = child.GetVisualElement();
-       SysTryReturn(NID_UI_CTRL, pChildVE != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] pChildVE is null.");
-
-       pEflNode = dynamic_cast<_EflNode*>(pChildVE->GetNativeNode());
-       SysTryReturn(NID_UI_CTRL, pEflNode != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pEflNode is null" );
-
-       pSmartObject = (Evas_Object*)pEflNode->GetGroupContainer();
-       SysTryReturn(NID_UI_CTRL, pSmartObject != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] pSmartObject is null" );
-
-       evas_object_raise(pSmartObject);
-
-       return E_SUCCESS;
-}
-
-Dimension
-_OverlayAgent::GetPrevCbImageDimension(void) const
-{
-       return __orgCbImgDimension;
-}
-
-result
-_OverlayAgent::SetPrevCbImageDimension(const Dimension& imgDim)
-{
-       __orgCbImgDimension = imgDim;
-       return E_SUCCESS;
-}
-
 }}} // Tizen::Ui
 
index 8cd8eab..0d5d814 100644 (file)
 #include <Elementary.h>
 
 #include <FBaseString.h>
+#include <FGrpCoordinateSystem.h>
 #include <FGrpCanvas.h>
 #include <FGrpFloatRectangle.h>
-
+#include "FUi_EcoreEvasMgr.h"
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUiCtrl_OverlayPanel.h"
 #include "FUiCtrl_OverlayAgent.h"
@@ -37,6 +38,7 @@
 using namespace Tizen::Base;
 using namespace Tizen::Graphics;
 using namespace Tizen::Ui;
+using namespace Tizen::Ui::Animations;
 using namespace Tizen::Ui::Controls;
 
 namespace Tizen { namespace Ui { namespace Controls
@@ -75,8 +77,8 @@ _OverlayPanel::~_OverlayPanel(void)
 result
 _OverlayPanel::SetInputBuffer(const FloatDimension& destDim, const ByteBuffer& srcBuffer, const Dimension& srcDim, OverlayPanel::BufferPixelFormat srcFormat)
 {
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] OverlayAgent must not be null.");
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent->IsValidDestinationDimension(destDim), E_INVALID_ARG, "[E_INVALID_ARG] A specified input paramete is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "OverlayAgent must not be null.");
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent->IsValidDestinationDimension(destDim), E_INVALID_ARG, "A specified input paramete is invalid.");
 
        _OverlayAgentBufferPixelFormat format = _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_ARGB8888;
        switch (srcFormat)
@@ -110,7 +112,7 @@ _OverlayPanel::SetInputBuffer(const FloatDimension& destDim, const ByteBuffer& s
 result
 _OverlayPanel::SetRendererRotation(OverlayPanel::Rotation rotation)
 {
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] OverlayAgent must not be null.");
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "OverlayAgent must not be null.");
 
        return __pOverlayAgent->SetRotation((_OverlayAgentRotation)rotation);
 }
@@ -126,11 +128,11 @@ _OverlayPanel::SetRendererAspectRatio(bool aspectRatio)
 result
 _OverlayPanel::SetRenderSize(const FloatDimension& dimension)
 {
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_INVALID_OPERATION, "[E_INVALID_OPERATION] OverlayAgent must not be null.");
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent->IsValidDestinationDimension(dimension), E_INVALID_ARG, "[E_INVALID_ARG] A specified input parameter is invalid.");
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_INVALID_OPERATION, "OverlayAgent must not be null.");
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent->IsValidDestinationDimension(dimension), E_INVALID_ARG, "A specified input parameter is invalid.");
 
        result r =__pOverlayAgent->SetDestination(dimension);
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_INVALID_OPERATION, "[E_INVALID_OPERATION] The current state of the instance prohibits the execution of the specified.");
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_INVALID_OPERATION, "The current state of the instance prohibits the execution of the specified.");
 
        return r;
 }
@@ -138,7 +140,7 @@ _OverlayPanel::SetRenderSize(const FloatDimension& dimension)
 result
 _OverlayPanel::GetBackgroundBufferInfo(BufferInfo& info) const
 {
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] OverlayAgent must not be null.");
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "OverlayAgent must not be null.");
 
        return __pOverlayAgent->GetBufferInfo(info);
 }
@@ -149,130 +151,114 @@ _OverlayPanel::GetMaskingColor(void) const
        return Color(0x00000000);
 }
 
-void
-_OverlayPanel::OnDraw(void)
-{
-       SysTryReturnVoidResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] OverlayAgent must not be null.");
-       __pOverlayAgent->AdjustImageObject();
-}
-
-void
-_OverlayPanel::OnVisibleStateChanged(void)
-{
-       if (IsVisible())
-       {
-               SysLog(NID_UI_CTRL, "Visible state is set to TRUE");
-       }
-       else
-       {
-               SysLog(NID_UI_CTRL, " Visible state is set to FALSE");
-       }
-}
-
 result
 _OverlayPanel::OnAttachedToMainTree(void)
 {
        int maxCount = OverlayRegion::GetMaxCount();
-       SysTryReturnResult(NID_UI_CTRL, maxCount > 0, E_SYSTEM, "[E_SYSTEM] The current value of maxCount(%d) is in an invalid state.", maxCount);
-
+       SysTryReturnResult(NID_UI_CTRL, maxCount > 0, E_SYSTEM, "The current value of OverlayAgent max count[%d] is invalid.", maxCount);
+       SysTryReturnResult(NID_UI_CTRL, _OverlayAgent::GetOverlayAgentCount() <= maxCount, E_SYSTEM, "OverlayAgent already exceeds the maximum limit.");
 
-       // 1. check for overlayAgent maximum count
-       SysTryReturnResult(NID_UI_CTRL, _OverlayAgent::GetOverlayAgentCount() < maxCount, E_SYSTEM, "[E_SYSTEM] OverlayAgent already exceeds the maximum limit.");
-
-       _Control* pParent = GetParent();
-       SysTryReturnResult(NID_UI_CTRL, pParent != null, E_SYSTEM, "[E_SYSTEM] The parent(_Control) must not be null.");
-
-       _ControlImpl* pControlImpl = static_cast<_ControlImpl*>(pParent->GetUserData());
-       SysTryReturnResult(NID_UI_CTRL, pControlImpl != null, E_SYSTEM, "[E_SYSTEM] The impl of parent (_ControlImpl) must not be null.");
-
-       _FormImpl* pFormImpl = dynamic_cast<_FormImpl*>(pControlImpl);
-       SysTryReturnResult(NID_UI_CTRL, pFormImpl != null, E_SYSTEM, "[E_SYSTEM] The form impl (_FormImpl) must not be null.");
+       // Check Parent container's status
+       {
+               _Control* pParent = GetParent();
+               SysTryReturnResult(NID_UI_CTRL, pParent != null, E_SYSTEM, "The parent container must not be null.");
 
+               _ControlImpl* pControlImpl = static_cast<_ControlImpl*>(pParent->GetUserData());
+               SysTryReturnResult(NID_UI_CTRL, pControlImpl != null, E_SYSTEM, "The impl of parent must not be null.");
 
-       // 2. check for using OverlayRegion simutaneously in the same form
-       _Form& form = pFormImpl->GetCore();
-       SysTryReturnResult(NID_UI_CTRL, form.GetOverlayRegionCount() == 0, E_SYSTEM, "[E_SYSTEM] Using OverlayPanel mixed with OverlayRegion is unsupported.");
+               _FormImpl* pFormImpl = dynamic_cast<_FormImpl*>(pControlImpl);
+               SysTryReturnResult(NID_UI_CTRL, pFormImpl != null, E_SYSTEM, "The impl of form must not be null.");
 
+               // check for using OverlayRegion simutaneously in the same form
+               _Form& form = pFormImpl->GetCore();
+               SysTryReturnResult(NID_UI_CTRL, form.GetOverlayRegionCount() == 0, E_SYSTEM, "Using OverlayPanel mixed with OverlayRegion is unsupported.");
 
-       // 3. check for overlayPanel maximum count
-       int panelCount = 0;
-       _OverlayPanel* pOverlayPanel = null;
+               // check for overlayPanel maximum count
+               int panelCount = 0;
+               _OverlayPanel* pOverlayPanel = null;
 
-       for (int idx = 0 ; idx < form.GetChildCount(); idx++)
-       {
-               pOverlayPanel = dynamic_cast <_OverlayPanel*>(form.GetChild(idx));
-               if(pOverlayPanel != null)
+               for (int idx = 0 ; idx < form.GetChildCount(); idx++)
                {
-                       panelCount++;
-                       pOverlayPanel = null;
+                       pOverlayPanel = dynamic_cast <_OverlayPanel*>(form.GetChild(idx));
+                       if(pOverlayPanel != null)
+                       {
+                               panelCount++;
+                               pOverlayPanel = null;
+                       }
                }
+               SysTryReturn(NID_UI_CTRL, panelCount <= maxCount, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] OverlayPanel already exceeds the maximum limit.");
        }
-       SysTryReturn(NID_UI_CTRL, panelCount <= maxCount, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] OverlayPanel already exceeds the maximum limit.");
-
 
-       // 4. make OverlayPanel object
-       FloatRectangle clientRectF = pParent->GetClientBoundsF();
-       FloatRectangle generalRectF = GetBoundsF();
-       FloatRectangle overlayRectF(clientRectF.x + generalRectF.x, clientRectF.y + generalRectF.y, generalRectF.width, generalRectF.height);
-       SysLog(NID_UI_CTRL,"The current value of logical overlayRect is [%.3f, %.3f, %.3f, %.3f]", overlayRectF.x, overlayRectF.y, overlayRectF.width, overlayRectF.height);
 
+       // Get Bounds of Logical and Physical OverlayPanel
+       result r = E_SUCCESS;
+       FloatRectangle logicalBoundsF(0.0f, 0.0f, 0.0f, 0.0f);
+       Rectangle physicalBounds(0, 0, 0, 0);
+       {
+               FloatRectangle parentBoundsF = GetParent()->GetClientBoundsF();
+               FloatRectangle ovelrayBoundsF = GetBoundsF();
+               logicalBoundsF = FloatRectangle(parentBoundsF.x + ovelrayBoundsF.x, parentBoundsF.y + ovelrayBoundsF.y, ovelrayBoundsF.width, ovelrayBoundsF.height);
 
-       // 5. Adjust
-       bool modified = false;
-       Rectangle overlayRect = _CoordinateSystemUtils::ConvertToInteger(overlayRectF);
-       result r = _OverlayAgent::EvaluateBounds(OVERLAY_AGENT_EVALUATION_OPTION_LESS_THAN, overlayRect, modified);
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] _OverlayAgent::EvaluateBounds() failed");
+               bool modified = false;
+               r = _OverlayAgent::EvaluateBounds(OVERLAY_AGENT_EVALUATION_OPTION_LESS_THAN, logicalBoundsF, modified);
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
 
-       overlayRectF = _CoordinateSystemUtils::ConvertToFloat(overlayRect);
-       FloatRectangle devBoundsF = _CoordinateSystemUtils::Transform(overlayRectF);
-       Rectangle devBounds = _CoordinateSystemUtils::ConvertToInteger(devBoundsF);
+               FloatRectangle physicalBoundsF = _CoordinateSystemUtils::Transform(CoordinateSystem::AlignToDevice(logicalBoundsF));
+               physicalBounds = _CoordinateSystemUtils::ConvertToInteger(physicalBoundsF);
+       }
 
-       SysLog(NID_UI_CTRL, "The current value of physical overlayRect is [%d,%d,%d,%d]", devBounds.x, devBounds.y, devBounds.width, devBounds.height);
 
-       // 6. create OverlayAgent Instance
-       _OverlayAgentStyle overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_SW;
-       String preferredEngineConfig(elm_config_preferred_engine_get());
-       if(preferredEngineConfig.Equals("opengl_x11", true))
-       {
-               overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_GL;
-               SysLog(NID_UI_CTRL, "xml : HwAcceleration was set to On");
-       }
-       else if(preferredEngineConfig.Equals("software_x11", true))
+       // Get style of OverlayPanel
+       _OverlayAgentStyle overlayAgentType = _OVERLAY_AGENT_STYLE_NONE;
        {
-               overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_SW;
-               SysLog(NID_UI_CTRL, "xml : HwAcceleration was set to Off");
-       }
-       else
-       {
-               String engineConfig(elm_config_engine_get());
-               if(engineConfig.Equals("opengl_x11", true))
+               String preferredEngineConfig(elm_config_preferred_engine_get());
+               if(preferredEngineConfig.Equals("opengl_x11", true))
                {
                        overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_GL;
-                       SysLog(NID_UI_CTRL,"Dev setting option is gl backend");
+                       SysLog(NID_UI_CTRL, "The current value of HwAcceleration is On");
+               }
+               else if(preferredEngineConfig.Equals("software_x11", true))
+               {
+                       overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_SW;
+                       SysLog(NID_UI_CTRL, "The current value of HwAcceleration is Off");
+               }
+               else
+               {
+                       String engineConfig(elm_config_engine_get());
+                       if(engineConfig.Equals("opengl_x11", true))
+                       {
+                               overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_GL;
+                               SysLog(NID_UI_CTRL,"The current value of HwAcceleration is On (System Default)");
+                       }
+                       else
+                       {
+                               overlayAgentType = _OVERLAY_AGENT_STYLE_PANEL_SW;
+                               SysLog(NID_UI_CTRL,"The current value of HwAcceleration is Off (System Default)");
+                       }
                }
        }
 
-       __pOverlayAgent = _OverlayAgent::CreateInstanceN(overlayAgentType, *this, overlayRectF, devBounds);
+
+       // Create Overlay Agent
+       __pOverlayAgent = _OverlayAgent::CreateInstanceN(overlayAgentType, *this, logicalBoundsF, physicalBounds);
        r = GetLastResult();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS && __pOverlayAgent != null, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS && __pOverlayAgent != null, r, "Propagating.");
 
        if (overlayAgentType == _OVERLAY_AGENT_STYLE_PANEL_GL)
        {
-               r = __pOverlayAgent->CreatePixmap();
-               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               r = __pOverlayAgent->CreatePixmap(physicalBounds);
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
        }
        else
        {
-               SysLog(NID_UI_CTRL,"The current type of OverlayAgent is _OVERLAY_AGENT_STYLE_PANEL_SW, and it don't need to make a pixmap");
-
-               int size = (devBounds.width * 2) * (devBounds.height * 2);
+               int size = (physicalBounds.width * 2) * (physicalBounds.height * 2);
                std::unique_ptr<byte[]> pBuf(new (std::nothrow) byte[size]);
-               SysTryReturnResult(NID_UI_CTRL, pBuf != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Buffer must not be null.");
+               SysTryReturnResult(NID_UI_CTRL, pBuf != null, E_OUT_OF_MEMORY, "Buffer for OverlayPanel must not be null.");
 
                unsigned long* pPos = (unsigned long*)pBuf.get();
-               for(int i = 0; i < devBounds.height; i++)
+               for(int i = 0; i < physicalBounds.height; i++)
                {
-                       for(int j = 0; j < devBounds.width; j++)
+                       for(int j = 0; j < physicalBounds.width; j++)
                        {
                                *pPos = 0xFF000000;
                                pPos++;
@@ -281,28 +267,21 @@ _OverlayPanel::OnAttachedToMainTree(void)
 
                ByteBuffer buffer;
                r = buffer.Construct(size);
-               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
                buffer.SetArray(pBuf.get(), 0, size);
-               FloatDimension dimF(overlayRectF.width, overlayRectF.height);
-               r = SetInputBuffer(dimF, buffer, Dimension(devBounds.width, devBounds.height), OverlayPanel::BUFFER_PIXEL_FORMAT_ARGB8888);
-               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pOverlayAgent->SetEvasImageDirtyCallback();
+               FloatDimension dimF(logicalBoundsF.width, logicalBoundsF.height);
+               r = SetInputBuffer(dimF, buffer, Dimension(physicalBounds.width, physicalBounds.height), OverlayPanel::BUFFER_PIXEL_FORMAT_ARGB8888);
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
        }
 
-       // raise up childs
-       _Control* pChild = null;
-       for (int idx = 0 ; idx < GetChildCount(); idx++)
-       {
-               pChild = dynamic_cast <_Control*>(GetChild(idx));
-               if(pChild != null)
-               {
-                       __pOverlayAgent->MoveChildToTop(*pChild);
-               }
-       }
+       r = GetVisualElement()->SetRenderOperation(_VisualElement::RENDER_OPERATION_BLEND);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       return E_SUCCESS;
+       r = GetVisualElement()->SetBackgroundColor(_Colorf(1.0f, 1.0f, 1.0f, 0.0f));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       return r;
 }
 
 void
@@ -312,27 +291,25 @@ _OverlayPanel::OnBoundsChanged(void)
 
        if (__pOverlayAgent == null)
        {
+               SysSecureLog(NID_UI_CTRL, "The OverlayPanel is not yet attached to main tree.");
                return;
        }
-}
-
-void
-_OverlayPanel::OnChildDetached(const _Control& child)
-{
 
-}
-
-void
-_OverlayPanel::OnChildAttached(const _Control& child)
-{
-       ClearLastResult();
+       float width = __pOverlayAgent->GetBounds().width;
+       if (GetBoundsF().width < width)
+       {
+               width = GetBoundsF().width;
+       }
 
-       if (__pOverlayAgent == null)
+       float height = __pOverlayAgent->GetBounds().height;
+       if (GetBoundsF().height < height)
        {
-               return;
+               height = GetBoundsF().height;
        }
+       SysLog(NID_UI_CTRL, "The changed size of OverlayPanel's renderer is [%.3f, %.3f]", width, height);
 
-       __pOverlayAgent->MoveChildToTop(child);
-}
+       result r = __pOverlayAgent->SetDestination(FloatDimension(width, height));
+       SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
 
+}
 }}} // Tizen::Ui::Controls
index 839ffe5..e687b2c 100644 (file)
@@ -65,14 +65,12 @@ _OverlayPanelImpl::OverlayPanelSizeInfo::GetDefaultMaximumSize(_ControlOrientati
 {
        Dimension overlayPanelMaxSize = CoordinateSystem::GetLogicalResolution();
 
-       if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
-       {
-               return overlayPanelMaxSize;
-       }
-       else
+       if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
        {
                return Dimension(overlayPanelMaxSize.height, overlayPanelMaxSize.width);
        }
+
+       return overlayPanelMaxSize;
 }
 
 _OverlayPanelImpl*
@@ -148,9 +146,7 @@ result
 _OverlayPanelImpl::SetInputBuffer(const Dimension& destDim, const ByteBuffer& srcBuffer, const Dimension& srcDim, OverlayPanel::BufferPixelFormat srcFormat)
 {
        FloatDimension destFloatDim = _CoordinateSystemUtils::ConvertToFloat(destDim);
-       result r = SetInputBuffer(destFloatDim, srcBuffer, srcDim, srcFormat);
-
-       return r;
+       return SetInputBuffer(destFloatDim, srcBuffer, srcDim, srcFormat);
 }
 
 result
@@ -164,13 +160,13 @@ _OverlayPanelImpl::SetInputBuffer(const FloatDimension& destDim, const ByteBuffe
 
        if (!__overlayPanelPixelFomatList[srcFormat])
        {
-               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The Source format(%d) is unsupported.", srcFormat);
+               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The Source format[%d] is unsupported.", srcFormat);
                return E_UNSUPPORTED_FORMAT;
        }
 
        result r = GetCore().SetInputBuffer(destDim, srcBuffer, srcDim, srcFormat);
 
-       if ((r == E_INVALID_ARG) || (r == E_UNSUPPORTED_FORMAT) || (r == E_SYSTEM))
+       if (r == E_INVALID_ARG || r == E_UNSUPPORTED_FORMAT || r == E_SYSTEM)
        {
                SysLogException(NID_UI_CTRL, r, "[%s] Propagating.", GetErrorMessage(r));
        }
@@ -324,7 +320,7 @@ _OverlayPanelImpl::GetSupportedBufferPixelFormatListN(void)
 }
 
 result
-_OverlayPanelImpl::EvaluateBounds(OverlayPanelEvaluationOption option, Rectangle& rect, bool& modified)
+_OverlayPanelImpl::EvaluateBounds(OverlayPanelEvaluationOption option, FloatRectangle& rect, bool& modified)
 {
        switch (option)
        {
@@ -335,7 +331,7 @@ _OverlayPanelImpl::EvaluateBounds(OverlayPanelEvaluationOption option, Rectangle
                return _OverlayAgent::EvaluateBounds(OVERLAY_AGENT_EVALUATION_OPTION_LESS_THAN, rect, modified);
 
        default:
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] ...");
+               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument is used. The OverlayPanelEvaluationOption is invalid.");
                return E_INVALID_ARG;
        }
 }
@@ -382,8 +378,10 @@ public:
 
        static _UiBuilderControlMaker* GetInstance(_UiBuilder* uibuilder)
        {
-               _OverlayPanelMaker* _pOverlayPanelMaker = new (std::nothrow) _OverlayPanelMaker(uibuilder);
-               return _pOverlayPanelMaker;
+               _OverlayPanelMaker* pOverlayPanelMaker = new (std::nothrow) _OverlayPanelMaker(uibuilder);
+               SysTryReturn(NID_UI_CTRL, pOverlayPanelMaker != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+               return pOverlayPanelMaker;
        };
 
 protected:
@@ -424,4 +422,3 @@ _OverlayPanelRegister::~_OverlayPanelRegister()
 }
 static _OverlayPanelRegister OverlayPanelRegisterToUIbuilder;
 }}} // Tizen::Ui::Controls
-
index 38af41e..e4a7f65 100644 (file)
 
 #include <new>
 #include <unique_ptr.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
 #include <Ecore_Evas.h>
 #include <Elementary.h>
-
 #include <FSysSystemInfo.h>
 #include <FIoFile.h>
 #include <FBaseInteger.h>
@@ -51,159 +48,73 @@ using namespace Tizen::System;
 using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 
-namespace
-{
-       const int _ROTATION_COUNT = 4;
-
-       const char* _MEDIA_CAPABILITY_FILE_PATH = "/usr/etc/media-capability.xml";
-       const char* _CAM_PRIMARY_DIRECTION = "Camera.Primary.Direction";
-       const char* _CAM_PRIMARY_ROTATION = "Camera.Primary.Rotation";
-       const char* _CAM_SECONDARY_DIRECTION = "Camera.Secondary.Direction";
-       const char* _CAM_SECONDARY_ROTATION = "Camera.Secondary.Rotation";
-
-       struct xmlParserDeleter
-       {
-               void operator()(xmlDoc* pXmlDoc)
-               {
-                       xmlFreeDoc(pXmlDoc);
-               }
-       };
-
-       class _OverlayRegionMediaCapability
-       {
-       public:
-               _OverlayRegionMediaCapability(void);
-
-               virtual ~_OverlayRegionMediaCapability(void);
-
-               result Construct(void);
-               result ParseCapability(const char* xmlBuffer, int length);
-               void ParseSection(xmlNodePtr pRoot, const Tizen::Base::String& section);
-
-               int cameraPrimaryDirection;
-               int cameraPrimaryRotation;
-               int cameraSecondaryDirection;
-               int cameraSecondaryRotation;
-       }; //_OverlayRegionMediaCapability
-}
-
 namespace Tizen { namespace Ui { namespace Controls
 {
-
+const int _ROTATION_COUNT = 4;
+int _OverlayRegionImpl::__primaryCameraRotation = -1;
+int _OverlayRegionImpl::__secondaryCameraRotation = -1;
 bool _OverlayRegionImpl::__overlayRegionPixelFomatList[]= {false,};
 
-bool
-CheckFinalRect(Tizen::Graphics::Rectangle& userRect,Tizen::Graphics::Rectangle& overlayPhysicalRect)
-{
-       Rectangle rect = _CoordinateSystemUtils::InverseTransform(overlayPhysicalRect);
-       if (rect.width != userRect.width || rect.height != userRect.height )
-       {
-               SysSecureLog(NID_UI_CTRL,"__InvR(overlayPhysicalRect [%d, %d, %d, %d]) (w : %4d, h : %4d) org (w : %4d, h : %4d) is not same",
-                               overlayPhysicalRect.x, overlayPhysicalRect.y, overlayPhysicalRect.width, overlayPhysicalRect.height, rect.width,  rect.height, userRect.width, userRect.height);
-
-               return false;
-       }
-       return true;
-}
-
-result
-_IsValidSrcDim(const Tizen::Graphics::Dimension& srcDim, int multipleValueW, int multipleValueH)
-{
-       result r = E_SUCCESS;
-
-       if (srcDim.width < 0 || srcDim.height < 0)
-       {
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] Source dimension has negative value [w : %4d, h : %4d].",
-                                srcDim.width, srcDim.height);
-               r = E_INVALID_ARG;
-       }
-
-       if (srcDim.width % multipleValueW || srcDim.height % multipleValueH)
-       {
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] srcDim[%4d, %4d] should be multiple of [%4d, %4d].",
-                                srcDim.width, srcDim.height, multipleValueW, multipleValueH);
-               r = E_INVALID_ARG;
-       }
-
-       SysSecureLog(NID_UI_CTRL, "srcDim w:%d h:%d, UnitW[%d], UnitH[%d]", srcDim.width, srcDim.height, multipleValueW, multipleValueH);
-
-       return r;
-}
-
 OverlayRegionRotate
-_ConvertCamToOverlayRegionRotation(OverlayRegionType type, int camDir, int camRot, int formOrientation)
+_ConvertCamToOverlayRegionRotation(OverlayRegionType overlayRegionType, int cameraRotation, int formOrientation)
 {
        OverlayRegionRotate rotation = OVERLAYREGION_ROTATE_NONE;
+       int tempCameraRotation = 0;
+       int tempFormRotation = 0;
 
-       int tempCamDir = 0;
-       int tempCamRot = 0;
-       int tempFormRot = 0;
-
-       switch (camDir)
-       {
-       case 1://CAMERA_DIRECTION_FRONT:
-               tempCamDir = 1;
-               break;
-       case 2://CAMERA_DIRECTION_BACK:
-               tempCamDir = 2;
-               break;
-       default:
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] cameraRot [%d] is invalid", camRot);
-               return rotation;
-       }
-
-       switch (camRot)
+       switch (cameraRotation)
        {
        case 1://CAMERA_ROTATION_NONE:
-               tempCamRot = 0;
+               tempCameraRotation = 0;
                break;
        case 2://CAMERA_ROTATION_90:
-               tempCamRot = 1;
+               tempCameraRotation = 1;
                break;
        case 3://CAMERA_ROTATION_180:
-               tempCamRot = 2;
+               tempCameraRotation = 2;
                break;
        case 4://CAMERA_ROTATION_270:
-               tempCamRot = 3;
+               tempCameraRotation = 3;
                break;
        default:
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] cameraRot [%d] is invalid", camRot);
+               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The current rotation of camera[%d] is invalid", cameraRotation);
                return rotation;
        }
 
        switch (static_cast<OrientationStatus>(formOrientation))
        {
        case ORIENTATION_STATUS_PORTRAIT:
-               tempFormRot = 0;
+               tempFormRotation = 0;
                break;
        case ORIENTATION_STATUS_LANDSCAPE:
-               tempFormRot = 1;
+               tempFormRotation = 1;
                break;
        case ORIENTATION_STATUS_PORTRAIT_REVERSE:
-               tempFormRot = 2;
+               tempFormRotation = 2;
                break;
        case ORIENTATION_STATUS_LANDSCAPE_REVERSE:
-               tempFormRot = 3;
+               tempFormRotation = 3;
                break;
        default:
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] formOrientation [%d] is invalid", formOrientation);
+               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The current rotation of form[%d] is invalid", formOrientation);
                return rotation;
        }
 
-       if (type == OVERLAY_REGION_TYPE_NORMAL)
+       switch (overlayRegionType)
        {
+       case OVERLAY_REGION_TYPE_NORMAL:
                rotation = OVERLAYREGION_ROTATE_0;
+               break;
+       case OVERLAY_REGION_TYPE_PRIMARY_CAMERA:
+               rotation = static_cast<OverlayRegionRotate>((_ROTATION_COUNT - (tempFormRotation - tempCameraRotation)) % _ROTATION_COUNT);
+               break;
+       case OVERLAY_REGION_TYPE_SECONDARY_CAMERA:
+               rotation = static_cast<OverlayRegionRotate>((tempFormRotation + tempCameraRotation) % _ROTATION_COUNT);
+               break;
+       default:
+               break;
        }
-       else if(type == OVERLAY_REGION_TYPE_PRIMARY_CAMERA)
-       {
-               rotation = static_cast<OverlayRegionRotate>((_ROTATION_COUNT - (tempFormRot - tempCamRot)) % _ROTATION_COUNT);
-       }
-       else if(type == OVERLAY_REGION_TYPE_SECONDARY_CAMERA)
-       {
-               rotation = static_cast<OverlayRegionRotate>((tempFormRot + tempCamRot) % _ROTATION_COUNT);
-       }
-
-       SysSecureLog(NID_UI_CTRL, "type : %d, rotation:%d, cameraDir : %d, camRot:%d, formOrientation:%d", type, rotation, tempCamDir, tempCamRot, tempFormRot);
+       SysSecureLog(NID_UI_CTRL, "The current OverlayRegion's type is [%d], rotation is [%d]", overlayRegionType, rotation);
 
        return rotation;
 }
@@ -214,27 +125,24 @@ _OverlayRegionImpl::_OverlayRegionImpl(void)
        , __overlayRegionType(OVERLAY_REGION_TYPE_MIN)
        , __pOverlayAgent(null)
        , __destRect(0.0f, 0.0f, 0.0f, 0.0f)
-       , __myIdx(-1)
-       , __cameraDirection(2/*CAMERA_DIRECTION_BACK*/)
-       , __cameraRotation(1/*CAMERA_ROTATION_NONE*/)
+       , __overlayRegionIndex(-1)
        , __showState(true)
+       , __cameraRotation(1)
 {
-
 }
 
 _OverlayRegionImpl::~_OverlayRegionImpl(void)
 {
        if (__pParentForm)
        {
-               if (__myIdx != -1)
+               if (__overlayRegionIndex != -1)
                {
-                       __pParentForm->__ppOverlayerRegionImplArray[__myIdx] = null;
+                       __pParentForm->__pOverlayerRegionImplArray[__overlayRegionIndex] = null;
                }
 
                __pParentForm->__overlayRegionCount--;
        }
-
-       SysSecureLog(NID_UI_CTRL, "destructor : __myIdx [%d], parentForm : [%x]", __myIdx, __pParentForm);
+       SysSecureLog(NID_UI_CTRL, "The [%d]th OverlayRegion in form[%x] is deleted.", __overlayRegionIndex, __pParentForm);
 
        if (__pOverlayAgent)
        {
@@ -258,10 +166,14 @@ _OverlayRegionImpl::GetBounds(float& x, float& y, float& width, float& height) c
 }
 
 result
-_OverlayRegionImpl::SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, const Tizen::Graphics::Dimension& srcDim, OverlayRegionBufferPixelFormat srcFormat, bool isUserInput)
+_OverlayRegionImpl::SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, const Tizen::Graphics::Dimension& srcDim, OverlayRegionBufferPixelFormat srcFormat)
 {
-       result r = _IsValidSrcDim(srcDim, OverlayRegion::GetWidthUnit(), OverlayRegion::GetHeightUnit());
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_INVALID_STATE, "The current value of OverlayAgent is null.");
+       SysTryReturnResult(NID_UI_CTRL, __showState, E_SYSTEM, "The current Overlay Region is on back ground. Not yet draw.");
+
+       SysTryReturnResult(NID_UI_CTRL, srcDim.width > 0 && srcDim.height > 0, E_INVALID_ARG, " The current value of source dimension[%d, %d] is invalid", srcDim.width, srcDim.height);
+       SysTryReturnResult(NID_UI_CTRL, srcDim.width % OverlayRegion::GetWidthUnit() == 0 && srcDim.height % OverlayRegion::GetHeightUnit()== 0, E_INVALID_ARG,
+               "The current value of source dimension[%d, %d] is invalid. It should be multiple of OverlayRegion::GetWidthUnit() & GetHeightUnit()", srcDim.width, srcDim.height);
 
        if (!__overlayRegionPixelFomatList[0])
        {
@@ -289,26 +201,24 @@ _OverlayRegionImpl::SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, con
                format = _OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_UYVY;
                break;
        default:
-               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] srcFormat [%d] is not supported!", srcFormat);
+               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The input value of srcFormat[%d] is unsupported.", srcFormat);
                return E_UNSUPPORTED_FORMAT;
        }
 
        if (!__overlayRegionPixelFomatList[srcFormat])
        {
-               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] srcFormat [%d] is not supported!", srcFormat);
+               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The input value of srcFormat[%d] is unsupported.", srcFormat);
                return E_UNSUPPORTED_FORMAT;
        }
 
        int size = srcBuffer.GetCapacity();
-       SysTryReturnResult(NID_UI_CTRL, size > 0, E_INVALID_ARG, "[E_INVALID_ARG] source size[%d] is invalid!", size);
+       SysTryReturnResult(NID_UI_CTRL, size > 0, E_INVALID_ARG, "The current size of source[%d] is invalid.", size);
 
-       r = __pOverlayAgent->SetInputBuffer(srcBuffer, srcDim, format);
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r) );
-
-       SysTryReturnResult(NID_UI_CTRL, __showState, E_SYSTEM, "[E_SYSTEM]__showState is false! don't draw now..");
+       result r = __pOverlayAgent->SetInputBuffer(srcBuffer, srcDim, format);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        r = __pOverlayAgent->Draw();
-       SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r) );
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
        return E_SUCCESS;
 }
@@ -316,50 +226,49 @@ _OverlayRegionImpl::SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, con
 result
 _OverlayRegionImpl::GetBackgroundBufferInfo(Tizen::Graphics::BufferInfo& info) const
 {
-       BufferInfo bgBufInfo;
-       _BufferInfoImpl* pBufInfoImpl = null;
+       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_INVALID_STATE, "The current value of OverlayAgent is null.");
 
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_INVALID_STATE, "[E_INVALID_STATE] __pOverlayAgent is null.");
-       __pOverlayAgent->GetBufferInfo(info);
+       result r = __pOverlayAgent->GetBufferInfo(info);
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-       pBufInfoImpl = _BufferInfoImpl::GetInstance(info);
-       SysTryReturnResult(NID_UI_CTRL, pBufInfoImpl != null , E_SYSTEM, "[E_SYSTEM] pBufInfoImpl is null.");
+       _BufferInfoImpl* pBufferInfoImpl = _BufferInfoImpl::GetInstance(info);
+       SysTryReturnResult(NID_UI_CTRL, pBufferInfoImpl != null , E_SYSTEM, "The current value of BufferInfo is null.");
 
-       Tizen::Ui::Controls::_FormImpl* pFormImpl = static_cast<_FormImpl*>(__pParentForm->GetUserData());
-       SysTryReturn(NID_UI_CTRL, pFormImpl != null, false, E_SYSTEM, "[E_SYSTEM] pParentForm impl is null.");
+       _FormImpl* pFormImpl = static_cast<_FormImpl*>(__pParentForm->GetUserData());
+       SysTryReturnResult(NID_UI_CTRL, pFormImpl != null, E_SYSTEM, "The current value of parent form is null.");
 
-       Tizen::Ui::OrientationStatus formOrientationStatus = pFormImpl->GetOrientationStatus();
+       OrientationStatus formOrientationStatus = pFormImpl->GetOrientationStatus();
        switch (formOrientationStatus)
        {
        case ORIENTATION_STATUS_NONE:
-               // fall through
+               //fall through
        case ORIENTATION_STATUS_PORTRAIT:
-               pBufInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_PORTRAIT);
+               pBufferInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_PORTRAIT);
                break;
        case ORIENTATION_STATUS_LANDSCAPE :
-               pBufInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_LANDSCAPE);
+               pBufferInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_LANDSCAPE);
                break;
        case ORIENTATION_STATUS_PORTRAIT_REVERSE:
-               pBufInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_PORTRAIT_REVERSE);
+               pBufferInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_PORTRAIT_REVERSE);
                break;
        case ORIENTATION_STATUS_LANDSCAPE_REVERSE:
-               pBufInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_LANDSCAPE_REVERSE);
+               pBufferInfoImpl->SetOrientation(_BufferInfoImpl::ORIENTATION_LANDSCAPE_REVERSE);
                break;
        }
 
        switch (__cameraRotation)
        {
-       case 1://CAMERA_ROTATION_NONE
-               pBufInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_0);
+       case 1: //CAMERA_ROTATION_NONE
+               pBufferInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_0);
                break;
-       case 2://CAMERA_ROTATION_90:
-               pBufInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_90);
+       case 2: //CAMERA_ROTATION_90:
+               pBufferInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_90);
                break;
-       case 3://CAMERA_ROTATION_180:
-               pBufInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_180);
+       case 3: //CAMERA_ROTATION_180:
+               pBufferInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_180);
                break;
-       case 4://CAMERA_ROTATION_270:
-               pBufInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_270);
+       case 4: //CAMERA_ROTATION_270:
+               pBufferInfoImpl->SetRotation(_BufferInfoImpl::ROTATION_270);
                break;
        }
 
@@ -367,134 +276,117 @@ _OverlayRegionImpl::GetBackgroundBufferInfo(Tizen::Graphics::BufferInfo& info) c
 }
 
 result
-_OverlayRegionImpl::Show(void) const
-{
-       SysTryReturnResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] __pOverlayAgent is null.");
-       return __pOverlayAgent->Show();
-}
-
-result
 _OverlayRegionImpl::Construct(_Form* pParentForm, OverlayRegionType overlayRegionType, const FloatRectangle& userDestRect, const FloatRectangle& overlayLogRect, const Rectangle& finalPhyRect)
 {
-       result r = E_SUCCESS;
-
-       switch (overlayRegionType)
-       {
-       case OVERLAY_REGION_TYPE_PRIMARY_CAMERA:
-       {
-               _OverlayRegionMediaCapability capability;
-               r = capability.Construct();
-               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] pPropagating.", GetErrorMessage(r));
-
-               __cameraDirection = capability.cameraPrimaryDirection;
-               __cameraRotation = capability.cameraPrimaryRotation;
-
-               break;
-       }
-       case OVERLAY_REGION_TYPE_SECONDARY_CAMERA:
-       {
-               _OverlayRegionMediaCapability capability;
-               r = capability.Construct();
-               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] pPropagating.", GetErrorMessage(r));
-
-               __cameraDirection = capability.cameraSecondaryDirection;
-               __cameraRotation = capability.cameraSecondaryRotation;
-
-               break;
-       }
-       case OVERLAY_REGION_TYPE_NORMAL:
-               break;
-       default:
-               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] overlayRegionType [%d] is not supported!", overlayRegionType);
-               return E_UNSUPPORTED_FORMAT;
-       }
-
-
-       SysTryReturnResult(NID_UI_CTRL, pParentForm != null, E_SYSTEM, "[E_SYSTEM] pParentForm impl is null.");
-
-       Tizen::Ui::Controls::_FormImpl* pFormImpl = static_cast<_FormImpl*>(pParentForm->GetUserData());
-       SysTryReturnResult(NID_UI_CTRL, pFormImpl != null, E_SYSTEM, "[E_SYSTEM] pFormImpl impl is null.");
-
-       OverlayRegionRotate rotation = _ConvertCamToOverlayRegionRotation(overlayRegionType, __cameraDirection, __cameraRotation, pFormImpl->GetOrientationStatus());
-       SysTryReturnResult(NID_UI_CTRL, rotation != OVERLAYREGION_ROTATE_NONE, E_SYSTEM, "[E_SYSTEM] __rotation is OVERLAYREGION_ROTATE_NONE.");
-
-       //Rectangle overlayRect(leftTopPos.x, leftTopPos.y, destRect.width, destRect.height);
-       //SysLog(NID_UI_CTRL,"overlayAgentRect[%d, %d, %d, %d]", overlayRect.x, overlayRect.y, overlayRect.width, overlayRect.height);
+       SysTryReturnResult(NID_UI_CTRL, pParentForm != null, E_SYSTEM, "The current value of Parent Form is null.");
 
+       _FormImpl* pFormImpl = static_cast<_FormImpl*>(pParentForm->GetUserData());
+       SysTryReturnResult(NID_UI_CTRL, pFormImpl != null, E_SYSTEM, "The Impl of Parent Form is null.");
 
        _OverlayAgentStyle overlayAgentType = _OVERLAY_AGENT_STYLE_REGION_SW;
-       String preferredEngineConfig(elm_config_preferred_engine_get());
-       if(preferredEngineConfig.Equals("opengl_x11", true))
-       {
-               overlayAgentType = _OVERLAY_AGENT_STYLE_REGION_GL;
-               SysSecureLog(NID_UI_CTRL,"xml : HwAcceleration was set to On");
-       }
-       else if(preferredEngineConfig.Equals("software_x11", true))
-       {
-               overlayAgentType = _OVERLAY_AGENT_STYLE_REGION_SW;
-               SysSecureLog(NID_UI_CTRL,"xml : HwAcceleration was set to Off");
-       }
-       else
        {
-               String engineConfig(elm_config_engine_get());
-               if(engineConfig.Equals("opengl_x11", true))
+               String preferredEngineConfig(elm_config_preferred_engine_get());
+               if(preferredEngineConfig.Equals("opengl_x11", true))
                {
                        overlayAgentType = _OVERLAY_AGENT_STYLE_REGION_GL;
-                       SysSecureLog(NID_UI_CTRL,"dev setting option is gl backend");
+                       SysLog(NID_UI_CTRL, "The current value of HwAcceleration is On");
+               }
+               else if(preferredEngineConfig.Equals("software_x11", true))
+               {
+                       overlayAgentType = _OVERLAY_AGENT_STYLE_REGION_SW;
+                       SysLog(NID_UI_CTRL, "The current value of HwAcceleration is Off");
                }
                else
                {
-                       SysSecureLog(NID_UI_CTRL,"dev setting option is sw backend");
+                       String engineConfig(elm_config_engine_get());
+                       if(engineConfig.Equals("opengl_x11", true))
+                       {
+                               overlayAgentType = _OVERLAY_AGENT_STYLE_REGION_GL;
+                               SysLog(NID_UI_CTRL,"The current value of HwAcceleration is On (System Default)");
+                       }
+                       else
+                       {
+                               SysLog(NID_UI_CTRL,"The current value of HwAcceleration is Off (System Default)");
+                       }
                }
        }
 
-       __pOverlayAgent = _OverlayAgent::CreateInstanceN(overlayAgentType, *pParentForm, overlayLogRect, finalPhyRect);
-       r = GetLastResult();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS && __pOverlayAgent != null, r, "[%s] pPropagating.", GetErrorMessage(r));
+       std::unique_ptr<_OverlayAgent> pOverlayAgent(_OverlayAgent::CreateInstanceN(overlayAgentType, *pParentForm, overlayLogRect, finalPhyRect));
+       SysTryReturnResult(NID_UI_CTRL, pOverlayAgent != null, E_SYSTEM, "The current value of OverlayAgent is null.");
 
-       __pParentForm = pParentForm;
-       __overlayRegionType = overlayRegionType;
-       __destRect = userDestRect;
+       result r = GetLastResult();
+       SysTryReturnResult(NID_UI_CTRL,r == E_SUCCESS, r, "Propagating.");
 
-       if(overlayAgentType == _OVERLAY_AGENT_STYLE_REGION_GL)
+       //Set Rotation of OverlayRegion
+       if (__primaryCameraRotation == -1 || __secondaryCameraRotation == -1)
        {
-               r = __pOverlayAgent->CreatePixmap();
-               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               _OverlayRegionMediaCapability capability;
+               r = capability.Construct();
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+
+               __primaryCameraRotation = capability.cameraPrimaryRotation;
+               __secondaryCameraRotation = capability.cameraSecondaryRotation;
        }
-       else
+
+       switch (overlayRegionType)
        {
-               SysSecureLog(NID_UI_CTRL,"The current type of OverlayAgent is _OVERLAY_AGENT_STYLE_REGION_SW, and it don't need to make a pixmap");
+       case OVERLAY_REGION_TYPE_NORMAL:
+               __cameraRotation = 1; //CAMERA_ROTATION_NONE
+               break;
+       case OVERLAY_REGION_TYPE_PRIMARY_CAMERA:
+               __cameraRotation = __primaryCameraRotation;
+               break;
+       case OVERLAY_REGION_TYPE_SECONDARY_CAMERA:
+               __cameraRotation = __secondaryCameraRotation;
+               break;
+       default:
+               SysLogException(NID_UI_CTRL, E_UNSUPPORTED_FORMAT, "[E_UNSUPPORTED_FORMAT] The current type of OverlayRegion[%d] is unsupported", overlayRegionType);
+               return E_UNSUPPORTED_FORMAT;
        }
 
+       OverlayRegionRotate rotation = _ConvertCamToOverlayRegionRotation(overlayRegionType, __cameraRotation, pFormImpl->GetOrientationStatus());
+       SysTryReturnResult(NID_UI_CTRL, rotation != OVERLAYREGION_ROTATE_NONE, E_SYSTEM, "The current camera rotation is invalid.");
+
        switch(rotation)
        {
        case OVERLAYREGION_ROTATE_0:
-               __pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_NONE);
+               r = pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_NONE);
                break;
        case OVERLAYREGION_ROTATE_90:
-               __pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_90);
+               r = pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_90);
                break;
        case OVERLAYREGION_ROTATE_180:
-               __pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_180);
+               r = pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_180);
                break;
        case OVERLAYREGION_ROTATE_270:
-               __pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_270);
+               r = pOverlayAgent->SetRotation(_OVERLAY_AGENT_ROTATION_270);
                break;
        default:
-               SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] The current orientation(%d) is invalid.", rotation);
-               return E_SYSTEM;
+               r = E_SYSTEM;
+               break;
        }
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+
+       __pParentForm = pParentForm;
+       __overlayRegionType = overlayRegionType;
+       __destRect = userDestRect;
+       __pOverlayAgent = pOverlayAgent.release();
 
-       if (overlayAgentType == _OVERLAY_AGENT_STYLE_REGION_SW)
+       if(overlayAgentType == _OVERLAY_AGENT_STYLE_REGION_GL)
+       {
+               r = __pOverlayAgent->CreatePixmap(finalPhyRect);
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+       }
+       else if (overlayAgentType == _OVERLAY_AGENT_STYLE_REGION_SW)
        {
                int size = (finalPhyRect.width * 2) * (finalPhyRect.height * 2);
-               std::unique_ptr<byte[]> pBuf(new (std::nothrow) byte[size]);
-               SysTryCatch(NID_UI_CTRL, pBuf != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Buffer must not be null.");
+               std::unique_ptr<byte[]> pBuffer(new (std::nothrow) byte[size]);
+               SysTryReturnResult(NID_UI_CTRL, pBuffer != null, E_OUT_OF_MEMORY, "Failed to create a buffer for OverlayRegion.");
 
-               unsigned long* pPos = (unsigned long*)pBuf.get();
+               unsigned long* pPos = (unsigned long*)pBuffer.get();
                for(int i = 0; i < finalPhyRect.height; i++)
                {
-                       for(int j = 0;j < finalPhyRect.width; j++)
+                       for(int j = 0; j < finalPhyRect.width; j++)
                        {
                                *pPos = 0xFF000000;
                                pPos++;
@@ -503,29 +395,26 @@ _OverlayRegionImpl::Construct(_Form* pParentForm, OverlayRegionType overlayRegio
 
                ByteBuffer buffer;
                r = buffer.Construct(size);
-               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
 
-               buffer.SetArray(pBuf.get(), 0, size);
-               r = SetInputBuffer(buffer, Dimension(finalPhyRect.width, finalPhyRect.height), OVERLAY_REGION_BUFFER_PIXEL_FORMAT_ARGB8888, true);
-               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
-               __pOverlayAgent->SetEvasImageDirtyCallback();
+               buffer.SetArray(pBuffer.get(), 0, size);
+               r = SetInputBuffer(buffer, Dimension(finalPhyRect.width, finalPhyRect.height), OVERLAY_REGION_BUFFER_PIXEL_FORMAT_ARGB8888);
+               SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
+       }
+       else
+       {
+               SysLogException(NID_UI_CTRL, E_SYSTEM, "[E_SYSTEM] The current type of OverlayAgen[%d] is invalid.", overlayRegionType);
+               return E_SYSTEM;
        }
 
        return r;
-
-CATCH:
-       delete __pOverlayAgent;
-       __pOverlayAgent = null;
-
-       return GetLastResult();
 }
 
 OverlayRegion*
 _OverlayRegionImpl::CreateOverlayRegionN(void)
 {
        OverlayRegion* pOverlayRegion = new (std::nothrow) OverlayRegion();
-       SysTryReturn(NID_UI_CTRL, pOverlayRegion != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pOverlayRegion is null.");
+       SysTryReturn(NID_UI_CTRL, pOverlayRegion != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The current value of OverlayRegion is null.");
 
        __pOverlayRegion = pOverlayRegion;
        __pOverlayRegion->__pOverlayRegionImpl = this;
@@ -536,8 +425,7 @@ _OverlayRegionImpl::CreateOverlayRegionN(void)
 void
 _OverlayRegionImpl::SetFormArrayIndex(int index)
 {
-       __myIdx = index;
-       return;
+       __overlayRegionIndex = index;
 }
 
 OverlayRegion*
@@ -549,206 +437,33 @@ _OverlayRegionImpl::GetOverlayRegion(void) const
 void
 _OverlayRegionImpl::GoForeground(void)
 {
-       __showState = true;
-
-       SysTryReturnVoidResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] __pOverlayAgent impl is null.");
-       SysSecureLog(NID_UI_CTRL, "GoForeground  pixmap : %d", __pOverlayAgent->GetPixmap());
-       //__pOverlayAgent->AdjustImageObject();
+       ClearLastResult();
+       SysTryReturnVoidResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] The current value of OverlayAgent is null.");
 
-       return;
+       __showState = true;
+       SysSecureLog(NID_UI_CTRL, "The current pixmap[%d] of OverlayRegion is on foreground.", __pOverlayAgent->GetPixmap());
 }
 
 void
 _OverlayRegionImpl::GoBackground(void)
 {
-       __showState = false;
+       ClearLastResult();
+       SysTryReturnVoidResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] The current value of OverlayAgent is null.");
 
-       SysTryReturnVoidResult(NID_UI_CTRL, __pOverlayAgent != null, E_SYSTEM, "[E_SYSTEM] __pOverlayAgent impl is null.");
+       __showState = false;
        __pOverlayAgent->UngrabXvPort();
-
-       SysSecureLog(NID_UI_CTRL, "GoBackground  pixmap : %d", __pOverlayAgent->GetPixmap());
-
-       return;
+       SysSecureLog(NID_UI_CTRL, "The current pixmap[%d] of OverlayRegion is on background.", __pOverlayAgent->GetPixmap());
 }
 
 result
-_OverlayRegionImpl::IsValidOverlayRect(Tizen::Graphics::Rectangle& userRect, Tizen::Graphics::Rectangle& overlayPhysicalRect, const Tizen::Graphics::Rectangle& basePhysicalRect, bool& modified)
+_OverlayRegionImpl::IsValidBounds(const Rectangle& physicalBounds)
 {
-       result r = E_SUCCESS;
-       Rectangle orgOverlayPhysicalRect = overlayPhysicalRect;
-
-       SysSecureLog(NID_UI_CTRL, "overlayPhysicalRect[%d, %d, %d, %d]", overlayPhysicalRect.x, overlayPhysicalRect.y, overlayPhysicalRect.width, overlayPhysicalRect.height);
-
-       if ((overlayPhysicalRect.width < _OverlayAgent::GetDstRectMinWidth()) || (overlayPhysicalRect.height < _OverlayAgent::GetDstRectMinHeight()))
-       {
-                       SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The current size of OverlayRegoin is invalid [w : %4d, h : %4d].",
-                                        overlayPhysicalRect.width, overlayPhysicalRect.height);
-                       return E_INVALID_ARG;
-       }
-
-       bool allCaseW = false;
-       bool allCaseH = false;
-       int overlayWidthUnit = _OverlayAgent::GetWidthUnit();
-       int modW = orgOverlayPhysicalRect.width % overlayWidthUnit;
-       int baseW = overlayWidthUnit / 2;
-
-       if (baseW != 0)
-       {
-               if (modW != 0)
-               {
-                       if (modW < baseW)
-                       {
-                               orgOverlayPhysicalRect.width -= modW;
-                       }
-                       else if (modW > baseW)
-                       {
-                               orgOverlayPhysicalRect.width += (overlayWidthUnit - modW);
-                       }
-                       else if (modW == baseW)
-                       {
-                               allCaseW = true;
-                       }
-
-                       modified = true;
-               }
-       }
-
-       int overlayHeightUnit = _OverlayAgent::GetHeightUnit();
-       int modH = orgOverlayPhysicalRect.height % overlayHeightUnit;
-       int baseH = overlayHeightUnit / 2;
-
-       if (baseH != 0)
-       {
-               if (modH != 0)
-               {
-                       if (modH < baseH)
-                       {
-                               orgOverlayPhysicalRect.height -= modH;
-                       }
-                       else if (modH > baseH)
-                       {
-                               orgOverlayPhysicalRect.height += (overlayHeightUnit - modH);
-                       }
-                       else if (modH == baseH)
-                       {
-                               allCaseH = true;
-                       }
-
-                       modified = true;
-               }
-       }
-
-       bool pass = false;
-       if(!allCaseW && !allCaseH)
-       {
-               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-               {
-                       pass = true;
-               }
-       }
-
-       if(!pass)
-       {
-               if (allCaseW)
-               {
-                       if (allCaseH)
-                       {
-                               orgOverlayPhysicalRect = overlayPhysicalRect;
-                               orgOverlayPhysicalRect.width -= modW;
-                               orgOverlayPhysicalRect.height -= modH;
-                               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                               {
-                                       goto FINAL;
-                               }
-
-                               orgOverlayPhysicalRect = overlayPhysicalRect;
-                               orgOverlayPhysicalRect.width -= modW;
-                               orgOverlayPhysicalRect.height += modH;
-                               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                               {
-                                       goto FINAL;
-                               }
+       int minWidth = _OverlayAgent::GetDstRectMinWidth();
+       int minHeight = _OverlayAgent::GetDstRectMinHeight();
+       SysTryReturnResult(NID_UI_CTRL, physicalBounds.width >= minWidth && physicalBounds.height >= minHeight, E_INVALID_ARG,
+               "The current size of OverlayRegoin[%d, %d] is under minimum size[%d, %d].", physicalBounds.width, physicalBounds.height, minWidth, minHeight);
 
-                               orgOverlayPhysicalRect = overlayPhysicalRect;
-                               orgOverlayPhysicalRect.width += modW;
-                               orgOverlayPhysicalRect.height -= modH;
-                               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                               {
-                                       goto FINAL;
-                               }
-
-                               orgOverlayPhysicalRect = overlayPhysicalRect;
-                               orgOverlayPhysicalRect.width += modW;
-                               orgOverlayPhysicalRect.height += modH;
-                               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                               {
-                                       goto FINAL;
-                               }
-                       }
-                       else
-                       {
-                               orgOverlayPhysicalRect.width = overlayPhysicalRect.width + modW;
-                               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                               {
-                                       goto FINAL;
-                               }
-
-                               orgOverlayPhysicalRect.width = overlayPhysicalRect.width - modW;
-                               if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                               {
-                                       goto FINAL;
-                               }
-                       }
-               }
-               else if (allCaseH)
-               {
-                       orgOverlayPhysicalRect.height = overlayPhysicalRect.height + modH;
-                       if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                       {
-                               goto FINAL;
-                       }
-
-                       orgOverlayPhysicalRect.height = overlayPhysicalRect.height - modH;
-                       if (CheckFinalRect(userRect, orgOverlayPhysicalRect))
-                       {
-                               goto FINAL;
-                       }
-               }
-       }
-
-       if(!pass)
-       {
-               return E_INVALID_ARG;
-       }
-
-FINAL:
-       overlayPhysicalRect = orgOverlayPhysicalRect;
-
-       SysSecureLog(NID_UI_CTRL, "final overlayPhysicalRect[%d, %d, %d, %d]", overlayPhysicalRect.x, overlayPhysicalRect.y, overlayPhysicalRect.width, overlayPhysicalRect.height);
-
-       // First, overlayPhysicalRect's x, y position should be positive value or zero.
-       if (!((overlayPhysicalRect.x >= 0) && (overlayPhysicalRect.y >= 0) &&
-               // Second, Check if it is clipping or not. (OverlayRegion cannot be clipped)
-               (overlayPhysicalRect.x + overlayPhysicalRect.width <= basePhysicalRect.x + basePhysicalRect.width) &&
-               (overlayPhysicalRect.y + overlayPhysicalRect.height <= basePhysicalRect.y + basePhysicalRect.height)))
-       {
-               SysLogException(NID_UI_CTRL, E_INVALID_ARG, "[E_INVALID_ARG] The bounds of OverlayRegion is now outside of the current form "
-                               "overlayPhysicalRect (x : %4d, y: %4d, w : %4d, h : %4d), "
-                               "basePhysicalRect (x : %4d, y: %4d, w : %4d, h : %4d).",
-                               overlayPhysicalRect.x, overlayPhysicalRect.y, overlayPhysicalRect.width, overlayPhysicalRect.height,
-                               basePhysicalRect.x, basePhysicalRect.y, basePhysicalRect.width, basePhysicalRect.height);
-
-               r = E_INVALID_ARG;
-       }
-
-//     SysLog(NID_UI_CTRL, " overlayPhysicalRect [%d, %d, %d, %d], basePhysicalRect [%d, %d, %d, %d] modified[%d]",
-//                      overlayPhysicalRect.x, overlayPhysicalRect.y, overlayPhysicalRect.width, overlayPhysicalRect.height,
-//                      basePhysicalRect.x, basePhysicalRect.y, basePhysicalRect.width, basePhysicalRect.height, modified );
-
-       r = GetLastResult();
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
-
-       return r;
+       return E_SUCCESS;
 }
 
 result
@@ -760,7 +475,7 @@ _OverlayRegionImpl::SetPixelFormatList(void)
        }
 
        std::unique_ptr< IListT<bool> > pFormatList(_OverlayAgent::GetPixelFormatListN());
-       SysTryReturn(NID_UI_CTRL, pFormatList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] failed to create a list instance");
+       SysTryReturn(NID_UI_CTRL, pFormatList != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to create a list instance");
 
        bool set = false;
        for (int formatIndex = 0; formatIndex < pFormatList->GetCount(); formatIndex++)
@@ -829,6 +544,11 @@ _OverlayRegionImpl::GetInstance(const OverlayRegion& overlayRegion)
 
 namespace
 {
+const char* _MEDIA_CAPABILITY_FILE_PATH = "/usr/etc/media-capability.xml";
+const char* _CAM_PRIMARY_DIRECTION = "Camera.Primary.Direction";
+const char* _CAM_PRIMARY_ROTATION = "Camera.Primary.Rotation";
+const char* _CAM_SECONDARY_DIRECTION = "Camera.Secondary.Direction";
+const char* _CAM_SECONDARY_ROTATION = "Camera.Secondary.Rotation";
 
 _OverlayRegionMediaCapability::_OverlayRegionMediaCapability(void)
        : cameraPrimaryDirection(0)
@@ -849,25 +569,25 @@ _OverlayRegionMediaCapability::Construct(void)
 
        FileAttributes attributes;
        result r = File::GetAttributes(fileName, attributes);
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
 
        long long length = attributes.GetFileSize();
-       SysTryReturnResult(NID_UI_CTRL, length > 0, E_SYSTEM, "[E_SYSTEM] The size of file(%s) is zero.", fileName.GetPointer());
+       SysTryReturnResult(NID_UI_CTRL, length > 0, E_SYSTEM, "The size of file(%s) is zero.", fileName.GetPointer());
 
        std::unique_ptr<char> pXmlBuffer(new (std::nothrow) char[length]);
-       SysTryReturnResult(NID_UI_CTRL, pXmlBuffer != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] pXmlBuffer is null");
+       SysTryReturnResult(NID_UI_CTRL, pXmlBuffer != null, E_OUT_OF_MEMORY, "The Buffer of Xml is null");
 
        File fileObj;
        r = fileObj.Construct(fileName, L"r");
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
 
-       //read the capability xml file content as parse the capability
+       //Read the capability xml file content as parse the capability
        int readLen = fileObj.Read(pXmlBuffer.get(), length);
-       SysTryReturnResult(NID_UI_CTRL, readLen == length, E_SYSTEM, "[E_SYSTEM] Failed to read xml file. (length is %d and readLen is %d)", length, readLen);
+       SysTryReturnResult(NID_UI_CTRL, readLen == length, E_SYSTEM, "Failed to read xml file. (length is %d and readLen is %d)", length, readLen);
 
-       //parse the capability file buffer all the parse key value pair shall be added in __pMap object
+       //Parse the capability file buffer all the parse key value pair shall be added in __pMap object
        r = ParseCapability(pXmlBuffer.get(), readLen);
-       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r));
+       SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_SYSTEM, "Propagating.");
 
        return r;
 }
@@ -934,7 +654,7 @@ result
 _OverlayRegionMediaCapability::ParseCapability(const char* xmlBuffer, int length)
 {
        std::unique_ptr<xmlDoc, xmlParserDeleter> pDoc(xmlParseMemory(xmlBuffer, length));
-       SysTryReturnResult(NID_UI_CTRL, pDoc != null, E_SYSTEM, "[E_SYSTEM] xmlParseMemory failed %s %d", xmlBuffer, length);
+       SysTryReturnResult(NID_UI_CTRL, pDoc != null, E_SYSTEM, "xmlParseMemory failed %s %d", xmlBuffer, length);
 
        xmlNode* pRoot = xmlDocGetRootElement(pDoc.get());
        SysTryReturnResult(NID_UI_CTRL, pRoot != null, E_SYSTEM, "[E_SYSTEM] xmlDocGetRootElement failed");
index 12954c7..c8084a3 100644 (file)
@@ -273,7 +273,7 @@ private:
        float __deflatedHeight;
 
        int __overlayRegionCount;
-       _OverlayRegionImpl** __ppOverlayerRegionImplArray;
+       _OverlayRegionImpl** __pOverlayerRegionImplArray;
 
        int __softkeyCount;
        int __updatedSoftkeyCount;
index 515d6e6..d91d0d2 100644 (file)
@@ -42,6 +42,7 @@
 namespace Tizen { namespace Ui { namespace Animations
 {
 class _VisualElement;
+class VisualElementSurface;
 } } } // Tizen::Ui::Animations
 
 namespace Tizen { namespace Ui { namespace Controls
@@ -93,42 +94,31 @@ enum _OverlayAgentStyle
 class _OverlayAgent
 {
 public:
-       static _OverlayAgent* CreateInstanceN(_OverlayAgentStyle style, const _Control& control, const Tizen::Graphics::FloatRectangle& logBounds, const Tizen::Graphics::Rectangle& phyBounds);
+       static _OverlayAgent* CreateInstanceN(_OverlayAgentStyle style, const _Control& parentControl, const Tizen::Graphics::FloatRectangle& logicalBounds, const Tizen::Graphics::Rectangle& physicalBounds);
        ~_OverlayAgent(void);
 
+       result CreatePixmap(const Tizen::Graphics::Rectangle& physicalBounds);
+       void UngrabXvPort(void);
        result Draw(void);
+
+       Pixmap GetPixmap(void) const;
+       Evas_Object* GetRendererImageObject(void) const;
+       Tizen::Graphics::FloatRectangle GetBounds(void) const;
+
        result GetBufferInfo(Tizen::Graphics::BufferInfo& bufferInfo) const;
 
        result SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, const Tizen::Graphics::Dimension& srcDim, _OverlayAgentBufferPixelFormat srcFormat);
        result SetRotation(_OverlayAgentRotation rotation);
        result SetDestination(const Tizen::Graphics::FloatDimension& dimension);
        result SetAspectRatio(bool enable);
+       result SetRendererFlushNeeded(void);
 
-       result CreatePixmap(void);
-       Pixmap GetPixmap(void) const;
-       Evas_Object* GetPixmapImageObject(void) const;
-
-       result GrabXvPort(void);
-       void UngrabXvPort(void);
-
-       result Show(void) const;
-       result AdjustImageObject(void);
-
-       void SetEvasImageDirtyCallback(void);
-       bool GetEvasImageDirtyFlag(void) const;
-       void SetEvasImageDirtyFlag(bool dirty);
-
-       result MoveChildToTop(const _Control& child);
-
-       bool IsValidSourceDimension(const Tizen::Graphics::Dimension& dimension) const;
        bool IsValidDestinationDimension(const Tizen::Graphics::FloatDimension& dimension) const;
 
-       Tizen::Graphics::Dimension GetPrevCbImageDimension(void) const;
-       result SetPrevCbImageDimension(const Tizen::Graphics::Dimension& dimension);
 
+       // static utilities
+       static result EvaluateBounds(OverlayAgentEvaluationOption option, Tizen::Graphics::FloatRectangle& rect, bool& modified);
        static int GetOverlayAgentCount(void);
-
-       static result EvaluateBounds(OverlayAgentEvaluationOption option, Tizen::Graphics::Rectangle& rect, bool& modified);
        static Tizen::Base::Collection::IListT<bool>* GetPixelFormatListN(void);
 
        static int GetDstRectMinWidth(void);
@@ -140,64 +130,54 @@ public:
        static int GetMaxCount(void);
 
 private:
-       result CreateImageObjectForOverlayRegion(const _Control& control, const Tizen::Graphics::Rectangle& bounds);
-       result CreateImageObject(const _Control& control, const Tizen::Graphics::Rectangle& bounds);
+       _OverlayAgent(_OverlayAgentStyle style, const _Control& parentControl, const Tizen::Graphics::FloatRectangle& logicalBounds, const Tizen::Graphics::Rectangle& physicalBounds);
+       _OverlayAgent(const _OverlayAgent& rhs);
+       _OverlayAgent& operator=(const _OverlayAgent& rhs);
 
+       result CreateRendererVisualElement(const _Control& parentControl, const Tizen::Graphics::FloatRectangle& logicalBounds, const Tizen::Graphics::Rectangle& physicalBounds);
+       result GrabXvPort(void);
        result PutXvImage(void);
        result PutEvasImage(void);
-       static int GetValueFromRegistry(const Tizen::Base::String& key);
 
-       _OverlayAgent(_OverlayAgentStyle style, const _Control& control, const Tizen::Graphics::FloatRectangle& logBounds, const Tizen::Graphics::Rectangle& phyBounds);
-       _OverlayAgent(const _OverlayAgent& rhs);
-       _OverlayAgent& operator=(const _OverlayAgent& rhs);
+       static int GetValueFromRegistry(const Tizen::Base::String& key);
 
 private:
-       Evas_Object* __pImageObject;
-       Evas_Object* __pRenderImageObject;
-       Evas_Object* __pSmartObject;
-
-       Ecore_X_Damage  __pixmapDamageHandle;
-       Ecore_Event_Handler *__pPixmapEventHandler;
-       Pixmap __pixmap;
+       const static int _OVERLAYAGENT_XV_PORT = 100;
 
-       Tizen::Ui::Animations::_VisualElement* __pVisualElement;
-       Tizen::Graphics::Color __bgColor;
+       //VisualElements
+       Tizen::Ui::Animations::_VisualElement* __pParentVE;
+       Tizen::Ui::Animations::_VisualElement* __pRendererVE;
 
-       int __xvPort;
-       bool __grabXvPort;
-
-       unsigned int __colorFormat;
-       int __userRotation;
-       bool __flushRotate;
-       int __udMirroring;
-       int __lrMirroring;
-       bool __aspectRatio;
-
-       Tizen::Graphics::Dimension __srcDimension;
-       Tizen::Graphics::Rectangle __pixmapPhyRect;
-       Tizen::Graphics::Rectangle __resizeRect;
+       //Renderer property
+       Evas_Object* __pImageObject;
        _OverlayAgentStyle __style;
+       _OverlayAgentRotation __currentRotation;
+       unsigned int __savedColorFormat;
+       _OverlayAgentBufferPixelFormat __currentColorFormat;
+       Tizen::Graphics::Dimension __currentSourceBufferSize;
+       Tizen::Graphics::FloatRectangle __standardRendererBounds;
+       bool __needToRellaocImage;
+
+       //Renderer Buffer
+       const Tizen::Base::ByteBuffer* __pCurrentSourceBuffer;
+       Tizen::Base::ByteBuffer* __pConvertedSourceBuffer;
+
+       //(GL-Backend) Renderer Pixmap
+       Ecore_X_Damage __pixmapDamageHandle;
+       Ecore_Event_Handler* __pPixmapEventHandler;
+       Pixmap __pixmap;
 
+       //(GL-Backend) Xv Property
+       int __xvPort;
        XvImage* __pXvImage;
-       unsigned int __newColorFormat;
        XShmSegmentInfo* __pShmInfo;
 
-       _OverlayAgentBufferPixelFormat __overlayAgentColorFormat;
-       const Tizen::Base::ByteBuffer* __pRefUserByteBuffer;
-       Tizen::Base::ByteBuffer* __pOrgUserByteBuffer;
-       Tizen::Graphics::Dimension __orgUsrImgDimension;
-       Tizen::Graphics::Dimension __orgCbImgDimension;
-       Tizen::Graphics::FloatRectangle __logicalOverlayRect;
-
-       bool __evasImageDamaged;
-
-       const static int _OVERLAYAGENT_XV_PORT = 100;
-       static int __overlayAgentcount;
-       static int __overlayAgentXvPortCount;
+       //(GL-Backend) XvPort variable
        static int __baseXvPort;
        static bool __isPortGrabbed[_OVERLAYAGENT_XV_PORT];
 
-       // staticutil variable
+       // static util variable
+       static int __overlayAgentCount;
        static int __dstRectMinWidth;
        static int __dstRectMinHegith;
        static int __srcRectMinWidth;
@@ -206,6 +186,7 @@ private:
        static int __overlayHeightUnit;
        static int __overlayMaxCount;
        static bool __OverlayAgentBufferPixelFormat[_OVERLAY_AGENT_BUFFER_PIXEL_FORMAT_MAX];
+
 }; // _OverlayAgent
 
 }}} // Tizen::Ui::Controls
index 20d6bda..3c30065 100644 (file)
@@ -58,16 +58,9 @@ public:
        result GetBackgroundBufferInfo(Tizen::Graphics::BufferInfo& info) const;
        Tizen::Graphics::Color GetMaskingColor(void) const;
 
-       //virtual result OnAttaching(const Tizen::Ui::_Control* pParent);
-       virtual void OnDraw(void);
-       virtual void OnVisibleStateChanged(void);
-       //virtual result OnAttached(void);
        virtual result OnAttachedToMainTree(void);
        virtual void OnBoundsChanged(void);
 
-       virtual void OnChildDetached(const _Control& child);
-       virtual void OnChildAttached(const _Control& child);
-
 private:
        _OverlayPanel(void);
        _OverlayPanel(const _OverlayPanel& rhs);
index fada07d..8cccc7e 100644 (file)
@@ -69,7 +69,6 @@ public:
        Tizen::Graphics::Color GetMaskingColor(void) const;
 
        virtual void OnChangeLayout(_ControlOrientation orientation);
-
        virtual const char* GetPublicClassName(void) const;
 
        virtual const _OverlayPanel& GetCore(void) const;
@@ -82,7 +81,7 @@ public:
 
        static result SetPixelFormatList(void);
        static Tizen::Base::Collection::IListT<OverlayPanel::BufferPixelFormat>* GetSupportedBufferPixelFormatListN(void);
-       static result EvaluateBounds(Tizen::Ui::Controls::OverlayPanelEvaluationOption option, Tizen::Graphics::Rectangle& rect, bool& modified);
+       static result EvaluateBounds(Tizen::Ui::Controls::OverlayPanelEvaluationOption option, Tizen::Graphics::FloatRectangle& rect, bool& modified);
        static int GetWidthUnit(void);
        static int GetHeightUnit(void);
        static int GetMaxCount(void);
index 2911d08..e563b18 100644 (file)
 #define _FUI_CTRL_INTERNAL_OVERLAY_REGION_IMPL_H_
 
 #include <FOspConfig.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+
+namespace
+{
+       struct xmlParserDeleter
+       {
+               void operator()(xmlDoc* pXmlDoc)
+               {
+                       xmlFreeDoc(pXmlDoc);
+               }
+       };
+
+       class _OverlayRegionMediaCapability
+       {
+       public:
+               _OverlayRegionMediaCapability(void);
+               virtual ~_OverlayRegionMediaCapability(void);
+
+               result Construct(void);
+               result ParseCapability(const char* xmlBuffer, int length);
+               void ParseSection(xmlNodePtr pRoot, const Tizen::Base::String& section);
+
+               int cameraPrimaryDirection;
+               int cameraPrimaryRotation;
+               int cameraSecondaryDirection;
+               int cameraSecondaryRotation;
+       }; //_OverlayRegionMediaCapability
+}
 
 namespace Tizen { namespace Graphics
 {
@@ -35,6 +64,11 @@ class Rectangle;
 class Dimension;
 } }
 
+namespace Tizen { namespace Ui
+{
+class _Control;
+} }
+
 namespace Tizen { namespace Ui { namespace Controls
 {
 class OverlayRegion;
@@ -42,11 +76,6 @@ class _Form;
 class _OverlayAgent;
 } } }
 
-namespace Tizen { namespace Ui
-{
-class _Control;
-} }
-
 namespace Tizen { namespace Ui { namespace Controls
 {
 
@@ -67,9 +96,8 @@ public:
 
        Tizen::Graphics::FloatRectangle GetBounds(void) const;
        void GetBounds(float& x, float& y, float& width, float& height) const;
-       result SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, const Tizen::Graphics::Dimension& srcDim, OverlayRegionBufferPixelFormat srcFormat, bool isUserInput);
+       result SetInputBuffer(const Tizen::Base::ByteBuffer& srcBuffer, const Tizen::Graphics::Dimension& srcDim, OverlayRegionBufferPixelFormat srcFormat);
        result GetBackgroundBufferInfo(Tizen::Graphics::BufferInfo& info) const;
-       result Show(void) const;
 
        result Construct(_Form* pParentForm, OverlayRegionType overlayRegionType, const Tizen::Graphics::FloatRectangle& userDestRect, const Tizen::Graphics::FloatRectangle& overlayLogRect, const Tizen::Graphics::Rectangle& finalPhyRect);
 
@@ -80,7 +108,7 @@ public:
        void GoForeground(void);
        void GoBackground(void);
 
-       static result IsValidOverlayRect(Tizen::Graphics::Rectangle& userRect, Tizen::Graphics::Rectangle& overlayPhysicalRect, const Tizen::Graphics::Rectangle& basePhysicalRect, bool& modified);
+       static result IsValidBounds(const Tizen::Graphics::Rectangle& physicalBounds);
        static result SetPixelFormatList(void);
        static Tizen::Base::Collection::IListT< OverlayRegionBufferPixelFormat >* GetSupportedBufferPixelFormatListN(void);
 
@@ -100,11 +128,12 @@ private:
        Tizen::Ui::Controls::_OverlayAgent* __pOverlayAgent;
        Tizen::Graphics::FloatRectangle __destRect;
 
-       int __myIdx;
-       int __cameraDirection;
+       int __overlayRegionIndex;
+       bool __showState;
        int __cameraRotation;
 
-       bool __showState;
+       static int __primaryCameraRotation;
+       static int __secondaryCameraRotation;
        static bool __overlayRegionPixelFomatList[OVERLAY_REGION_BUFFER_PIXEL_FORMAT_MAX];
 
        friend class _Form;