aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--bench/RTreeBench.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/bench/RTreeBench.cpp b/bench/RTreeBench.cpp
index 759037e00e..2ee6deae7b 100644
--- a/bench/RTreeBench.cpp
+++ b/bench/RTreeBench.cpp
@@ -28,18 +28,17 @@ public:
: INHERITED(param)
, fTree(tree)
, fProc(proc)
- , fName(name)
- , fBulkLoad(bulkLoad) { }
-protected:
- virtual const char* onGetName() {
- SkString str;
- str.append("rtree_");
- str.append(fName);
- str.append("_build");
+ , fBulkLoad(bulkLoad) {
+ fName.append("rtree_");
+ fName.append(name);
+ fName.append("_build");
if (fBulkLoad) {
- str.append("_bulk");
+ fName.append("_bulk");
}
- return str.c_str();
+ }
+protected:
+ virtual const char* onGetName() {
+ return fName.c_str();
}
virtual void onDraw(SkCanvas* canvas) {
SkRandom rand;
@@ -55,7 +54,7 @@ protected:
private:
SkBBoxHierarchy* fTree;
MakeRectProc fProc;
- const char* fName;
+ SkString fName;
bool fBulkLoad;
typedef SkBenchmark INHERITED;
};
@@ -75,9 +74,14 @@ public:
: INHERITED(param)
, fTree(tree)
, fProc(proc)
- , fName(name)
, fBulkLoad(bulkLoad)
, fQuery(q) {
+ fName.append("rtree_");
+ fName.append(name);
+ fName.append("_query");
+ if (fBulkLoad) {
+ fName.append("_bulk");
+ }
SkRandom rand;
for (int j = 0; j < SkBENCHLOOP(NUM_QUERY_RECTS); ++j) {
fTree->insert(reinterpret_cast<void*>(j), fProc(rand, j,
@@ -87,14 +91,7 @@ public:
}
protected:
virtual const char* onGetName() {
- SkString str;
- str.append("rtree_");
- str.append(fName);
- str.append("_query");
- if (fBulkLoad) {
- str.append("_bulk");
- }
- return str.c_str();
+ return fName.c_str();
}
virtual void onDraw(SkCanvas* canvas) {
SkRandom rand;
@@ -134,7 +131,7 @@ protected:
private:
SkBBoxHierarchy* fTree;
MakeRectProc fProc;
- const char* fName;
+ SkString fName;
bool fBulkLoad;
QueryType fQuery;
typedef SkBenchmark INHERITED;