From 4150eea6c49ecec882a8d3e1c61d6a25fcd1e905 Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Wed, 7 Feb 2018 17:08:21 -0500 Subject: Move control of explicit GPU resource allocation to GrContextOptions Change-Id: Ic284acc79bab5936f0007d5ae5fb1e7a9929e2af Reviewed-on: https://skia-review.googlesource.com/104880 Commit-Queue: Robert Phillips Reviewed-by: Brian Salomon Reviewed-by: Greg Daniel --- tools/sk_tool_utils.h | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'tools/sk_tool_utils.h') 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* graph, int num) { - graph->setReserve(num); + static void AllocNodes(SkTArray>* graph, int num) { + graph->reserve(num); for (int i = 0; i < num; ++i) { - *graph->append() = new TopoTestNode(i); + graph->push_back(sk_sp(new TopoTestNode(i))); } } - static void DeallocNodes(SkTDArray* graph) { - for (int i = 0; i < graph->count(); ++i) { - delete (*graph)[i]; - } - } - - #ifdef SK_DEBUG - static void Print(const SkTDArray& graph) { +#ifdef SK_DEBUG + static void Print(const SkTArray& 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* graph, SkRandom* rand) { + static void Shuffle(SkTArray>* 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]); } } -- cgit v1.2.3