2 * Copyright 2012 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkBBoxHierarchy_DEFINED
9 #define SkBBoxHierarchy_DEFINED
13 #include "SkTDArray.h"
14 #include "SkTemplates.h"
17 * Interface for a spatial data structure that stores axis-aligned bounding
18 * boxes and allows efficient retrieval of intersections with query rectangles.
20 class SkBBoxHierarchy : public SkRefCnt {
23 virtual ~SkBBoxHierarchy() {}
26 * Insert N bounding boxes into the hierarchy.
27 * The SkBBoxHierarchy may take ownership of boundsArray by calling detach().
29 virtual void insert(SkAutoTMalloc<SkRect>* boundsArray, int N) = 0;
32 * Populate results with the indices of bounding boxes interesecting that query.
34 virtual void search(const SkRect& query, SkTDArray<unsigned>* results) const = 0;
36 SK_DECLARE_INST_COUNT(SkBBoxHierarchy)
38 typedef SkRefCnt INHERITED;