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/SkBBoxHierarchy.h

Issue 639933003: Add SkBBoxHierarchy::reserve() as an optional size hint. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « no previous file | src/core/SkRecordDraw.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 SkBBoxHierarchy_DEFINED 9 #ifndef SkBBoxHierarchy_DEFINED
10 #define SkBBoxHierarchy_DEFINED 10 #define SkBBoxHierarchy_DEFINED
11 11
12 #include "SkRect.h" 12 #include "SkRect.h"
13 #include "SkTDArray.h" 13 #include "SkTDArray.h"
14 #include "SkRefCnt.h" 14 #include "SkRefCnt.h"
15 15
16 /** 16 /**
17 * Interface for a spatial data structure that associates user data with axis-al igned 17 * Interface for a spatial data structure that associates user data with axis-al igned
18 * bounding boxes, and allows efficient retrieval of intersections with query re ctangles. 18 * bounding boxes, and allows efficient retrieval of intersections with query re ctangles.
19 */ 19 */
20 class SkBBoxHierarchy : public SkRefCnt { 20 class SkBBoxHierarchy : public SkRefCnt {
21 public: 21 public:
22 SK_DECLARE_INST_COUNT(SkBBoxHierarchy) 22 SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
23 23
24 SkBBoxHierarchy() {} 24 SkBBoxHierarchy() {}
25 25
26 /** 26 /**
27 * Insert opIndex and corresponding bounding box 27 * Hint that <= opCount calls to insert() will be made.
28 */
29 virtual void reserve(unsigned opCount) {}
30
31 /**
32 * Insert opIndex and corresponding bounding box.
28 * @param opIndex Any value, will be returned in order. 33 * @param opIndex Any value, will be returned in order.
29 * @param bounds The bounding box, should not be empty 34 * @param bounds The bounding box, should not be empty.
30 * @param defer Whether or not it is acceptable to delay insertion of this e lement (building up 35 * @param defer Whether or not it is acceptable to delay insertion of this e lement (building up
31 * an entire spatial data structure at once is often faster and produ ces better 36 * an entire spatial data structure at once is often faster and produ ces better
32 * structures than repeated inserts) until flushDeferredInserts is ca lled or the first 37 * structures than repeated inserts) until flushDeferredInserts is ca lled or the first
33 * search. 38 * search.
34 */ 39 */
35 virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer = fal se) = 0; 40 virtual void insert(unsigned opIndex, const SkRect& bounds, bool defer = fal se) = 0;
36 41
37 /** 42 /**
38 * If any insertions have been deferred, this forces them to be inserted 43 * If any insertions have been deferred, force them to be inserted.
39 */ 44 */
40 virtual void flushDeferredInserts() = 0; 45 virtual void flushDeferredInserts() {}
41 46
42 /** 47 /**
43 * Populate results with sorted opIndex corresponding to bounding boxes that intersect query. 48 * Populate results with sorted opIndex corresponding to bounding boxes that intersect query.
44 */ 49 */
45 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const = 0; 50 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const = 0;
46 51
47 private: 52 private:
48 typedef SkRefCnt INHERITED; 53 typedef SkRefCnt INHERITED;
49 }; 54 };
50 55
51 #endif 56 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698