Applied an workaround code regarding evas source visibility
authorBongjoo Seo <bongjoo.seo@samsung.com>
Fri, 29 Mar 2013 05:58:20 +0000 (14:58 +0900)
committerBongjoo Seo <bongjoo.seo@samsung.com>
Fri, 29 Mar 2013 05:58:20 +0000 (14:58 +0900)
Change-Id: I2c5852c31f9da7f02226094b8100cc23b03489ac
Signed-off-by: Bongjoo Seo <bongjoo.seo@samsung.com>
src/ui/animations/FUiAnim_AnimationManager.cpp
src/ui/animations/FUiAnim_Debug.cpp
src/ui/animations/FUiAnim_Debug.h
src/ui/animations/FUiAnim_EflNode.cpp
src/ui/animations/FUiAnim_EflVisualElementSurfaceImpl.cpp

index f328521..8596996 100644 (file)
@@ -94,9 +94,10 @@ namespace Tizen { namespace Ui { namespace Animations
 Eina_Bool
 __SigProcUser(void* pData, int type, void* pEvent)
 {
-       _VeDebug::DumpVeTree(0, 0);
-       _VeDebug::DumpEvasTree(0, 0);
-       _VeDebug::DumpAllEvas();
+       DumpVeTree();
+       DumpEvasTree();
+       DumpAllEvas();
+       DumpVeLayout();
 
        return ECORE_CALLBACK_PASS_ON;
 }
index 8d138a9..7f67f5b 100644 (file)
@@ -339,6 +339,112 @@ _VeDebug::DumpVisualElementLayout(_VisualElementImpl* pElement, FILE* pFile)
                                snprintf(logMessage, LOG_LEN_MAX, "%s%*s<div id=\"%#x\" style=\"%s\" title=\"%s\">\n", endTag, depth*4, " ", (unsigned int)pElement, style, title);
                                fputs(logMessage,pFile);
                        }
+
+                       Eina_List *pEvasObjects = evas_object_smart_members_get(pNativeNode->__pNativeSmartObject);
+                       void* pObject;
+                       EINA_LIST_FREE(pEvasObjects, pObject)
+                       {
+                       pEvasObject = (Evas_Object*)pObject;
+                       if (pEvasObject)
+                       {
+                               Dimension imageSize;
+                               Rectangle absolute;
+                               Rectangle relative;
+                               Rectangle filled;
+                               int red = 0;
+                               int green = 0;
+                               int blue = 0;
+                               int alpha = 0;
+                               unsigned int rgb = 0;
+                               const char* eoType = evas_object_type_get(pEvasObject);
+                               char style1[LOG_LEN_MAX] = {0, };
+                               char title1[LOG_LEN_MAX] = {0, };
+                               char style[LOG_LEN_MAX] = {0, };
+                               char title[LOG_LEN_MAX] = {0, };
+
+                               if (!pElement->GetName().IsEmpty())
+                               {
+                                       ByteBuffer* pByteBuffer(Tizen::Base::Utility::StringUtil::StringToUtf8N(pElement->GetName()));
+                                       evas_object_name_set(pEvasObject, (const char*)pByteBuffer->GetPointer());
+                                       delete pByteBuffer;
+                               }
+
+                               evas_object_geometry_get(pEvasObject, &absolute.x, &absolute.y, &absolute.width, &absolute.height);
+
+                               FloatRectangle realBounds = pElement->__bounds;
+                               _RootVisualElement* pRoot = dynamic_cast<_RootVisualElement*>(pElement->__pPublicInstance);
+                               if (pRoot)
+                               {
+                                       _NativeLayer* pLayer = pRoot->GetNativeLayer();
+                                       FloatRectangle rect = pLayer->GetBounds();
+                                       realBounds.x += rect.x;
+                                       realBounds.y += rect.y;
+                               }
+                               _VisualElementCoordinateSystem::ConvertDimensionToPhysical(realBounds.width, realBounds.height);
+                               _VisualElementCoordinateSystem::MakeIntegralPoint(realBounds.width, realBounds.height, relative.width, relative.height);
+                               _VisualElementCoordinateSystem::ConvertPointToPhysical(realBounds.x, realBounds.y);
+                               _VisualElementCoordinateSystem::MakeIntegralPoint(realBounds.x, realBounds.y, relative.x, relative.y);
+
+
+                               bool showState = pElement->GetShowState();
+                               bool visible = pElement->IsVisible();
+                               bool evasVisible = evas_object_visible_get(pEvasObject);
+
+                               if (!strcmp(eoType, "image"))
+                               {
+                                       char filename[LOG_LEN_MAX/4] = {0, };
+                                       char savePath[LOG_LEN_MAX/2] = {0, };
+                                       Evas_Object* pEvasObjectImage = pEvasObject;
+                                       Evas_Object* pSource = evas_object_image_source_get(pEvasObject);
+                                       if (pSource)
+                                       {
+                                               pEvasObjectImage = pSource;
+                                       }
+                                       evas_object_image_size_get(pEvasObjectImage, &imageSize.width, &imageSize.height);
+                                       evas_object_image_fill_get(pEvasObject, &filled.x, &filled.y, &filled.width, &filled.height);
+
+                                       if (name.GetLength() > 0)
+                                       {
+                                               sprintf(filename, "VE_%d_%ls_%08x.png", count, pElement->GetName().GetPointer(), (unsigned int)pElement->GetPresentation());
+                                       }
+                                       else
+                                       {
+                                               sprintf(filename, "VE_%d_%08x.png", count, (unsigned int)pElement->GetPresentation());
+                                       }
+
+                                       // save the image file
+                                       strncpy(savePath, "/tmp/layout/", 12);
+                                       strncat(savePath, filename, strlen(filename));
+                                       evas_object_image_save(pEvasObjectImage, savePath, NULL, "quality=100 compress=9");
+
+                                       snprintf(style1, LOG_LEN_MAX, "background-image:url(%s); ", filename);
+                                       snprintf(title1, LOG_LEN_MAX, "%s\nImage: w=%d h=%d\nEvas Absolute Bounds: x=%d y=%d w=%d h=%d\nVE Relative Bounds: x=%d y=%d w=%d h=%d\nFilled Bounds: x=%d y=%d w=%d h=%d\n",
+                                                        filename, relative.width, relative.height, absolute.x, absolute.y, absolute.width, absolute.height, relative.x, relative.y, relative.width, relative.height, filled.x, filled.y, filled.width, filled.height);
+                               }
+                               else
+                               {
+                                       evas_object_color_get(pEvasObject, &red, &green, &blue, &alpha);
+                                       rgb = (((red << 16) & 0x00ff0000) | ((green << 8) & 0x0000ff00) | (blue & 0x000000ff));
+                                       if (alpha)
+                                       {
+                                               snprintf(style1, LOG_LEN_MAX, "background-color:#%06x; ", rgb);
+                                       }
+                                       else
+                                       {
+                                               //snprintf(style1, LOG_LEN_MAX, "pointer-events: none; ");
+                                       }
+                                       snprintf(title1, LOG_LEN_MAX, "No Surface\nColor: #%06x Alpha: %02x\nEvas Absolute Bounds: x=%d y=%d w=%d h=%d\nVE Relative Bounds: x=%d y=%d w=%d h=%d\n", rgb, alpha, absolute.x, absolute.y, absolute.width, absolute.height, relative.x, relative.y, relative.width, relative.height);
+                               }
+
+                               snprintf(title, LOG_LEN_MAX, "%s\nname=%ls\nshow=%s visible=%s evas=%s\nmodel=%#x\npresentation=%#x\nparent=%#x\nevas_object=%#x\nclip-source=%#x",
+                                                title1, name.GetPointer(), showState ? "true" : "false", visible ? "true" : "false", evasVisible ? "show" : "hide", (unsigned int)pModel, (unsigned int)pPresentation, (unsigned int)pElement->GetParent(), (unsigned int)pEvasObject, (unsigned int)pElement->GetClipSource());
+                               snprintf(style, LOG_LEN_MAX, "%sopacity:%.2f; position:absolute; left:%dpx; top:%dpx; width:%dpx; height:%dpx; border:1px dotted #aaaaaa; z-index:%d; display:%s;%s",
+                                                style1, (pElement->__opacity), relative.x, relative.y, relative.width, relative.height, depth, (showState ? "block" : "none"), (pElement->__isClipChildren ? " overflow:hidden;" : ""));
+
+                               snprintf(logMessage, LOG_LEN_MAX, "%s%*s<div id=\"%#x\" style=\"%s\" title=\"%s\">\n", endTag, depth*4, " ", (unsigned int)pElement, style, title);
+                               fputs(logMessage,pFile);
+                       }
+                       }
                }
        }
 
