#include <FBaseResult.h>
#include <FUiIOrientationEventListener.h>
+#include <FUiAnimDisplayContext.h>
#include <FGrp_BufferInfoImpl.h>
#include <FGrp_Screen.h>
#include <FIo_RegistryImpl.h>
#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"
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;
{
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);
}
}
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;
}
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;
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));
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();
__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);
__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);
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>*
}
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());
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;
}
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;
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;
}
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);
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);
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);
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);
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);
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);
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
#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>
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;
}
, __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)
{
}
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])
{
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;
}
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;
}
}
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++;
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;
void
_OverlayRegionImpl::SetFormArrayIndex(int index)
{
- __myIdx = index;
- return;
+ __overlayRegionIndex = index;
}
OverlayRegion*
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
}
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++)
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)
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;
}
_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");