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

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

Issue 131343011: Initial QuadTree implementation (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed SkScalar conversion issue Created 6 years, 10 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/SkQuadTreePicture.cpp ('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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 virtual ~SkRTree(); 60 virtual ~SkRTree();
61 61
62 /** 62 /**
63 * Insert a node, consisting of bounds and a data value into the tree, if we don't immediately 63 * Insert a node, consisting of bounds and a data value into the tree, if we don't immediately
64 * need to use the tree; we may allow the insert to be deferred (this can al low us to bulk-load 64 * need to use the tree; we may allow the insert to be deferred (this can al low us to bulk-load
65 * a large batch of nodes at once, which tends to be faster and produce a be tter tree). 65 * a large batch of nodes at once, which tends to be faster and produce a be tter tree).
66 * @param data The data value 66 * @param data The data value
67 * @param bounds The corresponding bounding box 67 * @param bounds The corresponding bounding box
68 * @param defer Can this insert be deferred? (this may be ignored) 68 * @param defer Can this insert be deferred? (this may be ignored)
69 */ 69 */
70 virtual void insert(void* data, const SkIRect& bounds, bool defer = false); 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(); 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); 80 virtual void search(const SkIRect& query, SkTDArray<void*>* results) SK_OVER RIDE;
81 81
82 virtual void clear(); 82 virtual void clear() SK_OVERRIDE;
83 bool isEmpty() const { return 0 == fCount; } 83 bool isEmpty() const { return 0 == fCount; }
84 int getDepth() const { return this->isEmpty() ? 0 : fRoot.fChild.subtree->fL evel + 1; } 84
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 }
85 91
86 /** 92 /**
87 * This gets the insertion count (rather than the node count) 93 * This gets the insertion count (rather than the node count)
88 */ 94 */
89 virtual int getCount() const { return fCount; } 95 virtual int getCount() const SK_OVERRIDE { return fCount; }
90 96
91 virtual void rewindInserts() SK_OVERRIDE; 97 virtual void rewindInserts() SK_OVERRIDE;
92 98
93 private: 99 private:
94 100
95 struct Node; 101 struct Node;
96 102
97 /** 103 /**
98 * A branch of the tree, this may contain a pointer to another interior node , or a data value 104 * A branch of the tree, this may contain a pointer to another interior node , or a data value
99 */ 105 */
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 SkTDArray<Branch> fDeferredInserts; 192 SkTDArray<Branch> fDeferredInserts;
187 SkScalar fAspectRatio; 193 SkScalar fAspectRatio;
188 bool fSortWhenBulkLoading; 194 bool fSortWhenBulkLoading;
189 195
190 Node* allocateNode(uint16_t level); 196 Node* allocateNode(uint16_t level);
191 197
192 typedef SkBBoxHierarchy INHERITED; 198 typedef SkBBoxHierarchy INHERITED;
193 }; 199 };
194 200
195 #endif 201 #endif
OLDNEW
« no previous file with comments | « src/core/SkQuadTreePicture.cpp ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698