aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-07 17:08:21 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-08 12:36:29 +0000
commit4150eea6c49ecec882a8d3e1c61d6a25fcd1e905 (patch)
tree21b7089d6745f769be88f8f3d9a127d521ff48be /src/core
parent1f1bb9c0b8d5f50ac74716e6961a6c92f1d373d8 (diff)
Move control of explicit GPU resource allocation to GrContextOptions
Change-Id: Ic284acc79bab5936f0007d5ae5fb1e7a9929e2af Reviewed-on: https://skia-review.googlesource.com/104880 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkTTopoSort.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/src/core/SkTTopoSort.h b/src/core/SkTTopoSort.h
index 21c80696e7..722707d5b5 100644
--- a/src/core/SkTTopoSort.h
+++ b/src/core/SkTTopoSort.h
@@ -8,22 +8,23 @@
#ifndef SkTTopoSort_DEFINED
#define SkTTopoSort_DEFINED
-#include "SkTDArray.h"
+#include "SkRefCnt.h"
+#include "SkTArray.h"
#ifdef SK_DEBUG
template <typename T, typename Traits = T>
-void SkTTopoSort_CheckAllUnmarked(const SkTDArray<T*>& graph) {
+void SkTTopoSort_CheckAllUnmarked(const SkTArray<sk_sp<T>>& graph) {
for (int i = 0; i < graph.count(); ++i) {
- SkASSERT(!Traits::IsTempMarked(graph[i]));
- SkASSERT(!Traits::WasOutput(graph[i]));
+ SkASSERT(!Traits::IsTempMarked(graph[i].get()));
+ SkASSERT(!Traits::WasOutput(graph[i].get()));
}
}
template <typename T, typename Traits = T>
-void SkTTopoSort_CleanExit(const SkTDArray<T*>& graph) {
+void SkTTopoSort_CleanExit(const SkTArray<sk_sp<T>>& graph) {
for (int i = 0; i < graph.count(); ++i) {
- SkASSERT(!Traits::IsTempMarked(graph[i]));
- SkASSERT(Traits::WasOutput(graph[i]));
+ SkASSERT(!Traits::IsTempMarked(graph[i].get()));
+ SkASSERT(Traits::WasOutput(graph[i].get()));
}
}
#endif
@@ -31,7 +32,7 @@ void SkTTopoSort_CleanExit(const SkTDArray<T*>& graph) {
// Recursively visit a node and all the other nodes it depends on.
// Return false if there is a loop.
template <typename T, typename Traits = T>
-bool SkTTopoSort_Visit(T* node, SkTDArray<T*>* result) {
+bool SkTTopoSort_Visit(T* node, SkTArray<sk_sp<T>>* result) {
if (Traits::IsTempMarked(node)) {
// There is a loop.
return false;
@@ -51,7 +52,7 @@ bool SkTTopoSort_Visit(T* node, SkTDArray<T*>* result) {
Traits::Output(node, result->count()); // mark this node as output
Traits::ResetTempMark(node);
- *result->append() = node;
+ result->push_back(sk_ref_sp(node));
}
return true;
@@ -78,30 +79,30 @@ bool SkTTopoSort_Visit(T* node, SkTDArray<T*>* result) {
// node and all the nodes on which it depends. This could be used to partially
// flush a GrOpList DAG.
template <typename T, typename Traits = T>
-bool SkTTopoSort(SkTDArray<T*>* graph) {
- SkTDArray<T*> result;
+bool SkTTopoSort(SkTArray<sk_sp<T>>* graph) {
+ SkTArray<sk_sp<T>> result;
#ifdef SK_DEBUG
SkTTopoSort_CheckAllUnmarked<T, Traits>(*graph);
#endif
- result.setReserve(graph->count());
+ result.reserve(graph->count());
for (int i = 0; i < graph->count(); ++i) {
- if (Traits::WasOutput((*graph)[i])) {
+ if (Traits::WasOutput((*graph)[i].get())) {
// This node was depended on by some earlier node and has already
// been output
continue;
}
// Output this node after all the nodes it depends on have been output.
- if (!SkTTopoSort_Visit<T, Traits>((*graph)[i], &result)) {
+ if (!SkTTopoSort_Visit<T, Traits>((*graph)[i].get(), &result)) {
return false;
}
}
SkASSERT(graph->count() == result.count());
- graph->swap(result);
+ graph->swap(&result);
#ifdef SK_DEBUG
SkTTopoSort_CleanExit<T, Traits>(*graph);