aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkBBHFactory.h
blob: 29c40ee951afb36764907353c16f9fa293b782c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright 2014 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkBBHFactory_DEFINED
#define SkBBHFactory_DEFINED

#include "SkSize.h"
#include "SkRect.h"

class SkBBoxHierarchy;

class SK_API SkBBHFactory {
public:
    /**
     *  Allocate a new SkBBoxHierarchy. Return NULL on failure.
     */
    virtual SkBBoxHierarchy* operator()(const SkRect& bounds) const = 0;
    virtual ~SkBBHFactory() {};
};

class SK_API SkRTreeFactory : public SkBBHFactory {
public:
    virtual SkBBoxHierarchy* operator()(const SkRect& bounds) const SK_OVERRIDE;
private:
    typedef SkBBHFactory INHERITED;
};

// TODO(mtklein): delete entirely when Chromium's clean for TileGridInfo
class SK_API SkTileGridFactory {
public:
    struct TileGridInfo {
        /** Tile placement interval */
        SkISize  fTileInterval;

        /** Pixel coverage overlap between adjacent tiles */
        SkISize  fMargin;

        /** Offset added to device-space bounding box positions to convert
          * them to tile-grid space. This can be used to adjust the "phase"
          * of the tile grid to match probable query rectangles that will be
          * used to search into the tile grid. As long as the offset is smaller
          * or equal to the margin, there is no need to extend the domain of
          * the tile grid to prevent data loss.
          */
        SkIPoint fOffset;
    };
};

#endif