Revert "[Tizen] Add temporaty log to node"
[platform/core/uifw/dali-core.git] / dali / internal / update / manager / update-manager-debug.cpp
index c5f6159..dd956f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,9 +19,9 @@
 #include <dali/internal/update/manager/update-manager-debug.h>
 
 // EXTERNAL INCLUDES
-#include <sstream>
 #include <iomanip>
 #include <ios>
+#include <sstream>
 
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
 #include <dali/public-api/math/radian.h>
 #include <dali/public-api/math/vector2.h>
 
+#ifdef DALI_PRINT_UPDATE_INFO
+
 namespace Dali
 {
-
 namespace Internal
 {
-
 namespace SceneGraph
 {
-
 #if defined(DEBUG_ENABLED)
 static Debug::Filter* gNodeLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_UPDATE_MANAGER");
 #endif
@@ -46,85 +45,62 @@ static Debug::Filter* gNodeLogFilter = Debug::Filter::New(Debug::Verbose, false,
 /**
  * Debug helper function.
  */
-void PrintNodes( const Node& node, BufferIndex updateBufferIndex, int level )
+void PrintNodes(const Node& node, BufferIndex updateBufferIndex, int level)
 {
-#if defined(DEBUG_ENABLED)
-  const Vector3& position = node.GetPosition(updateBufferIndex);
-  const Vector3& scale = node.GetScale(updateBufferIndex);
-  const Vector3& fullPos = node.GetWorldPosition(updateBufferIndex);
-  const Quaternion& rotation = node.GetOrientation(updateBufferIndex);
-  Vector3 axis;
-  Radian angle;
-  rotation.ToAxisAngle(axis, angle);
-
-  std::string nodeName= DALI_LOG_GET_OBJECT_STRING((&node));
+  std::string nodeName = DALI_LOG_GET_OBJECT_STRING((&node));
 
   {
-    std::ostringstream oss;
+    std::ostringstream      oss;
     std::ios_base::fmtflags mask = oss.flags();
     mask &= ~std::ios_base::scientific;
-    mask |=  std::ios_base::fixed;
+    mask |= std::ios_base::fixed;
     oss << std::setprecision(2) << std::setiosflags(mask)
-        << std::setw(level*2) << std::setfill(' ') << "";
-    oss << "Node "  << nodeName << " " << &node
-        << "  Position (" << position.x << ", " << position.y << ", " << position.z << ")"
-        << "  WorldPosition (" << fullPos.x << ", " << fullPos.y << ", " << fullPos.z << ")"
-        << "  Orientation (" << Degree(angle).degree << "degrees <" << axis.x << ", " << axis.y << ", " << axis.z << ">)"
-        << "  Scale (" << scale.x << ", " << scale.y << ", " << scale.z << ")"
-        << std::endl;
-
-    DALI_LOG_INFO(gNodeLogFilter, Debug::Verbose, "%s\n", oss.str().c_str());
-  }
+        << std::setw(level * 2) << std::setfill(' ') << "";
 
-  {
-    std::ostringstream oss;
-    std::ios_base::fmtflags mask = oss.flags();
-    mask &= ~std::ios_base::scientific;
-    mask |=  std::ios_base::fixed;
-    oss << std::setprecision(2) << std::setiosflags(mask)
-        << std::setw(level*2) << std::setfill(' ') << "";
+    oss << "Node " << nodeName << " " << &node
+        << " Position: " << node.GetPosition(updateBufferIndex)
+        << " WorldPosition: " << node.GetWorldPosition(updateBufferIndex)
+        << " Size: " << node.GetSize(updateBufferIndex)
+        << " Visible: " << node.IsVisible(updateBufferIndex)
+        << std::endl;
 
-    std::string trafoMatrix = Debug::MatrixToString(node.GetWorldMatrix(updateBufferIndex), 2, level*2);
-    DALI_LOG_INFO(gNodeLogFilter, Debug::Verbose, "%s\n", trafoMatrix.c_str());
+    DALI_LOG_INFO(gNodeLogFilter, Debug::Verbose, "%s", oss.str().c_str());
   }
 
   ++level;
 
-  for ( NodeConstIter iter = node.GetChildren().Begin(); iter != node.GetChildren().End(); ++iter )
+  for(NodeConstIter iter = node.GetChildren().Begin(); iter != node.GetChildren().End(); ++iter)
   {
     PrintNodes(**iter, updateBufferIndex, level);
   }
-#endif // DEBUG_ENABLED
 }
 
-void PrintNodeTree( const Node& node, BufferIndex bufferIndex, std::string indentation )
+void PrintNodeTree(const Node& node, BufferIndex bufferIndex, std::string indentation)
 {
-#if defined(DEBUG_ENABLED)
-
   std::cout << "Node " << &node
             << " \"" << node.mDebugString << "\""
-            << " Origin: "       << node.GetParentOrigin()
-            << " Anchor: "       << node.GetAnchorPoint()
-            << " Size: "         << node.GetSize(bufferIndex)
-            << " Pos: "          << node.GetPosition(bufferIndex)
-            << " Ori: "          << node.GetOrientation(bufferIndex)
-            << " Scale: "        << node.GetScale(bufferIndex)
-            << " Color: "        << node.GetColor(bufferIndex)
-            << " Visible: "      << node.IsVisible(bufferIndex)
-            << " World Pos: "    << node.GetWorldPosition(bufferIndex)
-            << " World Ori: "    << node.GetWorldOrientation(bufferIndex)
-            << " World Scale: "  << node.GetWorldScale(bufferIndex)
-            << " World Color: "  << node.GetWorldColor(bufferIndex)
+            << " Origin: " << node.GetParentOrigin()
+            << " Anchor: " << node.GetAnchorPoint()
+            << " Size: " << node.GetSize(bufferIndex)
+            << " Pos: " << node.GetPosition(bufferIndex)
+            << " Ori: " << node.GetOrientation(bufferIndex)
+            << " Scale: " << node.GetScale(bufferIndex)
+            << " Color: " << node.GetColor(bufferIndex)
+            << " Visible: " << node.IsVisible(bufferIndex)
+            << " World Pos: " << node.GetWorldPosition(bufferIndex)
+            << " World Ori: " << node.GetWorldOrientation(bufferIndex)
+            << " World Scale: " << node.GetWorldScale(bufferIndex)
+            << " World Color: " << node.GetWorldColor(bufferIndex)
             << " World Matrix: " << node.GetWorldMatrix(bufferIndex)
             << std::endl;
 
-  for ( NodeConstIter iter = node.GetChildren().Begin(); iter != node.GetChildren().End(); ++iter)
+  for(NodeConstIter iter = node.GetChildren().Begin(); iter != node.GetChildren().End(); ++iter)
   {
     std::cout << indentation << "|" << std::endl
               << indentation << "---->";
 
     std::string nextIndent = indentation;
-    if ( (iter + 1) != node.GetChildren().End() )
+    if((iter + 1) != node.GetChildren().End())
     {
       nextIndent += "|    ";
     }
@@ -135,12 +111,12 @@ void PrintNodeTree( const Node& node, BufferIndex bufferIndex, std::string inden
 
     PrintNodeTree(**iter, bufferIndex, nextIndent);
   }
-
-#endif // DEBUG_ENABLED
 }
 
-} // SceneGraph
+} // namespace SceneGraph
 
-} // Internal
+} // namespace Internal
 
-} // Dali
+} // namespace Dali
+
+#endif