| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkRTree.h" | 8 #include "SkRTree.h" |
| 9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 SkRandom rand; | 73 SkRandom rand; |
| 74 SkAutoTMalloc<SkRect> rects(NUM_RECTS); | 74 SkAutoTMalloc<SkRect> rects(NUM_RECTS); |
| 75 for (size_t i = 0; i < NUM_ITERATIONS; ++i) { | 75 for (size_t i = 0; i < NUM_ITERATIONS; ++i) { |
| 76 SkRTree rtree; | 76 SkRTree rtree; |
| 77 REPORTER_ASSERT(reporter, 0 == rtree.getCount()); | 77 REPORTER_ASSERT(reporter, 0 == rtree.getCount()); |
| 78 | 78 |
| 79 for (int j = 0; j < NUM_RECTS; j++) { | 79 for (int j = 0; j < NUM_RECTS; j++) { |
| 80 rects[j] = random_rect(rand); | 80 rects[j] = random_rect(rand); |
| 81 } | 81 } |
| 82 | 82 |
| 83 rtree.insert(&rects, NUM_RECTS); | 83 rtree.insert(rects.get(), NUM_RECTS); |
| 84 SkASSERT(rects); // SkRTree doesn't take ownership of rects. | 84 SkASSERT(rects); // SkRTree doesn't take ownership of rects. |
| 85 | 85 |
| 86 run_queries(reporter, rand, rects, rtree); | 86 run_queries(reporter, rand, rects, rtree); |
| 87 REPORTER_ASSERT(reporter, NUM_RECTS == rtree.getCount()); | 87 REPORTER_ASSERT(reporter, NUM_RECTS == rtree.getCount()); |
| 88 REPORTER_ASSERT(reporter, expectedDepthMin <= rtree.getDepth() && | 88 REPORTER_ASSERT(reporter, expectedDepthMin <= rtree.getDepth() && |
| 89 expectedDepthMax >= rtree.getDepth()); | 89 expectedDepthMax >= rtree.getDepth()); |
| 90 } | 90 } |
| 91 } | 91 } |
| OLD | NEW |