2 * Copyright 2014 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 SkBBHFactory_DEFINED
9 #define SkBBHFactory_DEFINED
14 class SkBBoxHierarchy;
16 class SK_API SkBBHFactory {
19 * Allocate a new SkBBoxHierarchy. Return NULL on failure.
21 virtual SkBBoxHierarchy* operator()(int width, int height) const = 0;
22 virtual ~SkBBHFactory() {};
25 class SK_API SkRTreeFactory : public SkBBHFactory {
27 virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
29 typedef SkBBHFactory INHERITED;
32 class SK_API SkTileGridFactory : public SkBBHFactory {
35 /** Tile placement interval */
36 SkISize fTileInterval;
38 /** Pixel coverage overlap between adjacent tiles */
41 /** Offset added to device-space bounding box positions to convert
42 * them to tile-grid space. This can be used to adjust the "phase"
43 * of the tile grid to match probable query rectangles that will be
44 * used to search into the tile grid. As long as the offset is smaller
45 * or equal to the margin, there is no need to extend the domain of
46 * the tile grid to prevent data loss.
51 SkTileGridFactory(const TileGridInfo& info) : fInfo(info) { }
53 virtual SkBBoxHierarchy* operator()(int width, int height) const SK_OVERRIDE;
58 typedef SkBBHFactory INHERITED;