aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkQuadTreePicture.h
blob: 5ebbef93cb20be08ec95cb163e2b631c4d48a4b2 (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
/*
 * 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 SkQuadTreePicture_DEFINED
#define SkQuadTreePicture_DEFINED

#ifdef SK_SUPPORT_LEGACY_PICTURE_HEADERS
#include "SkBBHFactory.h"
#endif

#ifdef SK_SUPPORT_LEGACY_DERIVED_PICTURE_CLASSES

#include "SkPicture.h"
#include "SkRect.h"

/**
 * Subclass of SkPicture that creates an SkQuadGrid
 * structure. The quad tree has generally faster
 * tree creation time, but slightly slower query times, as compared to
 * R-Tree, so some cases may be faster and some cases slower.
 */
class SK_API SkQuadTreePicture : public SkPicture {
public:
    SkQuadTreePicture(const SkIRect& bounds) : fBounds(bounds) {}
    virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
private:
    SkIRect fBounds;

    typedef SkPicture INHERITED;
};

class SkQuadTreePictureFactory : public SkPictureFactory {
public:
    SkQuadTreePictureFactory() {}

    virtual SkPicture* create(int width, int height) SK_OVERRIDE {
        return SkNEW_ARGS(SkQuadTreePicture, (SkIRect::MakeWH(width, height)));
    }

private:
    typedef SkPictureFactory INHERITED;
};

#endif

#endif