OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkSVGSVG_DEFINED | 8 #ifndef SkSVGSVG_DEFINED |
9 #define SkSVGSVG_DEFINED | 9 #define SkSVGSVG_DEFINED |
10 | 10 |
11 #include "SkSVGContainer.h" | 11 #include "SkSVGContainer.h" |
12 #include "SkSVGTypes.h" | 12 #include "SkSVGTypes.h" |
13 #include "SkTLazy.h" | 13 #include "SkTLazy.h" |
14 | 14 |
| 15 class SkSVGLengthContext; |
| 16 |
15 class SkSVGSVG : public SkSVGContainer { | 17 class SkSVGSVG : public SkSVGContainer { |
16 public: | 18 public: |
17 virtual ~SkSVGSVG() = default; | 19 virtual ~SkSVGSVG() = default; |
18 | 20 |
19 static sk_sp<SkSVGSVG> Make() { return sk_sp<SkSVGSVG>(new SkSVGSVG()); } | 21 static sk_sp<SkSVGSVG> Make() { return sk_sp<SkSVGSVG>(new SkSVGSVG()); } |
20 | 22 |
21 void setX(const SkSVGLength&); | 23 void setX(const SkSVGLength&); |
22 void setY(const SkSVGLength&); | 24 void setY(const SkSVGLength&); |
23 void setWidth(const SkSVGLength&); | 25 void setWidth(const SkSVGLength&); |
24 void setHeight(const SkSVGLength&); | 26 void setHeight(const SkSVGLength&); |
25 void setViewBox(const SkSVGViewBoxType&); | 27 void setViewBox(const SkSVGViewBoxType&); |
26 | 28 |
| 29 SkSize intrinsicSize(const SkSVGLengthContext&) const; |
| 30 |
27 protected: | 31 protected: |
28 bool onPrepareToRender(SkSVGRenderContext*) const override; | 32 bool onPrepareToRender(SkSVGRenderContext*) const override; |
29 | 33 |
30 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; | 34 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
31 | 35 |
32 private: | 36 private: |
33 SkSVGSVG(); | 37 SkSVGSVG(); |
34 | 38 |
35 SkSVGLength fX = SkSVGLength(0); | 39 SkSVGLength fX = SkSVGLength(0); |
36 SkSVGLength fY = SkSVGLength(0); | 40 SkSVGLength fY = SkSVGLength(0); |
37 SkSVGLength fWidth = SkSVGLength(100, SkSVGLength::Unit::kPercentage); | 41 SkSVGLength fWidth = SkSVGLength(100, SkSVGLength::Unit::kPercentage); |
38 SkSVGLength fHeight = SkSVGLength(100, SkSVGLength::Unit::kPercentage); | 42 SkSVGLength fHeight = SkSVGLength(100, SkSVGLength::Unit::kPercentage); |
39 | 43 |
40 SkTLazy<SkSVGViewBoxType> fViewBox; | 44 SkTLazy<SkSVGViewBoxType> fViewBox; |
41 | 45 |
42 typedef SkSVGContainer INHERITED; | 46 typedef SkSVGContainer INHERITED; |
43 }; | 47 }; |
44 | 48 |
45 #endif // SkSVGSVG_DEFINED | 49 #endif // SkSVGSVG_DEFINED |
OLD | NEW |