Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/core/SkRTree.h

Issue 622773003: Demote getCount, getDepth, and clear to RTree-only methods. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: dox Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBBoxHierarchy.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 /** 72 /**
73 * If any inserts have been deferred, this will add them into the tree 73 * If any inserts have been deferred, this will add them into the tree
74 */ 74 */
75 virtual void flushDeferredInserts() SK_OVERRIDE; 75 virtual void flushDeferredInserts() SK_OVERRIDE;
76 76
77 /** 77 /**
78 * Given a query rectangle, populates the passed-in array with the elements it intersects 78 * Given a query rectangle, populates the passed-in array with the elements it intersects
79 */ 79 */
80 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE; 80 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const SK_OVERRIDE;
81 81
82 virtual void clear() SK_OVERRIDE; 82 void clear();
83 bool isEmpty() const { return 0 == fCount; } 83 // Return the depth of the tree structure.
84 84 int getDepth() const { return this->isEmpty() ? 0 : fRoot.fChild.subtree->fL evel + 1; }
85 /** 85 // Insertion count (not overall node count, which may be greater).
86 * Gets the depth of the tree structure 86 int getCount() const { return fCount; }
87 */
88 virtual int getDepth() const SK_OVERRIDE {
89 return this->isEmpty() ? 0 : fRoot.fChild.subtree->fLevel + 1;
90 }
91
92 /**
93 * This gets the insertion count (rather than the node count)
94 */
95 virtual int getCount() const SK_OVERRIDE { return fCount; }
96 87
97 private: 88 private:
89 bool isEmpty() const { return 0 == this->getCount(); }
98 90
99 struct Node; 91 struct Node;
100 92
101 /** 93 /**
102 * A branch of the tree, this may contain a pointer to another interior node , or a data value 94 * A branch of the tree, this may contain a pointer to another interior node , or a data value
103 */ 95 */
104 struct Branch { 96 struct Branch {
105 union { 97 union {
106 Node* subtree; 98 Node* subtree;
107 unsigned opIndex; 99 unsigned opIndex;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 SkTDArray<Branch> fDeferredInserts; 182 SkTDArray<Branch> fDeferredInserts;
191 SkScalar fAspectRatio; 183 SkScalar fAspectRatio;
192 bool fSortWhenBulkLoading; 184 bool fSortWhenBulkLoading;
193 185
194 Node* allocateNode(uint16_t level); 186 Node* allocateNode(uint16_t level);
195 187
196 typedef SkBBoxHierarchy INHERITED; 188 typedef SkBBoxHierarchy INHERITED;
197 }; 189 };
198 190
199 #endif 191 #endif
OLDNEW
« no previous file with comments | « src/core/SkBBoxHierarchy.h ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698