fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkSVGDOM_DEFINED |
| 9 | #define SkSVGDOM_DEFINED |
| 10 | |
| 11 | #include "SkRefCnt.h" |
| 12 | #include "SkSize.h" |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 13 | #include "SkSVGIDMapper.h" |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 14 | #include "SkTemplates.h" |
| 15 | |
| 16 | class SkCanvas; |
| 17 | class SkDOM; |
| 18 | class SkStream; |
| 19 | class SkSVGNode; |
| 20 | |
| 21 | class SkSVGDOM : public SkRefCnt { |
| 22 | public: |
fmalita | e1baa7c | 2016-09-14 12:04:30 -0700 | [diff] [blame] | 23 | SkSVGDOM(); |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 24 | ~SkSVGDOM() = default; |
| 25 | |
fmalita | e1baa7c | 2016-09-14 12:04:30 -0700 | [diff] [blame] | 26 | static sk_sp<SkSVGDOM> MakeFromDOM(const SkDOM&); |
| 27 | static sk_sp<SkSVGDOM> MakeFromStream(SkStream&); |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 28 | |
fmalita | e1baa7c | 2016-09-14 12:04:30 -0700 | [diff] [blame] | 29 | const SkSize& containerSize() const; |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 30 | void setContainerSize(const SkSize&); |
fmalita | e1baa7c | 2016-09-14 12:04:30 -0700 | [diff] [blame] | 31 | |
fmalita | ca39d71 | 2016-08-12 13:17:11 -0700 | [diff] [blame] | 32 | void setRoot(sk_sp<SkSVGNode>); |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 33 | |
| 34 | void render(SkCanvas*) const; |
| 35 | |
| 36 | private: |
fmalita | e1baa7c | 2016-09-14 12:04:30 -0700 | [diff] [blame] | 37 | SkSize intrinsicSize() const; |
| 38 | |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 39 | SkSize fContainerSize; |
| 40 | sk_sp<SkSVGNode> fRoot; |
fmalita | 28d5b72 | 2016-09-12 17:06:47 -0700 | [diff] [blame] | 41 | SkSVGIDMapper fIDMapper; |
fmalita | 6ceef3d | 2016-07-26 18:46:34 -0700 | [diff] [blame] | 42 | |
| 43 | typedef SkRefCnt INHERITED; |
| 44 | }; |
| 45 | |
| 46 | #endif // SkSVGDOM_DEFINED |