Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 // Methods and constants below here are only public for tests. | 47 // Methods and constants below here are only public for tests. |
| 48 | 48 |
| 49 // Return the depth of the tree structure. | 49 // Return the depth of the tree structure. |
| 50 int getDepth() const { return fCount ? fRoot.fSubtree->fLevel + 1 : 0; } | 50 int getDepth() const { return fCount ? fRoot.fSubtree->fLevel + 1 : 0; } |
| 51 // Insertion count (not overall node count, which may be greater). | 51 // Insertion count (not overall node count, which may be greater). |
| 52 int getCount() const { return fCount; } | 52 int getCount() const { return fCount; } |
| 53 | 53 |
| 54 // These values were empirically determined to produce reasonable performanc e in most cases. | 54 // These values were empirically determined to produce reasonable performanc e in most cases. |
| 55 static const int kMinChildren = 6, | 55 static const int kMinChildren = 6, |
| 56 kMaxChildren = 11; | 56 kMaxChildren = 11; |
| 57 virtual size_t bytesUsed() const SK_OVERRIDE; | |
|
mtklein
2014/11/18 19:26:14
Might want to move this above the "only public for
tomhudson
2014/11/18 19:35:12
Since we don't really want this used for productio
mtklein
2014/11/18 19:41:58
Uh, okay, but that's a more confusing answer than
| |
| 58 | |
| 57 private: | 59 private: |
| 58 struct Node; | 60 struct Node; |
| 59 | 61 |
| 60 struct Branch { | 62 struct Branch { |
| 61 union { | 63 union { |
| 62 Node* fSubtree; | 64 Node* fSubtree; |
| 63 unsigned fOpIndex; | 65 unsigned fOpIndex; |
| 64 }; | 66 }; |
| 65 SkRect fBounds; | 67 SkRect fBounds; |
| 66 }; | 68 }; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 84 // This is the count of data elements (rather than total nodes in the tree) | 86 // This is the count of data elements (rather than total nodes in the tree) |
| 85 int fCount; | 87 int fCount; |
| 86 SkScalar fAspectRatio; | 88 SkScalar fAspectRatio; |
| 87 Branch fRoot; | 89 Branch fRoot; |
| 88 SkTDArray<Node> fNodes; | 90 SkTDArray<Node> fNodes; |
| 89 | 91 |
| 90 typedef SkBBoxHierarchy INHERITED; | 92 typedef SkBBoxHierarchy INHERITED; |
| 91 }; | 93 }; |
| 92 | 94 |
| 93 #endif | 95 #endif |
| OLD | NEW |