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 452233002: Make BBH::search() const. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More const for tile() Created 6 years, 4 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/SkQuadTree.cpp ('k') | src/core/SkRTree.cpp » ('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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 virtual void insert(void* data, const SkIRect& bounds, bool defer = false) S K_OVERRIDE; 70 virtual void insert(void* data, const SkIRect& bounds, bool defer = false) S K_OVERRIDE;
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 SkIRect& query, SkTDArray<void*>* results) SK_OVER RIDE; 80 virtual void search(const SkIRect& query, SkTDArray<void*>* results) const S K_OVERRIDE;
81 81
82 virtual void clear() SK_OVERRIDE; 82 virtual void clear() SK_OVERRIDE;
83 bool isEmpty() const { return 0 == fCount; } 83 bool isEmpty() const { return 0 == fCount; }
84 84
85 /** 85 /**
86 * Gets the depth of the tree structure 86 * Gets the depth of the tree structure
87 */ 87 */
88 virtual int getDepth() const SK_OVERRIDE { 88 virtual int getDepth() const SK_OVERRIDE {
89 return this->isEmpty() ? 0 : fRoot.fChild.subtree->fLevel + 1; 89 return this->isEmpty() ? 0 : fRoot.fChild.subtree->fLevel + 1;
90 } 90 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 * repeated insertions. 170 * repeated insertions.
171 * 171 *
172 * This consumes the input array. 172 * This consumes the input array.
173 * 173 *
174 * TODO: Experiment with other bulk-load algorithms (in particular the Hilbe rt pack variant, 174 * TODO: Experiment with other bulk-load algorithms (in particular the Hilbe rt pack variant,
175 * which groups rects by position on the Hilbert curve, is probably worth a look). There also 175 * which groups rects by position on the Hilbert curve, is probably worth a look). There also
176 * exist top-down bulk load variants (VAMSplit, TopDownGreedy, etc). 176 * exist top-down bulk load variants (VAMSplit, TopDownGreedy, etc).
177 */ 177 */
178 Branch bulkLoad(SkTDArray<Branch>* branches, int level = 0); 178 Branch bulkLoad(SkTDArray<Branch>* branches, int level = 0);
179 179
180 void validate(); 180 void validate() const;
181 int validateSubtree(Node* root, SkIRect bounds, bool isRoot = false); 181 int validateSubtree(Node* root, SkIRect bounds, bool isRoot = false) const;
182 182
183 const int fMinChildren; 183 const int fMinChildren;
184 const int fMaxChildren; 184 const int fMaxChildren;
185 const size_t fNodeSize; 185 const size_t fNodeSize;
186 186
187 // This is the count of data elements (rather than total nodes in the tree) 187 // This is the count of data elements (rather than total nodes in the tree)
188 int fCount; 188 int fCount;
189 189
190 Branch fRoot; 190 Branch fRoot;
191 SkChunkAlloc fNodes; 191 SkChunkAlloc fNodes;
192 SkTDArray<Branch> fDeferredInserts; 192 SkTDArray<Branch> fDeferredInserts;
193 SkScalar fAspectRatio; 193 SkScalar fAspectRatio;
194 bool fSortWhenBulkLoading; 194 bool fSortWhenBulkLoading;
195 195
196 Node* allocateNode(uint16_t level); 196 Node* allocateNode(uint16_t level);
197 197
198 typedef SkBBoxHierarchy INHERITED; 198 typedef SkBBoxHierarchy INHERITED;
199 }; 199 };
200 200
201 #endif 201 #endif
OLDNEW
« no previous file with comments | « src/core/SkQuadTree.cpp ('k') | src/core/SkRTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698