2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUiAnim_Debug.cpp
20 * @brief This file contains implementation of _VeDebug class
22 * This file contains implementation _VeDebug class.
25 #ifdef VE_DEBUG_MODULE
30 #include <FBaseString.h>
31 #include <FBaseSysLog.h>
32 #include <FBase_Log.h>
33 #include <FBaseByteBuffer.h>
34 #include <FBaseUtilStringUtil.h>
37 #include <FUiCtrlHeader.h>
38 #include <FUiCtrlFooter.h>
41 #include "FUiAnim_VisualElementImpl.h"
42 #include "FUiAnim_RootVisualElement.h"
43 #include "FUiAnim_VisualElementSharedData.h"
44 #include "FUiAnim_VisualElementSurfaceImpl.h"
45 #include "FUiAnim_Debug.h"
47 #ifdef VE_DEBUG_MODULE
50 #include "FUi_ControlImpl.h"
51 #include "FUiCtrl_Label.h"
52 #include "FUiCtrl_Button.h"
53 #include "FUiCtrl_Edit.h"
54 #include "FUiCtrl_Popup.h"
57 #include "FUiAnim_EflNode.h"
58 #include "FUiAnim_AnimationManager.h"
59 #include "FUiAnim_DisplayManager.h"
61 #include "FUi_EcoreEvas.h"
62 #include "FUi_EcoreEvasMgr.h"
65 using namespace Tizen::Base;
67 namespace Tizen { namespace Ui { namespace Animations
71 int _ElapsedTime::depth = 0;
72 char _ElapsedTime::logs[500][256];
73 int _ElapsedTime::maxdepth = 0;
74 int _ElapsedTime::count = 0;
77 #define DIGITATPOSITION(number, digit) static_cast< int >((number % static_cast< int >(powf(10.0f, (digit)))) / powf(10.0f, (digit - 1)))
79 bool _VeDebug::__veDebugEnabled = false;
82 _VeDebug::SetDebugEnabled(bool enable)
84 __veDebugEnabled = enable;
88 _VeDebug::IsDebugEnabled(void)
90 return __veDebugEnabled;
94 _VeDebug::DumpVisualElement(_VisualElementImpl* pElement, const char* func, int line, const char* fmt, ...)
99 int nativeVisible = -1;
100 _VisualElementImpl* pDepth = null;
101 _VisualElementImpl* pModel = null;
102 _VisualElementImpl* pPresentation = null;
103 char logPlaceMessage[LOG_LEN_MAX] = { 0, };
104 char logMessage[LOG_LEN_MAX] = {0, };
105 char logSpaces[LOG_LEN_MAX] = { 0, };
118 pDepth = pDepth->__pParent;
121 if (pElement->GetModel() == pElement) // presenter
123 pModel = pElement->GetModel();
124 pPresentation = pElement->GetPresentation();
129 pPresentation = pElement;
132 if (pPresentation && pPresentation->__pSharedData->pNativeNode)
134 VisualElementSurface* pSurface = dynamic_cast< VisualElementSurface* >(pPresentation->__pSharedData->pNativeNode->GetSurface());
135 if (pSurface && _VisualElementSurfaceImpl::GetInstance(*pSurface))
137 nativeVisible = evas_object_visible_get(reinterpret_cast< Evas_Object* >(_VisualElementSurfaceImpl::GetInstance(*pSurface)->GetNativeHandle()));
143 snprintf(logPlaceMessage, sizeof(logPlaceMessage), "(%s:%4d)", func, line);
146 snprintf(logSpaces, sizeof(logSpaces), "%*s", depth * 3, " ");
148 Tizen::Base::String name = pElement->GetSharedData().name;
151 Tizen::Ui::_Control* pControl = null;
152 Tizen::Ui::_ControlImpl* pCtrlImpl = null;
154 pControl = dynamic_cast< Tizen::Ui::_Control* >(static_cast< Tizen::Ui::_Control* >(pElement->GetUserData()));
157 pCtrlImpl = dynamic_cast< Tizen::Ui::_ControlImpl* >(static_cast< Tizen::Ui::_ControlImpl* >(pControl->GetUserData()));
160 name = name + L", " + pCtrlImpl->GetPublicClassName();
163 Tizen::Ui::Controls::_Label* pLabel = null;
164 Tizen::Ui::Controls::_Edit* pEdit = null;
165 Tizen::Ui::Controls::_Button* pButton = null;
166 Tizen::Ui::Controls::_Popup* pPopup = null;
167 Tizen::Ui::Controls::Form* pForm = null;
168 Tizen::Ui::Controls::Header* pHeader = null;
169 Tizen::Ui::_Window* pWindow = null;
171 pLabel = dynamic_cast< Tizen::Ui::Controls::_Label* >(pControl);
174 name = name + L", '" + pLabel->GetText() + L"'";
177 pEdit = dynamic_cast< Tizen::Ui::Controls::_Edit* >(pControl);
180 name = name + L", '" + pEdit->GetText() + L"'";
183 pButton = dynamic_cast< Tizen::Ui::Controls::_Button* >(pControl);
186 name = name + L", '" + pButton->GetText() + L"'";
189 pPopup = dynamic_cast< Tizen::Ui::Controls::_Popup* >(pControl);
192 name = name + L", '" + pPopup->GetTitleText() + L"'";
195 pWindow = dynamic_cast< Tizen::Ui::_Window* >(pControl);
198 name = name + L", '_Window'";
201 pForm = dynamic_cast< Tizen::Ui::Controls::Form* >(pControl);
204 name = name + L", '" + pForm->GetTitleText() + L"'";
207 pHeader = dynamic_cast< Tizen::Ui::Controls::Header* >(pControl);
210 name = name + L", '" + pHeader->GetTitleText() + L"'";
216 #define TERMCOLOR_FMT //"%c[%d;%d;%dm"
218 len = snprintf(logMessage, sizeof(logMessage),
219 TERMCOLOR_FMT "\n%4d = %2d%s:" TERMCOLOR_FMT "\n%s - [VE(%ls): 0x%08lx->0x%08lx]%s\n%s - [show:%s, %s, %d] [op=%.1f, %.1f, %.1f, %.1f] [%s] [0x%x, "
220 "0x%x, 0x%x %s=%p]\n%s - bounds=" VELOGRECTTAG " invRect=" VELOGRECTTAG " vRect=" VELOGRECTTAG,
223 (pElement != pElement->__pModel ? "P" : " "),
226 name.GetPointer(), //(pElement->__pSharedData ? pElement->__pSharedData->name.GetPointer() : L" "),
227 (unsigned long) pModel, (unsigned long) pPresentation,
230 (pElement->GetShowState() ? "show" : "hide"), (pElement->IsVisible() ? " visible" : "invisible"), nativeVisible,
231 pElement->__showOpacity, pElement->__opacity, pElement->__contentOpacity, pElement->GetOpacityFromRoot(),
232 (pElement->__pSharedData->pSurface ? " sfc" : "nosfc"),
233 pElement->__invalidatedProps,
234 pElement->__childrenNeedsUpdateProps,
235 pElement->__pSharedData->invalidatedNativeProps, (pElement->__isClipChildren ? "CS" : "NOCS"),
236 pElement->__pClipSource,
238 VELOGRECT(pElement->__bounds),
239 VELOGRECT(pElement->__pSharedData->invalidatedRegion),
240 VELOGRECT(pElement->__visibleRect)
246 vsnprintf(&logMessage[len], sizeof(logMessage) - len, fmt, args);
249 //VeLog(NID_UI_ANIM, "%s", logMessage);
252 if (pElement == pPresentation && pElement->__pSharedData->pNativeNode)
254 _EflNode* pNativeNode = dynamic_cast< _EflNode* >(pPresentation->__pSharedData->pNativeNode);
257 Evas_Object* pEvasObject = null;
259 if (pNativeNode->GetSurface() && _VisualElementSurfaceImpl::GetInstance(*pNativeNode->GetSurface()))
261 pEvasObject = reinterpret_cast< Evas_Object* >(_VisualElementSurfaceImpl::GetInstance(*pNativeNode->GetSurface())->GetNativeHandle());
265 pEvasObject = pNativeNode->__pRectangleObject;
285 const char* eoType = evas_object_type_get(pEvasObject);
287 if (!pElement->GetName().IsEmpty())
289 ByteBuffer* pByteBuffer(Tizen::Base::Utility::StringUtil::StringToUtf8N(pElement->GetName()));
290 evas_object_name_set(pEvasObject, (const char*)pByteBuffer->GetPointer());
295 if (!strcmp(eoType, "image"))
297 if (evas_object_image_source_get(pEvasObject))
299 evas_object_image_size_get(evas_object_image_source_get(pEvasObject), &iw, &ih);
303 evas_object_image_size_get(pEvasObject, &iw, &ih);
305 evas_object_image_fill_get(pEvasObject, &fx, &fy, &fw, &fh);
308 evas_object_geometry_get(pEvasObject, &ox, &oy, &ow, &oh);
309 evas_object_color_get(pEvasObject, &red, &green, &blue, &alpha);
310 argb = (((alpha << 24) & 0xff000000) | ((red << 16) & 0x00ff0000) | ((green << 8) & 0x0000ff00) | (blue & 0x000000ff));
311 bool showState = evas_object_visible_get(pEvasObject);
313 len = strlen(logMessage);
314 snprintf(&logMessage[len], sizeof(logMessage) - len, "%s - type=%s[%p] bounds=[%d:%d ~ %d:%d] fill=[%d:%d ~ %d:%d] imgsize=[%d:%d] show=%s color=%08X",
315 logSpaces, evas_object_type_get(pEvasObject), pEvasObject, ox, oy, ox + ow, oy + oh, fx, fy, fx + fw, fy + fh, iw, ih, (showState ? "visible" : "invisible"), argb);
317 //VeLog(NID_UI_ANIM, "%s", logMessage);
322 VeLog(NID_UI_ANIM, "%s", logMessage);
328 _VeDebug::DumpVeTree(_VisualElementImpl* pElement, int indent)
332 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
333 if (pDisplayManager != null && pDisplayManager->GetRoot(0))
335 pElement = _VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(0));
339 bool prevDebugEnabled = IsDebugEnabled();
340 SetDebugEnabled(true);
346 VeLog(NID_UI_ANIM, "--------------------------[VE DUMP START]---------------------------");
349 VELOGEX_NOFUNCTION(pElement, "");
350 VELOGEX_NOFUNCTION(pElement->__pPresentation, "\n");
352 int count = pElement->__children.GetCount();
353 for (int i = 0; i < count; i++)
355 _VeDebug::DumpVeTree(pElement->__children.GetChildAt(i), indent + 3);
360 VeLog(NID_UI_ANIM, "--------------------------[VE DUMP END]-----------------------------");
362 extern int sfc_memory_usage;
363 VeLog(NID_UI_ANIM, "--------------------------[IMAGE SIZE=%d KB]-----------------------------", sfc_memory_usage / 1024);
368 SetDebugEnabled(prevDebugEnabled);
375 _VeDebug::DumpEvasTree(_VisualElementImpl* pElement, int indent)
379 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
380 if (pDisplayManager != null && pDisplayManager->GetRoot(0))
382 pElement = _VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(0));
386 bool prevDebugEnabled = IsDebugEnabled();
387 SetDebugEnabled(true);
393 VeLog(NID_UI_ANIM, "--------------------------[EVAS DUMP START]---------------------------");
396 //VELOGEX_NOFUNCTION(pElement, "");
397 //VELOGEX_NOFUNCTION(pElement->__pPresentation, "\n");
399 DumpEvasTreeI((Evas_Object*)((_EflNode*)pElement->__pSharedData->pNativeNode)->GetGroupContainer(), indent);
403 VeLog(NID_UI_ANIM, "--------------------------[EVAS DUMP END]-----------------------------");
407 SetDebugEnabled(prevDebugEnabled);
414 _VeDebug::DumpEvasTreeI(Evas_Object* pParent, int indent)
421 bool prevDebugEnabled = IsDebugEnabled();
422 SetDebugEnabled(true);
424 char logMessage1[LOG_LEN_MAX] = { 0, };
425 char logMessage2[LOG_LEN_MAX] = { 0, };
426 char logSpaces[LOG_LEN_MAX] = { 0, };
451 int renderOperation = 0;
452 bool mshowState = false;
453 bool sshowState = false;
454 void* pBuffer = null;
455 Tizen::Base::String type(evas_object_type_get(pParent));
456 evas_object_geometry_get(pParent, &mox, &moy, &mow, &moh);
458 // color & show state
459 renderOperation = evas_object_render_op_get(pParent);
460 evas_object_color_get(pParent, &red, &green, &blue, &alpha);
461 argb = (((alpha << 24) & 0xff000000) | ((red << 16) & 0x00ff0000) | ((green << 8) & 0x0000ff00) | (blue & 0x000000ff));
462 mshowState = evas_object_visible_get(pParent);
464 if (type != "visual_element")// && argb != 0)
466 bool clip = evas_object_clip_get(pParent) ? true : false;
469 snprintf(logSpaces, sizeof(logSpaces), "%*s", indent, " ");
475 if (evas_object_clipees_get(pParent))
480 snprintf(logMessage1, sizeof(logMessage1),
481 "%s[%#x][%c] : %ls(%s) fill(%d,%d,%d,%d) bounds(%d,%d,%d,%d) argb(0x%08x) %s clip=%s show=%s",
482 logSpaces, (unsigned int)pParent, source, type.GetPointer(), evas_object_name_get(pParent), mfx, mfy, mfw, mfh, mox, moy, mow, moh,
483 (unsigned int)argb, (renderOperation ? "COPY" : "BLEND"), (clip ? "true" : "false"), (mshowState ? "true" : "false")
486 VeLog(NID_UI_ANIM, "%s", logMessage1);
491 evas_object_image_fill_get(pParent, &mfx, &mfy, &mfw, &mfh);
494 Evas_Object* pSource = evas_object_image_source_get(pParent);
495 pSource = pSource ? pSource : pParent;
497 evas_object_image_size_get(pSource, &iw, &ih);
498 pBuffer = (void*)evas_object_image_data_get(pSource, EINA_FALSE);
499 evas_object_geometry_get(pSource, &sox, &soy, &sow, &soh);
500 evas_object_image_fill_get(pSource, &sfx, &sfy, &sfw, &sfh);
501 sshowState = evas_object_visible_get(pSource);
503 snprintf(logMessage2, sizeof(logMessage2),
504 "%s[%#x][%c] : %ls(%s:%#x %d,%d) fill(%d,%d,%d,%d) bounds(%d,%d,%d,%d) argb(0x%08x) %s show=%s",
505 logSpaces, (unsigned int)pSource, source, type.GetPointer(), evas_object_name_get(pParent), (unsigned int)pBuffer, iw, ih, sfx, sfy, sfw, sfh, sox, soy, sow, soh,
506 (unsigned int)argb, (renderOperation ? "COPY" : "BLEND"), (sshowState ? "true" : "false")
509 VeLog(NID_UI_ANIM, "%s", logMessage2);
514 void* pObject = null;
515 Eina_List* pList = evas_object_smart_members_get(pParent);
516 EINA_LIST_FREE(pList, pObject)
520 DumpEvasTreeI((Evas_Object*)pObject, indent+2);
524 SetDebugEnabled(prevDebugEnabled);
530 _VeDebug::DumpEvasObjectForGraphI(FILE* pFile, Evas_Object* pEvasObject, int depth, int pos)
537 Tizen::Base::String typeName(evas_object_type_get(pEvasObject));
543 evas_object_geometry_get(pEvasObject, &objX, &objY, &objW, &objH);
545 Evas_Object* pClipper = evas_object_clip_get(pEvasObject);
546 const Evas_Map* pMap = evas_object_map_get(pEvasObject);
547 Evas_Render_Op renderOp = evas_object_render_op_get(pEvasObject);
553 evas_object_color_get(pEvasObject, &r, &g, &b, &a);
555 int visible = evas_object_visible_get(pEvasObject);
557 Tizen::Base::String output;
558 Tizen::Base::String label;
559 Tizen::Base::String common;
560 Tizen::Base::String type;
561 Tizen::Base::String order;
562 Tizen::Base::String clipper;
563 Tizen::Base::String map;
564 Tizen::Base::String bounds;
565 Tizen::Base::String showState;
566 Tizen::Base::String rop;
567 Tizen::Base::String color;
568 Tizen::Base::String imageSize;
569 Tizen::Base::String imageFill;
570 Tizen::Base::String imageSource;
573 type.Format(256, L"<TD>type</TD> <TD>%ls</TD>", typeName.GetPointer());
574 order.Format(256, L"<TD>order</TD> <TD>%d-%d</TD>", depth, pos);
575 clipper.Format(256, L"<TD>clipper</TD> <TD PORT=\"clipper\">%x</TD>", pClipper);
576 map.Format(256, L"<TD>map</TD> <TD>%ls</TD>", (pMap ? L"used" : L"unused"));
577 bounds.Format(256, L"<TD>bounds</TD> <TD>%d : %d ~ %d : %d</TD>", objX, objY, objX + objW, objY + objH);
578 showState.Format(256, L"<TD>showState</TD> <TD>%ls</TD>", (visible ? L"show" : L"hidden"));
579 rop.Format(256, L"<TD>rop</TD> <TD>%d</TD>", renderOp);
580 color.Format(256, L"<TD>color</TD> <TD>0x%08x</TD>", (a << 24) | (r << 16) | (g << 8) | b);
583 if (typeName == "image")
587 evas_object_image_size_get(pEvasObject, &iw, &ih);
592 evas_object_image_fill_get(pEvasObject, &fillX, &fillY, &fillW, &fillH);
593 Evas_Object* pSource = evas_object_image_source_get(pEvasObject);
595 imageSize.Format(256, L"<TD>imageSize</TD> <TD>%d:%d</TD>", iw, ih);
596 imageFill.Format(256, L"<TD>fill</TD> <TD>%d : %d ~ %d : %d</TD>", fillX, fillY, fillX + fillW, fillY + fillH);
597 imageSource.Format(256, L"<TD PORT=\"proxy\">source</TD> <TD>N%lx</TD>", pSource);
601 DumpEvasObjectForGraphI(pFile, pSource, depth, pos);
602 fprintf(pFile, "N%lx:proxy -> N%lx [style=dashed, label=source];\n", (unsigned long)pEvasObject, (unsigned long)pSource);
607 label = L"<TR>" + type + L"</TR>";
608 label += L"<TR>" + order + L"</TR>";
609 label += L"<TR>" + clipper + L"</TR>";
610 label += L"<TR>" + map + L"</TR>";
611 label += L"<TR>" + bounds + L"</TR>";
612 label += L"<TR>" + showState + L"</TR>";
613 label += L"<TR>" + rop + L"</TR>";
614 label += L"<TR>" + color + L"</TR>";
616 if (!imageSize.IsEmpty())
618 label += L"<TR>" + imageSize + L"</TR>";
621 if (!imageFill.IsEmpty())
623 label += L"<TR>" + imageFill + L"</TR>";
626 if (!imageSource.IsEmpty())
628 label += L"<TR>" + imageSource + L"</TR>";
631 output.Format(1024, L"N%lx [ fillcolor=\"#%06x\", style=filled, label=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"3\">%ls</TABLE>>];\n",
632 (unsigned long)pEvasObject,
637 fprintf(pFile, "%ls", output.GetPointer());
642 fprintf(pFile, "N%lx:clipper -> N%lx [style=\"dotted\", label=clipper]; \n",
643 (unsigned long)pEvasObject,
644 (unsigned long)pClipper
650 _VeDebug::DumpEvasTreeGraphI(FILE* pFile, Evas_Object* pObject, int depth, int pos)
657 bool prevDebugEnabled = IsDebugEnabled();
658 SetDebugEnabled(true);
660 DumpEvasObjectForGraphI(pFile, pObject, depth, pos);
664 Eina_List* pList = evas_object_smart_members_get(pObject);
665 EINA_LIST_FREE(pList, pChild)
669 DumpEvasTreeGraphI(pFile, (Evas_Object*)pChild, depth + 1, pos++);
670 fprintf(pFile, "N%lx -> N%lx [style=\"solid,bold\"] \n", (unsigned long)pChild, (unsigned long)pObject);
674 SetDebugEnabled(prevDebugEnabled);
678 _VeDebug::DumpVeObjectForGraphI(FILE* pFile, _VisualElementImpl* pVisualElementImpl, int depth, int pos)
680 if (!pVisualElementImpl)
685 bool isModel = (pVisualElementImpl == pVisualElementImpl->__pModel);
686 bool isPresentation = (pVisualElementImpl == pVisualElementImpl->__pPresentation);
688 Tizen::Base::String output;
689 Tizen::Base::String label;
690 Tizen::Base::String model;
691 Tizen::Base::String name;
692 Tizen::Base::String order;
693 Tizen::Base::String clip;
694 Tizen::Base::String transformed;
695 Tizen::Base::String show;
696 Tizen::Base::String visible;
697 Tizen::Base::String ror;
698 Tizen::Base::String opacity;
699 Tizen::Base::String showOpacity;
700 Tizen::Base::String opacityFromRoot;
701 Tizen::Base::String bounds;
702 Tizen::Base::String invBounds;
703 Tizen::Base::String rop;
704 const Tizen::Graphics::FloatRectangle& boundsRect = pVisualElementImpl->__bounds;
705 const Tizen::Graphics::FloatRectangle& invBoundsRect = pVisualElementImpl->GetSharedData().invalidatedRegion;
707 model.Format(256, L"<TD>type</TD> <TD>%ls</TD>", (isModel ? L"Model" : isPresentation ? L"Presentation" : L"<unknown>"));
708 name.Format(256, L"<TD>name</TD> <TD>%ls</TD>", pVisualElementImpl->GetSharedData().name.GetPointer());
709 order.Format(256, L"<TD>order</TD> <TD>%d-%d</TD>", depth, pos);
710 clip.Format(256, L"<TD>clip</TD> <TD>%ls</TD>", (pVisualElementImpl->__isClipChildren ? L"CS" : L"NO-CS"));
711 transformed.Format(256, L"<TD>xform</TD> <TD>%ls</TD>", (pVisualElementImpl->__needTransform ? L"NO-AA" : L"AA"));
712 show.Format(256, L"<TD>showState</TD> <TD>%ls</TD>", (pVisualElementImpl->GetShowState() ? L"show" : L"hidden"));
713 visible.Format(256, L"<TD>visibility</TD> <TD>%ls</TD>", (pVisualElementImpl->IsVisible() ? L"visible" : L"invisible"));
714 ror.Format(256, L"<TD>redrawOnResize</TD> <TD>%ls</TD>", (pVisualElementImpl->GetRedrawOnResizeEnabled() ? L"ROR" : L"NO-ROR"));
715 opacity.Format(256, L"<TD>opacity</TD> <TD>%3.1f</TD>", pVisualElementImpl->GetOpacity());
716 showOpacity.Format(256, L"<TD>showOpacity</TD> <TD>%3.1f</TD>", pVisualElementImpl->__showOpacity);
717 opacityFromRoot.Format(256, L"<TD>visOpacity</TD> <TD>%3.1f</TD>", pVisualElementImpl->GetOpacityFromRoot());
718 bounds.Format(256, L"<TD>bounds</TD> <TD>%.2f : %.2f ~ %.2f : %.2f</TD>", boundsRect.x, boundsRect.y, boundsRect.x + boundsRect.width, boundsRect.y + boundsRect.height);
719 invBounds.Format(256, L"<TD>invBounds</TD> <TD>%.2f : %.2f ~ %.2f : %.2f</TD>", invBoundsRect.x, invBoundsRect.y, invBoundsRect.x + invBoundsRect.width, invBoundsRect.y + invBoundsRect.height);
720 rop.Format(256, L"<TD>rop</TD> <TD>%d</TD>", pVisualElementImpl->__renderOperation);
723 long color = (isModel ? 0xF0FFF0 : isPresentation ? 0xE6E6FA : 0x708090);
725 label = L"<TR>" + model + L"</TR>";
726 label += L"<TR>" + name + L"</TR>";
727 label += L"<TR>" + order + L"</TR>";
728 label += L"<TR>" + clip + L"</TR>";
729 label += L"<TR>" + transformed + L"</TR>";
730 label += L"<TR>" + show + L"</TR>";
731 label += L"<TR>" + visible + L"</TR>";
732 label += L"<TR>" + ror + L"</TR>";
733 label += L"<TR>" + opacity + L"</TR>";
734 label += L"<TR>" + showOpacity + L"</TR>";
735 label += L"<TR>" + opacityFromRoot + L"</TR>";
736 label += L"<TR>" + bounds + L"</TR>";
737 label += L"<TR>" + invBounds + L"</TR>";
738 label += L"<TR>" + rop + L"</TR>";
740 output.Format(1024, L"N%lx [ fillcolor=\"#%06x\", style=filled, label=<<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"3\">%ls</TABLE>>];\n",
741 (unsigned long)pVisualElementImpl->GetPublic(),
746 fprintf(pFile, "%ls", output.GetPointer());
751 _EflNode* pEflNode = static_cast< _EflNode* >(pVisualElementImpl->GetSharedData().pNativeNode);
752 Evas_Object* pEvasObject = reinterpret_cast< Evas_Object* >(pEflNode->GetGroupContainer());
754 fprintf(pFile, "N%lx -> N%lx [dir=none, style=\"dotted\", label=native]; \n",
755 (unsigned long)pVisualElementImpl->GetPublic(),
756 (unsigned long)pEvasObject
759 if (pVisualElementImpl->__pModel && pVisualElementImpl->__pModel->GetPublic() &&
760 pVisualElementImpl->__pPresentation && pVisualElementImpl->__pPresentation->GetPublic())
762 fprintf(pFile, "N%lx -> N%lx [style=\"dotted\"]; \n",
763 (unsigned long)pVisualElementImpl->__pModel->GetPublic(),
764 (unsigned long)pVisualElementImpl->__pPresentation->GetPublic()
771 _VeDebug::DumpVeTreeGraphI(FILE* pFile, _VisualElementImpl* pVisualElementImpl, int depth, int pos)
773 if (!pVisualElementImpl)
778 bool prevDebugEnabled = IsDebugEnabled();
779 SetDebugEnabled(true);
781 DumpVeObjectForGraphI(pFile, pVisualElementImpl, depth, pos);
783 for (int i = 0; i < pVisualElementImpl->__children.GetCount(); i++)
785 _VisualElementImpl* pChild = pVisualElementImpl->__children.GetChildAt(i);
786 DumpVeTreeGraphI(pFile, pChild, depth + 1, i);
787 fprintf(pFile, "N%lx -> N%lx [style=\"solid,bold\"] \n",
788 (unsigned long)pChild->GetPublic(),
789 (unsigned long)pVisualElementImpl->GetPublic()
793 SetDebugEnabled(prevDebugEnabled);
797 _VeDebug::DumpEvasTreeGraph(const char* pFilePath, VisualElement* pVisualElement)
799 _VisualElementImpl* pElement = null;
803 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
804 if (pDisplayManager != null && pDisplayManager->GetRoot(0))
806 pElement = _VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(0));
811 pElement = _VisualElementImpl::GetInstance(*pVisualElement);
819 FILE* pFile = fopen(pFilePath, "wt");
825 fprintf(pFile, "digraph VisualElementDump {\n");
826 fprintf(pFile, "node [shape=plaintext, fontsize=10.0];\n");
827 fprintf(pFile, "edge [fontsize=10.0];\n");
828 //fprintf(pFile, "rankdir = TB;\n");
829 fprintf(pFile, "rankdir = BT;\n");
830 fprintf(pFile, "\n");
833 bool prevDebugEnabled = IsDebugEnabled();
834 SetDebugEnabled(true);
837 _EflNode* pEflNode = static_cast< _EflNode* >(pElement->GetSharedData().pNativeNode);
838 Evas_Object* pEvasObject = reinterpret_cast< Evas_Object* >(pEflNode->GetGroupContainer());
840 fprintf(pFile, "subgraph cluster_evas {\n");
841 fprintf(pFile, "clusterrank = local;\n");
842 fprintf(pFile, "fontsize = 30.0;\n");
843 fprintf(pFile, "label = \"Evas Object\";\n");
844 DumpEvasTreeGraphI(pFile, pEvasObject, 0, 0);
845 fprintf(pFile, "}\n");
847 fprintf(pFile, "subgraph cluster_model {\n");
848 fprintf(pFile, "clusterrank = local;\n");
849 fprintf(pFile, "fontsize = 30.0;\n");
850 fprintf(pFile, "label = \"Model\";\n");
851 DumpVeTreeGraphI(pFile, pElement->__pModel, 0, 0);
852 fprintf(pFile, "}\n");
854 fprintf(pFile, "subgraph cluster_presentation {\n");
855 fprintf(pFile, "clusterrank = local;\n");
856 fprintf(pFile, "fontsize = 30.0;\n");
857 fprintf(pFile, "label = \"Presentation\";\n");
858 DumpVeTreeGraphI(pFile, pElement->__pPresentation, 0, 0);
859 fprintf(pFile, "}\n");
861 fprintf(pFile, "\n");
863 SetDebugEnabled(prevDebugEnabled);
865 fprintf(pFile, "}\n\n");
871 _VeDebug::DumpAllEvas(void)
873 Eina_List* pEvasObjects = null;
874 void* pObject = null;
875 Evas_Object* pEvasObject = null;
878 if (GetEcoreEvasMgr() && GetEcoreEvasMgr()->GetEcoreEvas() && GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas())
880 // evas_output_size_get(GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas(), &w, &h);
882 pEvasObjects = evas_objects_in_rectangle_get(
883 GetEcoreEvasMgr()->GetEcoreEvas()->GetEvas(),
885 -99999, -99999, 99999 * 2, 99999 * 2,
895 VeLog(NID_UI_ANIM, "--------------------------[EVAS ALL DUMP START]-----------------------------");
898 EINA_LIST_FREE(pEvasObjects, pObject)
902 pEvasObject = (Evas_Object*)pObject;
904 Tizen::Base::String type(evas_object_type_get(pEvasObject));
906 char logMessage[1024];
918 Evas_Object* pSource = NULL;
921 pSource = evas_object_image_source_get(pEvasObject);
922 evas_object_image_size_get(pEvasObject, &iw, &ih);
924 evas_object_geometry_get(pEvasObject, &ox, &oy, &ow, &oh);
925 evas_object_color_get(pEvasObject, &red, &green, &blue, &alpha);
926 argb = (((alpha << 24) & 0xff000000) | ((red << 16) & 0x00ff0000) | ((green << 8) & 0x0000ff00) | (blue & 0x000000ff));
927 bool showState = evas_object_visible_get(pEvasObject);
929 snprintf(logMessage, sizeof(logMessage), " - type=%ls[%p] bounds=[%d:%d ~ %d:%d] imgsize=[%d:%d] show=%s color=%08X source=%p",
930 type.GetPointer(), pEvasObject, ox, oy, ox + ow, oy + oh, iw, ih, (showState ? "visible" : "invisible"), argb, pSource);
932 VeLog(NID_UI_ANIM, "%s", logMessage);
936 VeLog(NID_UI_ANIM, "--------------------------[EVAS ALL DUMP END]-----------------------------");
940 _VeDebug::PrintVeTree(_VisualElementImpl* pElement, int depth, unsigned int remainingChild)
942 static Tizen::Base::String output = "";
943 Tizen::Base::String item = "";
944 Tizen::Base::String surface = "";
945 Tizen::Base::String name = "";
949 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
950 if (pDisplayManager != null && pDisplayManager->GetRoot(0))
952 pElement = _VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(0));
962 bool prevDebugEnabled = IsDebugEnabled();
963 SetDebugEnabled(true);
965 if (pElement->GetSharedData().pSurface)
970 if (pElement->GetName().GetLength() <= 0)
972 name.Format(255, L"%ls%#x", surface.GetPointer(), pElement);
976 name.Format(255, L"%ls%ls", surface.GetPointer(), pElement->GetName().GetPointer());
980 for (int i = 1; i <= depth; i++)
982 int childrenCount = 0;
983 if (pElement->__pParent)
985 childrenCount = pElement->__pParent->__children.GetCount();
989 if (childrenCount <= 1)
993 remainingChild -= pow(10, depth - 1);
997 item.Format(255, L"-%-16ls", name.GetPointer());
1002 else if (DIGITATPOSITION(remainingChild, depth) == childrenCount)
1004 remainingChild -= powf(10.0f, depth - 1);
1007 item.Format(255, L"T%-16ls", name.GetPointer());
1008 output.Append(item);
1012 else if (depth == i)
1014 remainingChild -= powf(10.0f, depth - 1);
1016 item.Format(255, L"%s%-16ls", (DIGITATPOSITION(remainingChild, i) == 0) ? "L" : "L", name.GetPointer());
1017 output.Append(item);
1022 item.Format(255, L"%s%-16ls", (DIGITATPOSITION(remainingChild, i) > 0) ? "|" : " ", L"");
1023 output.Append(item);
1028 int count = pElement->__children.GetCount();
1031 for (int i = 0; i < count; i++)
1033 if (pElement->__children.GetChildAt(i))
1035 PrintVeTree(pElement->__children.GetChildAt(i), depth + 1, remainingChild + (count - i) * powf(10.0f, depth));
1041 //output.Append("\n");
1043 VeLog(NID_UI_ANIM, "%s", output.GetPointer());
1047 SetDebugEnabled(prevDebugEnabled);
1051 _VeDebug::DumpVeImage(_VisualElementImpl* pElement, const char* pathPrefix)
1053 static int count = 0;
1054 char filename[2048] = {0, };
1058 pathPrefix = "/tmp/";
1063 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
1064 if (pDisplayManager != null && pDisplayManager->GetRoot(0))
1066 pElement = _VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(0));
1076 Tizen::Base::String name = pElement->GetName();
1077 if (name.GetLength() > 0)
1079 sprintf(filename, "%sVE_%d_%ls_%08x.png", pathPrefix, count++, pElement->GetName().GetPointer(), (unsigned int)pElement->GetPresentation());
1083 sprintf(filename, "%sVE_%d_%08x.png", pathPrefix, count++, (unsigned int)pElement->GetPresentation());
1086 VisualElementSurface* pSurface = pElement->__pSharedData->pNativeNode->GetSurface();
1087 if (pSurface && _VisualElementSurfaceImpl::GetInstance(*pSurface))
1089 Evas_Object* pEvasObjectImage = null;
1090 Evas_Object* pSource = evas_object_image_source_get((Evas_Object*)_VisualElementSurfaceImpl::GetInstance(*pSurface)->GetNativeHandle());
1093 pEvasObjectImage = pSource;
1097 pEvasObjectImage = (Evas_Object*)_VisualElementSurfaceImpl::GetInstance(*pSurface)->GetNativeHandle();
1100 if (pEvasObjectImage)
1102 VeLog(NID_UI_ANIM, "--------------------------[VE DUMP IMAGE START %#08x]---------------------------", pElement);
1103 if (evas_object_image_save(pEvasObjectImage, filename, NULL, "quality=100 compress=9"))
1105 evas_object_image_save(pEvasObjectImage, "/tmp/lastimage.png", NULL, "quality=100 compress=9");
1106 VeLog(NID_UI_ANIM, "--------------------------[VE DUMP IMAGE END]-----------------------------");
1110 VeLog(NID_UI_ANIM, "--------------------------[VE DUMP IMAGE ERROR!!!]-----------------------------");
1117 _VeDebug::DumpAllVeImages(_VisualElementImpl* pElement, const char* pathPrefix)
1121 _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
1122 if (pDisplayManager != null && pDisplayManager->GetRoot(0))
1124 pElement = _VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(0));
1128 if (pElement == null)
1133 DumpVeImage(pElement, pathPrefix);
1135 int count = pElement->__children.GetCount();
1136 for (int i = 0; i < count; i++)
1138 if (pElement->__children.GetChildAt(i))
1140 DumpAllVeImages(pElement->__children.GetChildAt(i), pathPrefix);
1146 _VeDebug::ReflushAll(_VisualElementImpl* pElement, int depth)
1148 pElement->SetFlushNeeded();
1150 int count = pElement->__children.GetCount();
1151 for (int i = 0; i < count; i++)
1153 ReflushAll(pElement->__children.GetChildAt(i), depth + 1);
1158 _EflNode* pEflNode = dynamic_cast< _EflNode* >(pElement->__pSharedData->pNativeNode);
1159 if (pEflNode != null)
1161 ecore_evas_manual_render(ecore_evas_ecore_evas_get(pEflNode->GetEvas()));
1167 }}} // Tizen::Ui::Animations
1170 extern "C" _OSP_EXPORT_ void
1173 Tizen::Ui::Animations::_DisplayManager* pDisplayManager = Tizen::Ui::Animations::_DisplayManager::GetInstance();
1175 for (int i = 0; i < pDisplayManager->GetRootCount(); i++)
1177 Tizen::Ui::Animations::_VisualElementImpl* pVisualElementImpl = Tizen::Ui::Animations::_VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(i));
1178 if (pVisualElementImpl)
1180 Tizen::Ui::Animations::_VeDebug::DumpVeTree(pVisualElementImpl, 0);
1185 extern "C" _OSP_EXPORT_ void
1188 Tizen::Ui::Animations::_DisplayManager* pDisplayManager = Tizen::Ui::Animations::_DisplayManager::GetInstance();
1190 for (int i = 0; i < pDisplayManager->GetRootCount(); i++)
1192 Tizen::Ui::Animations::_VisualElementImpl* pVisualElementImpl = Tizen::Ui::Animations::_VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(i));
1193 if (pVisualElementImpl)
1195 Tizen::Ui::Animations::_VeDebug::DumpEvasTree(pVisualElementImpl, 0);
1200 extern "C" _OSP_EXPORT_ void
1201 DumpAllVeImages(void)
1203 Tizen::Ui::Animations::_DisplayManager* pDisplayManager = Tizen::Ui::Animations::_DisplayManager::GetInstance();
1205 for (int i = 0; i < pDisplayManager->GetRootCount(); i++)
1207 Tizen::Ui::Animations::_VisualElementImpl* pVisualElementImpl = Tizen::Ui::Animations::_VisualElementImpl::GetInstance(*pDisplayManager->GetRoot(i));
1208 if (pVisualElementImpl)
1210 Tizen::Ui::Animations::_VeDebug::DumpAllVeImages(pVisualElementImpl, 0);
1215 extern "C" _OSP_EXPORT_ void
1218 Tizen::Ui::Animations::_VeDebug::DumpAllEvas();
1221 extern "C" _OSP_EXPORT_ void
1222 DumpEvasTreeGraph(void)
1224 Tizen::Ui::Animations::_DisplayManager* pDisplayManager = Tizen::Ui::Animations::_DisplayManager::GetInstance();
1226 for (int i = 0; i < pDisplayManager->GetRootCount(); i++)
1229 snprintf(filePath, sizeof(filePath), "/tmp/graph_%d.dot", i);
1230 Tizen::Ui::Animations::_VeDebug::DumpEvasTreeGraph(filePath, pDisplayManager->GetRoot(i));
1235 extern "C" _OSP_EXPORT_ void
1236 DebugAnimBreak(void)
1238 asm volatile ("int $3\n");