8#ifndef GrTTopoSort_DEFINED
9#define GrTTopoSort_DEFINED
15template <
typename T,
typename Traits = T>
17 for (
const auto& node : graph) {
18 SkASSERT(!Traits::IsTempMarked(node.get()));
19 SkASSERT(!Traits::WasOutput(node.get()));
23template <
typename T,
typename Traits = T>
25 for (
size_t i = 0;
i < graph.size(); ++
i) {
35template <
typename T,
typename Traits = T>
37 if (Traits::IsTempMarked(node)) {
44 if (Traits::WasOutput(node)) {
48 bool succeeded =
true;
51 Traits::SetTempMark(node);
52 for (
int i = 0;
i < Traits::NumDependencies(node); ++
i) {
53 if (!GrTTopoSort_Visit<T, Traits>(Traits::Dependency(node,
i), counter)) {
60 Traits::ResetTempMark(node);
91template <
typename T,
typename Traits = T>
96 GrTTopoSort_CheckAllUnmarked<T, Traits>(graph);
99 bool succeeded =
true;
101 for (
size_t i = 0;
i < graph.size(); ++
i) {
102 if (Traits::WasOutput(graph[
i].
get())) {
109 if (!GrTTopoSort_Visit<T, Traits>(graph[
i].
get(), &counter)) {
117 for (uint32_t
i = 0;
i < (uint32_t) graph.size(); ++
i) {
118 for (uint32_t correctIndex = Traits::GetIndex(graph[
i].
get()) -
offset;
120 correctIndex = Traits::GetIndex(graph[
i].
get()) -
offset) {
121 graph[
i].swap(graph[correctIndex]);
126 GrTTopoSort_CleanExit<T, Traits>(graph,
offset);
bool GrTTopoSort(SkSpan< sk_sp< T > > graph, uint32_t offset=0)
bool GrTTopoSort_Visit(T *node, uint32_t *counter)
const myers::Point & get(const myers::Segment &)