Index: tests/BBoxHierarchyTest.cpp |
diff --git a/tests/BBoxHierarchyTest.cpp b/tests/BBoxHierarchyTest.cpp |
index 71b96994f2ea9441b56711e24b0a19a77bfe050a..3c2a79c9c401efdfa9b3069341c6835a3c82c6b2 100644 |
--- a/tests/BBoxHierarchyTest.cpp |
+++ b/tests/BBoxHierarchyTest.cpp |
@@ -21,7 +21,7 @@ static const SkScalar MAX_SIZE = 1000.0f; |
struct DataRect { |
SkRect rect; |
- void* data; |
+ unsigned data; |
}; |
static SkRect random_rect(SkRandom& rand) { |
@@ -39,16 +39,16 @@ static SkRect random_rect(SkRandom& rand) { |
static void random_data_rects(SkRandom& rand, DataRect out[], int n) { |
for (int i = 0; i < n; ++i) { |
out[i].rect = random_rect(rand); |
- out[i].data = reinterpret_cast<void*>(i); |
+ out[i].data = (unsigned)i; |
} |
} |
robertphillips
2014/10/02 12:27:35
one line ?
mtklein
2014/10/02 14:32:09
Done.
|
static bool verify_query(SkRect query, DataRect rects[], |
- SkTDArray<void*>& found) { |
+ SkTDArray<unsigned>& found) { |
// TODO(mtklein): no need to do this after everything's SkRects |
query.roundOut(); |
- SkTDArray<void*> expected; |
+ SkTDArray<unsigned> expected; |
// manually intersect with every rectangle |
for (int i = 0; i < NUM_RECTS; ++i) { |
if (SkRect::Intersects(query, rects[i].rect)) { |
@@ -64,18 +64,15 @@ static bool verify_query(SkRect query, DataRect rects[], |
return true; |
} |
robertphillips
2014/10/02 12:27:35
Are these sorts really necessary ?
mtklein
2014/10/02 14:32:09
Looking more closely at this file, it turns out th
|
- // Just cast to long since sorting by the value of the void*'s was being problematic... |
- SkTQSort(reinterpret_cast<long*>(expected.begin()), |
- reinterpret_cast<long*>(expected.end() - 1)); |
- SkTQSort(reinterpret_cast<long*>(found.begin()), |
- reinterpret_cast<long*>(found.end() - 1)); |
+ SkTQSort(expected.begin(), expected.end() - 1); |
+ SkTQSort(found.begin(), found.end() - 1); |
return found == expected; |
} |
static void run_queries(skiatest::Reporter* reporter, SkRandom& rand, DataRect rects[], |
SkBBoxHierarchy& tree) { |
for (size_t i = 0; i < NUM_QUERIES; ++i) { |
- SkTDArray<void*> hits; |
+ SkTDArray<unsigned> hits; |
SkRect query = random_rect(rand); |
tree.search(query, &hits); |
REPORTER_ASSERT(reporter, verify_query(query, rects, hits)); |