2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/update/manager/update-manager-debug.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/public-api/common/constants.h>
29 #include <dali/public-api/math/degree.h>
30 #include <dali/public-api/math/radian.h>
31 #include <dali/public-api/math/vector2.h>
33 #ifdef DALI_PRINT_UPDATE_INFO
41 #if defined(DEBUG_ENABLED)
42 static Debug::Filter* gNodeLogFilter = Debug::Filter::New(Debug::Verbose, false, "LOG_UPDATE_MANAGER");
46 * Debug helper function.
48 void PrintNodes(const Node& node, BufferIndex updateBufferIndex, int level)
50 std::string nodeName = DALI_LOG_GET_OBJECT_STRING((&node));
53 std::ostringstream oss;
54 std::ios_base::fmtflags mask = oss.flags();
55 mask &= ~std::ios_base::scientific;
56 mask |= std::ios_base::fixed;
57 oss << std::setprecision(2) << std::setiosflags(mask)
58 << std::setw(level * 2) << std::setfill(' ') << "";
60 oss << "Node " << nodeName << " " << &node
61 << " Position: " << node.GetPosition(updateBufferIndex)
62 << " WorldPosition: " << node.GetWorldPosition(updateBufferIndex)
63 << " Size: " << node.GetSize(updateBufferIndex)
64 << " Visible: " << node.IsVisible(updateBufferIndex)
67 DALI_LOG_INFO(gNodeLogFilter, Debug::Verbose, "%s", oss.str().c_str());
72 for(NodeConstIter iter = node.GetChildren().Begin(); iter != node.GetChildren().End(); ++iter)
74 PrintNodes(**iter, updateBufferIndex, level);
78 void PrintNodeTree(const Node& node, BufferIndex bufferIndex, std::string indentation)
80 std::cout << "Node " << &node
81 << " \"" << node.mDebugString << "\""
82 << " Origin: " << node.GetParentOrigin()
83 << " Anchor: " << node.GetAnchorPoint()
84 << " Size: " << node.GetSize(bufferIndex)
85 << " Pos: " << node.GetPosition(bufferIndex)
86 << " Ori: " << node.GetOrientation(bufferIndex)
87 << " Scale: " << node.GetScale(bufferIndex)
88 << " Color: " << node.GetColor(bufferIndex)
89 << " Visible: " << node.IsVisible(bufferIndex)
90 << " World Pos: " << node.GetWorldPosition(bufferIndex)
91 << " World Ori: " << node.GetWorldOrientation(bufferIndex)
92 << " World Scale: " << node.GetWorldScale(bufferIndex)
93 << " World Color: " << node.GetWorldColor(bufferIndex)
94 << " World Matrix: " << node.GetWorldMatrix(bufferIndex)
97 for(NodeConstIter iter = node.GetChildren().Begin(); iter != node.GetChildren().End(); ++iter)
99 std::cout << indentation << "|" << std::endl
100 << indentation << "---->";
102 std::string nextIndent = indentation;
103 if((iter + 1) != node.GetChildren().End())
112 PrintNodeTree(**iter, bufferIndex, nextIndent);
116 } // namespace SceneGraph
118 } // namespace Internal