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

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: 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
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
robertphillips 2014/10/02 16:07:58 keep the comments?
mtklein 2014/10/02 16:14:39 Done.
82 virtual void clear() SK_OVERRIDE; 82 int getDepth() const { return 0 == fCount ? 0 : fRoot.fChild.subtree->fLevel + 1; }
83 bool isEmpty() const { return 0 == fCount; } 83 int getCount() const { return fCount; }
84 84 void clear();
85 /**
86 * Gets the depth of the tree structure
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 85
97 private: 86 private:
87 bool isEmpty() const { return 0 == this->getCount(); }
98 88
99 struct Node; 89 struct Node;
100 90
101 /** 91 /**
102 * A branch of the tree, this may contain a pointer to another interior node , or a data value 92 * A branch of the tree, this may contain a pointer to another interior node , or a data value
103 */ 93 */
104 struct Branch { 94 struct Branch {
105 union { 95 union {
106 Node* subtree; 96 Node* subtree;
107 unsigned opIndex; 97 unsigned opIndex;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 SkTDArray<Branch> fDeferredInserts; 180 SkTDArray<Branch> fDeferredInserts;
191 SkScalar fAspectRatio; 181 SkScalar fAspectRatio;
192 bool fSortWhenBulkLoading; 182 bool fSortWhenBulkLoading;
193 183
194 Node* allocateNode(uint16_t level); 184 Node* allocateNode(uint16_t level);
195 185
196 typedef SkBBoxHierarchy INHERITED; 186 typedef SkBBoxHierarchy INHERITED;
197 }; 187 };
198 188
199 #endif 189 #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