| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef SkRTree_DEFINED | 9 #ifndef SkRTree_DEFINED |
| 10 #define SkRTree_DEFINED | 10 #define SkRTree_DEFINED |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 SK_DECLARE_INST_COUNT(SkRTree) | 34 SK_DECLARE_INST_COUNT(SkRTree) |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * If you have some prior information about the distribution of bounds you'r
e expecting, you | 37 * If you have some prior information about the distribution of bounds you'r
e expecting, you |
| 38 * can provide an optional aspect ratio parameter. This allows the bulk-load
algorithm to | 38 * can provide an optional aspect ratio parameter. This allows the bulk-load
algorithm to |
| 39 * create better proportioned tiles of rectangles. | 39 * create better proportioned tiles of rectangles. |
| 40 */ | 40 */ |
| 41 explicit SkRTree(SkScalar aspectRatio = 1); | 41 explicit SkRTree(SkScalar aspectRatio = 1); |
| 42 virtual ~SkRTree() {} | 42 virtual ~SkRTree() {} |
| 43 | 43 |
| 44 void insert(const SkRect[], int N) SK_OVERRIDE; | 44 void insert(const SkRect[], int N) override; |
| 45 void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVER
RIDE; | 45 void search(const SkRect& query, SkTDArray<unsigned>* results) const overrid
e; |
| 46 size_t bytesUsed() const SK_OVERRIDE; | 46 size_t bytesUsed() const override; |
| 47 | 47 |
| 48 // Methods and constants below here are only public for tests. | 48 // Methods and constants below here are only public for tests. |
| 49 | 49 |
| 50 // Return the depth of the tree structure. | 50 // Return the depth of the tree structure. |
| 51 int getDepth() const { return fCount ? fRoot.fSubtree->fLevel + 1 : 0; } | 51 int getDepth() const { return fCount ? fRoot.fSubtree->fLevel + 1 : 0; } |
| 52 // Insertion count (not overall node count, which may be greater). | 52 // Insertion count (not overall node count, which may be greater). |
| 53 int getCount() const { return fCount; } | 53 int getCount() const { return fCount; } |
| 54 | 54 |
| 55 // Get the root bound. | 55 // Get the root bound. |
| 56 SkRect getRootBound() const SK_OVERRIDE; | 56 SkRect getRootBound() const override; |
| 57 | 57 |
| 58 // These values were empirically determined to produce reasonable performanc
e in most cases. | 58 // These values were empirically determined to produce reasonable performanc
e in most cases. |
| 59 static const int kMinChildren = 6, | 59 static const int kMinChildren = 6, |
| 60 kMaxChildren = 11; | 60 kMaxChildren = 11; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 struct Node; | 63 struct Node; |
| 64 | 64 |
| 65 struct Branch { | 65 struct Branch { |
| 66 union { | 66 union { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 89 // This is the count of data elements (rather than total nodes in the tree) | 89 // This is the count of data elements (rather than total nodes in the tree) |
| 90 int fCount; | 90 int fCount; |
| 91 SkScalar fAspectRatio; | 91 SkScalar fAspectRatio; |
| 92 Branch fRoot; | 92 Branch fRoot; |
| 93 SkTDArray<Node> fNodes; | 93 SkTDArray<Node> fNodes; |
| 94 | 94 |
| 95 typedef SkBBoxHierarchy INHERITED; | 95 typedef SkBBoxHierarchy INHERITED; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 #endif | 98 #endif |
| OLD | NEW |