@@ -1173,20 +1279,16 @@ _VeDebug::DumpEvasTreeGraph(const char* pFilePath, VisualElement* pVisualElement
 }
 
 void
-_VeDebug::DumpAllEvas(void)
+_VeDebug::DumpAllEvas(Evas* pEvas)
 {
        Eina_List*      pEvasObjects = null;
        void* pObject = null;
        Evas_Object* pEvasObject = null;
 //     int w, h;
 
-       if (GetEcoreEvasMgr() && GetEcoreEvasMgr()->GetEcoreEvas() && GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas())
+       if (pEvas)
        {
-//             evas_output_size_get(GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas(), &w, &h);
-
-               pEvasObjects = evas_objects_in_rectangle_get(
-                       GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas(),
-//                     0, 0, w, h,
+               pEvasObjects = evas_objects_in_rectangle_get(pEvas,
                        -99999, -99999, 99999 * 2, 99999 * 2,
                        1, 1
                );
@@ -1242,6 +1344,67 @@ _VeDebug::DumpAllEvas(void)
 }
 
 void
+_VeDebug::DumpAllEvasImages(Evas *pEvas)
+{
+       Eina_List*      pEvasObjects = null;
+       void* pObject = null;
+       Evas_Object* pEvasObject = null;
+       static int count = 0;
+       char filename[2048] = {0, };
+       const char* pathPrefix = "/tmp/";
+
+       if (pEvas)
+       {
+               pEvasObjects = evas_objects_in_rectangle_get(pEvas,
+                       -99999, -99999, 99999 * 2, 99999 * 2,
+                       1, 1
+               );
+       }
+
+       if (!pEvasObjects)
+       {
+               return;
+       }
+
+       VeLog(NID_UI_ANIM, "--------------------------[EVAS ALL DUMP IMAGE START]-----------------------------");
+
+       pEvasObject = null;
+       EINA_LIST_FREE(pEvasObjects, pObject)
+       {
+               if (likely(pObject))
+               {
+                       pEvasObject = (Evas_Object*)pObject;
+
+                       Tizen::Base::String type(evas_object_type_get(pEvasObject));
+
+                       if (type == "image")
+                       {
+                               Evas_Object* pSource = evas_object_image_source_get(pEvasObject);
+                               pEvasObject = pSource ? pSource : pEvasObject;
+
+                               if (pEvasObject)
+                               {
+                                       sprintf(filename, "%sEVAS_%d_%08x.png", pathPrefix, count++, (unsigned int)pEvasObject);
+
+                                       VeLog(NID_UI_ANIM, "--------------------------[VE DUMP IMAGE START %#08x]---------------------------", (unsigned int)pEvasObject);
+                                       if (evas_object_image_save(pEvasObject, filename, NULL, "quality=100 compress=9"))
+                                       {
+                                               evas_object_image_save(pEvasObject, "/tmp/lastimage.png", NULL, "quality=100 compress=9");
+                                               VeLog(NID_UI_ANIM, "--------------------------[VE DUMP IMAGE END]-----------------------------");
+                                       }
+                                       else
+                                       {
+                                               VeLog(NID_UI_ANIM, "--------------------------[VE DUMP IMAGE ERROR!!!]-----------------------------");
+                                       }
+                               }
+                       }
+               }
+       }
+
+       VeLog(NID_UI_ANIM, "--------------------------[EVAS ALL DUMP IMAGE END]-----------------------------");
+}
+
+void
 _VeDebug::PrintVeTree(_VisualElementImpl* pElement, int depth, unsigned int remainingChild)
 {
        static Tizen::Base::String output = "";
@@ -1607,7 +1770,53 @@ DumpAllVeImages(void)
 extern "C" _OSP_EXPORT_ void
 DumpAllEvas(void)
 {
-       Tizen::Ui::Animations::_VeDebug::DumpAllEvas();
+       Tizen::Ui::Animations::_DisplayManager* pDisplayManager = Tizen::Ui::Animations::_DisplayManager::GetInstance();
+
+       for (int i = 0; i < pDisplayManager->GetRootCount(); i++)
+       {
+               Tizen::Ui::Animations::_RootVisualElement* pRoot = pDisplayManager->GetRoot(i);
+               if (!pRoot)
+               {
+                       continue;
+               }
+               Tizen::Ui::Animations::_EflLayer* pLayer = dynamic_cast<Tizen::Ui::Animations::_EflLayer*>(pRoot->GetNativeLayer());
+               if (!pLayer)
+               {
+                       continue;
+               }
+               Evas* pEvas = pLayer->GetEvas();
+               if (!pEvas)
+               {
+                       continue;
+               }
+               Tizen::Ui::Animations::_VeDebug::DumpAllEvas(pEvas);
+       }
+}
+
+extern "C" _OSP_EXPORT_ void
+DumpAllEvasImages(void)
+{
+       Tizen::Ui::Animations::_DisplayManager* pDisplayManager = Tizen::Ui::Animations::_DisplayManager::GetInstance();
+
+       for (int i = 0; i < pDisplayManager->GetRootCount(); i++)
+       {
+               Tizen::Ui::Animations::_RootVisualElement* pRoot = pDisplayManager->GetRoot(i);
+               if (!pRoot)
+               {
+                       continue;
+               }
+               Tizen::Ui::Animations::_EflLayer* pLayer = dynamic_cast<Tizen::Ui::Animations::_EflLayer*>(pRoot->GetNativeLayer());
+               if (!pLayer)
+               {
+                       continue;
+               }
+               Evas* pEvas = pLayer->GetEvas();
+               if (!pEvas)
+               {
+                       continue;
+               }
+               Tizen::Ui::Animations::_VeDebug::DumpAllEvasImages(pEvas);
+       }
 }
 
 extern "C" _OSP_EXPORT_ void
index 93356c7..ea13c87 100644 (file)
 //#define VE_DEBUG // debug config
 #define VE_DEBUG_MODULE
 
+extern "C" _OSP_EXPORT_ void DumpAllEvas(void);
+extern "C" _OSP_EXPORT_ void DumpVeTree(void);
+extern "C" _OSP_EXPORT_ void DumpEvasTree(void);
+extern "C" _OSP_EXPORT_ void DumpVeLayout(void);
+
 namespace Tizen { namespace Ui { namespace Animations
 {
 
@@ -143,7 +148,8 @@ public:
        static bool IsDebugEnabled(void);
 
        static void DumpEvasTree(_VisualElementImpl* pElement, int indent);
-       static void DumpAllEvas(void);
+       static void DumpAllEvas(Evas* pEvas);
+       static void DumpAllEvasImages(Evas* pEvas);
 
        static void DumpEvasObjectForGraphI(FILE* pFile, Evas_Object* pEvasObject, int depth, int pos);
        static void DumpEvasTreeGraphI(FILE* pFile, Evas_Object* pObject, int depth, int pos);
index 403cf3b..5264e94 100644 (file)
@@ -337,6 +337,11 @@ _EflNode::RebuildIfNeeded(const _INativeNode& parent)
 result
 _EflNode::ReConstruct(const _NativeLayer& layer)
 {
+       if (__pLayer == &layer)
+       {
+               return E_SUCCESS;
+       }
+
        _EflLayer* pLayer = dynamic_cast<_EflLayer*>(const_cast<_NativeLayer*>(&layer));
        if (!pLayer)
        {
@@ -953,9 +958,11 @@ _EflNode::Reconfigure(VisualElementSurface* pSurface, _VisualElementImpl& elemen
                                        _EflVisualElementSurfaceImpl* pEflVisualElementSurfaceImpl = dynamic_cast<_EflVisualElementSurfaceImpl*>(_VisualElementSurfaceImpl::GetInstance(*pSurface));
                                        if (pEflVisualElementSurfaceImpl && pEflVisualElementSurfaceImpl->__pBuffer != null)
                                        {
-                                               evas_object_show(pImageObjectNew);
                                                evas_object_image_source_set(pImageObject, pImageObjectNew);
+#if 0
+                                               evas_object_show(pImageObjectNew);
                                                evas_object_image_source_visible_set(pImageObject, EINA_FALSE);
+#endif
                                        }
 
                                        //evas_object_pass_events_set(pImageObject, EINA_TRUE);
index 6b3e7e9..30cc3fa 100644 (file)
@@ -86,7 +86,10 @@ _EflVisualElementSurfaceImpl::_EflVisualElementSurfaceImpl(const Handle layer, c
 
        evas_object_resize(__pEvasImage, outputSize.width, outputSize.height);
        evas_object_image_data_set(__pEvasImage, reinterpret_cast<void*>(__pBuffer));
-       //evas_object_show(__pEvasImage);
+#if 1 // Todo : Temporary code(regarding the visibility of evas source object)
+       evas_object_show(__pEvasImage);
+       evas_object_move(__pEvasImage, -999999, -999999);
+#endif
        return;
 
 CATCH:
@@ -108,7 +111,10 @@ _EflVisualElementSurfaceImpl::_EflVisualElementSurfaceImpl(const Handle layer, c
                __pEvasImage = reinterpret_cast<Evas_Object*>(object);
        }
        SysTryReturnVoidResult(NID_UI_ANIM, __pEvasImage, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Failed to create a new surface.");
-       //evas_object_show(__pEvasImage);
+#if 1 // Todo : Temporary code(regarding the visibility of evas source object)
+       evas_object_show(__pEvasImage);
+       evas_object_move(__pEvasImage, -999999, -999999);
+#endif
 }
 
 result
@@ -140,16 +146,17 @@ _EflVisualElementSurfaceImpl::SetImage(const String& fileName)
 
 _EflVisualElementSurfaceImpl::~_EflVisualElementSurfaceImpl(void)
 {
-       if (__pBuffer != null)
+       if (__pEvasImage != null)
        {
+               evas_object_hide(__pEvasImage);
                evas_object_image_data_set(__pEvasImage, null);
-               delete []__pBuffer;
+               evas_object_del(__pEvasImage);
+               evas_object_smart_member_del(__pEvasImage);
        }
 
-       if (__pEvasImage != null)
+       if (__pBuffer != null)
        {
-               evas_object_smart_member_del(__pEvasImage);
-               evas_object_del(__pEvasImage);
+               delete []__pBuffer;
        }
 
        __pBuffer = null;