OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef sk_tool_utils_DEFINED | 8 #ifndef sk_tool_utils_DEFINED |
9 #define sk_tool_utils_DEFINED | 9 #define sk_tool_utils_DEFINED |
10 | 10 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 return true; | 163 return true; |
164 } | 164 } |
165 | 165 |
166 // The following 7 methods are needed by the topological sort | 166 // The following 7 methods are needed by the topological sort |
167 static void SetTempMark(TopoTestNode* node) { node->fTempMark = true; } | 167 static void SetTempMark(TopoTestNode* node) { node->fTempMark = true; } |
168 static void ResetTempMark(TopoTestNode* node) { node->fTempMark = false;
} | 168 static void ResetTempMark(TopoTestNode* node) { node->fTempMark = false;
} |
169 static bool IsTempMarked(TopoTestNode* node) { return node->fTempMark; } | 169 static bool IsTempMarked(TopoTestNode* node) { return node->fTempMark; } |
170 static void Output(TopoTestNode* node, int outputPos) { | 170 static void Output(TopoTestNode* node, int outputPos) { |
171 SkASSERT(-1 != outputPos); | 171 SkASSERT(-1 != outputPos); |
172 node->fOutputPos = outputPos; | 172 node->fOutputPos = outputPos; |
173 } | 173 } |
174 static bool WasOutput(TopoTestNode* node) { return (-1 != node->fOutputP
os); } | 174 static bool WasOutput(TopoTestNode* node) { return (-1 != node->fOutputP
os); } |
175 static int NumDependencies(TopoTestNode* node) { return node->fDependenc
ies.count(); } | 175 static int NumDependencies(TopoTestNode* node) { return node->fDependenc
ies.count(); } |
176 static TopoTestNode* Dependency(TopoTestNode* node, int index) { | 176 static TopoTestNode* Dependency(TopoTestNode* node, int index) { |
177 return node->fDependencies[index]; | 177 return node->fDependencies[index]; |
178 } | 178 } |
179 | 179 |
180 // Helper functions for TopoSortBench & TopoSortTest | 180 // Helper functions for TopoSortBench & TopoSortTest |
181 static void AllocNodes(SkTDArray<TopoTestNode*>* graph, int num) { | 181 static void AllocNodes(SkTDArray<TopoTestNode*>* graph, int num) { |
182 graph->setReserve(num); | 182 graph->setReserve(num); |
183 | 183 |
184 for (int i = 0; i < num; ++i) { | 184 for (int i = 0; i < num; ++i) { |
185 *graph->append() = new TopoTestNode(i); | 185 *graph->append() = new TopoTestNode(i); |
186 } | 186 } |
(...skipping 29 matching lines...) Expand all Loading... |
216 int fID; | 216 int fID; |
217 int fOutputPos; | 217 int fOutputPos; |
218 bool fTempMark; | 218 bool fTempMark; |
219 | 219 |
220 SkTDArray<TopoTestNode*> fDependencies; | 220 SkTDArray<TopoTestNode*> fDependencies; |
221 }; | 221 }; |
222 | 222 |
223 } // namespace sk_tool_utils | 223 } // namespace sk_tool_utils |
224 | 224 |
225 #endif // sk_tool_utils_DEFINED | 225 #endif // sk_tool_utils_DEFINED |
OLD | NEW |