aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/svg/model/SkSVGDOM.h
blob: 8904c1799d38b1229b34ee17d8f332f70e4b7c4a (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
/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkSVGDOM_DEFINED
#define SkSVGDOM_DEFINED

#include "SkRefCnt.h"
#include "SkSize.h"
#include "SkSVGIDMapper.h"
#include "SkTemplates.h"

class SkCanvas;
class SkDOM;
class SkStream;
class SkSVGNode;

class SkSVGDOM : public SkRefCnt {
public:
    SkSVGDOM();
    ~SkSVGDOM() = default;

    static sk_sp<SkSVGDOM> MakeFromDOM(const SkDOM&);
    static sk_sp<SkSVGDOM> MakeFromStream(SkStream&);

    const SkSize& containerSize() const;
    void setContainerSize(const SkSize&);

    void setRoot(sk_sp<SkSVGNode>);

    void render(SkCanvas*) const;

private:
    SkSize intrinsicSize() const;

    SkSize           fContainerSize;
    sk_sp<SkSVGNode> fRoot;
    SkSVGIDMapper    fIDMapper;

    typedef SkRefCnt INHERITED;
};

#endif // SkSVGDOM_DEFINED