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 "Test.h" | 8 #include "Test.h" |
9 #include "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "SkQuadTree.h" | 10 #include "SkQuadTree.h" |
11 #include "SkRTree.h" | 11 #include "SkRTree.h" |
12 #include "SkTSort.h" | 12 #include "SkTSort.h" |
13 | 13 |
14 static const size_t RTREE_MIN_CHILDREN = 6; | 14 static const size_t RTREE_MIN_CHILDREN = 6; |
15 static const size_t RTREE_MAX_CHILDREN = 11; | 15 static const size_t RTREE_MAX_CHILDREN = 11; |
16 static const size_t QUADTREE_MIN_CHILDREN = 4; | 16 static const size_t QUADTREE_MIN_CHILDREN = 0; |
17 static const size_t QUADTREE_MAX_CHILDREN = 0; // No hard limit for quadtree | 17 static const size_t QUADTREE_MAX_CHILDREN = 0; // No hard limit for quadtree |
18 | 18 |
19 static const int NUM_RECTS = 200; | 19 static const int NUM_RECTS = 200; |
20 static const size_t NUM_ITERATIONS = 100; | 20 static const size_t NUM_ITERATIONS = 100; |
21 static const size_t NUM_QUERIES = 50; | 21 static const size_t NUM_QUERIES = 50; |
22 | 22 |
23 static const int MAX_SIZE = 1000; | 23 static const int MAX_SIZE = 1000; |
24 | 24 |
25 struct DataRect { | 25 struct DataRect { |
26 SkIRect rect; | 26 SkIRect rect; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 SkAutoUnref au(quadtree); | 171 SkAutoUnref au(quadtree); |
172 tree_test_main(quadtree, QUADTREE_MIN_CHILDREN, QUADTREE_MAX_CHILDREN, r
eporter); | 172 tree_test_main(quadtree, QUADTREE_MIN_CHILDREN, QUADTREE_MAX_CHILDREN, r
eporter); |
173 | 173 |
174 // QuadTree that orders input rectangles on deferred insert. | 174 // QuadTree that orders input rectangles on deferred insert. |
175 SkQuadTree* unsortedQuadTree = SkQuadTree::Create( | 175 SkQuadTree* unsortedQuadTree = SkQuadTree::Create( |
176 SkIRect::MakeLTRB(-MAX_SIZE, -MAX_SIZE, MAX_SIZE, MAX_SIZE)); | 176 SkIRect::MakeLTRB(-MAX_SIZE, -MAX_SIZE, MAX_SIZE, MAX_SIZE)); |
177 SkAutoUnref auo(unsortedQuadTree); | 177 SkAutoUnref auo(unsortedQuadTree); |
178 tree_test_main(unsortedQuadTree, QUADTREE_MIN_CHILDREN, QUADTREE_MAX_CHI
LDREN, reporter); | 178 tree_test_main(unsortedQuadTree, QUADTREE_MIN_CHILDREN, QUADTREE_MAX_CHI
LDREN, reporter); |
179 } | 179 } |
180 } | 180 } |
OLD | NEW |