aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/sk_tool_utils.h
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 /tools/sk_tool_utils.h
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 'tools/sk_tool_utils.h')
-rw-r--r--tools/sk_tool_utils.h27
1 files changed, 10 insertions, 17 deletions
diff --git a/tools/sk_tool_utils.h b/tools/sk_tool_utils.h
index 9081e3c56f..d27a14a068 100644
--- a/tools/sk_tool_utils.h
+++ b/tools/sk_tool_utils.h
@@ -12,6 +12,7 @@
#include "SkImageEncoder.h"
#include "SkImageInfo.h"
#include "SkRandom.h"
+#include "SkRefCnt.h"
#include "SkStream.h"
#include "SkTDArray.h"
#include "SkTypeface.h"
@@ -147,7 +148,7 @@ namespace sk_tool_utils {
SkRect compute_tallest_occluder(const SkRRect& rr);
// A helper object to test the topological sorting code (TopoSortBench.cpp & TopoSortTest.cpp)
- class TopoTestNode {
+ class TopoTestNode : public SkRefCnt {
public:
TopoTestNode(int id) : fID(id), fOutputPos(-1), fTempMark(false) { }
@@ -194,37 +195,29 @@ namespace sk_tool_utils {
}
// Helper functions for TopoSortBench & TopoSortTest
- static void AllocNodes(SkTDArray<TopoTestNode*>* graph, int num) {
- graph->setReserve(num);
+ static void AllocNodes(SkTArray<sk_sp<sk_tool_utils::TopoTestNode>>* graph, int num) {
+ graph->reserve(num);
for (int i = 0; i < num; ++i) {
- *graph->append() = new TopoTestNode(i);
+ graph->push_back(sk_sp<TopoTestNode>(new TopoTestNode(i)));
}
}
- static void DeallocNodes(SkTDArray<TopoTestNode*>* graph) {
- for (int i = 0; i < graph->count(); ++i) {
- delete (*graph)[i];
- }
- }
-
- #ifdef SK_DEBUG
- static void Print(const SkTDArray<TopoTestNode*>& graph) {
+#ifdef SK_DEBUG
+ static void Print(const SkTArray<TopoTestNode*>& graph) {
for (int i = 0; i < graph.count(); ++i) {
SkDebugf("%d, ", graph[i]->id());
}
SkDebugf("\n");
}
- #endif
+#endif
// randomize the array
- static void Shuffle(SkTDArray<TopoTestNode*>* graph, SkRandom* rand) {
+ static void Shuffle(SkTArray<sk_sp<TopoTestNode>>* graph, SkRandom* rand) {
for (int i = graph->count()-1; i > 0; --i) {
int swap = rand->nextU() % (i+1);
- TopoTestNode* tmp = (*graph)[i];
- (*graph)[i] = (*graph)[swap];
- (*graph)[swap] = tmp;
+ (*graph)[i].swap((*graph)[swap]);
}
}