| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkBBoxHierarchy_DEFINED | 8 #ifndef SkBBoxHierarchy_DEFINED |
| 9 #define SkBBoxHierarchy_DEFINED | 9 #define SkBBoxHierarchy_DEFINED |
| 10 | 10 |
| 11 #include "SkRect.h" | 11 #include "SkRect.h" |
| 12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
| 13 #include "SkTDArray.h" | 13 #include "SkTDArray.h" |
| 14 #include "SkTemplates.h" | 14 #include "SkTemplates.h" |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * Interface for a spatial data structure that stores axis-aligned bounding | 17 * Interface for a spatial data structure that stores axis-aligned bounding |
| 18 * boxes and allows efficient retrieval of intersections with query rectangles. | 18 * boxes and allows efficient retrieval of intersections with query rectangles. |
| 19 */ | 19 */ |
| 20 class SkBBoxHierarchy : public SkRefCnt { | 20 class SkBBoxHierarchy : public SkRefCnt { |
| 21 public: | 21 public: |
| 22 SkBBoxHierarchy() {} | 22 SkBBoxHierarchy() {} |
| 23 virtual ~SkBBoxHierarchy() {} | 23 virtual ~SkBBoxHierarchy() {} |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Insert N bounding boxes into the hierarchy. | 26 * Insert N bounding boxes into the hierarchy. |
| 27 * The SkBBoxHierarchy may take ownership of boundsArray by calling detach()
. | |
| 28 */ | 27 */ |
| 29 virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) = 0; | 28 virtual void insert(const SkRect[], int N) = 0; |
| 30 | 29 |
| 31 /** | 30 /** |
| 32 * Populate results with the indices of bounding boxes interesecting that qu
ery. | 31 * Populate results with the indices of bounding boxes interesecting that qu
ery. |
| 33 */ | 32 */ |
| 34 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
= 0; | 33 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const
= 0; |
| 35 | 34 |
| 36 virtual size_t bytesUsed() const = 0; | 35 virtual size_t bytesUsed() const = 0; |
| 37 | 36 |
| 38 SK_DECLARE_INST_COUNT(SkBBoxHierarchy) | 37 SK_DECLARE_INST_COUNT(SkBBoxHierarchy) |
| 39 private: | 38 private: |
| 40 typedef SkRefCnt INHERITED; | 39 typedef SkRefCnt INHERITED; |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 #endif | 42 #endif |
| OLD | NEW |