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 | 14 |
14 class SkSVGSVG : public SkSVGContainer { | 15 class SkSVGSVG : public SkSVGContainer { |
15 public: | 16 public: |
16 virtual ~SkSVGSVG() = default; | 17 virtual ~SkSVGSVG() = default; |
17 | 18 |
18 static sk_sp<SkSVGSVG> Make() { return sk_sp<SkSVGSVG>(new SkSVGSVG()); } | 19 static sk_sp<SkSVGSVG> Make() { return sk_sp<SkSVGSVG>(new SkSVGSVG()); } |
19 | 20 |
20 void setX(const SkSVGLength&); | 21 void setX(const SkSVGLength&); |
21 void setY(const SkSVGLength&); | 22 void setY(const SkSVGLength&); |
22 void setWidth(const SkSVGLength&); | 23 void setWidth(const SkSVGLength&); |
23 void setHeight(const SkSVGLength&); | 24 void setHeight(const SkSVGLength&); |
| 25 void setViewBox(const SkSVGViewBoxType&); |
24 | 26 |
25 protected: | 27 protected: |
| 28 bool onPrepareToRender(SkSVGRenderContext*) const override; |
| 29 |
26 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; | 30 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
27 | 31 |
28 private: | 32 private: |
29 SkSVGSVG(); | 33 SkSVGSVG(); |
30 | 34 |
31 SkSVGLength fX = SkSVGLength(0); | 35 SkSVGLength fX = SkSVGLength(0); |
32 SkSVGLength fY = SkSVGLength(0); | 36 SkSVGLength fY = SkSVGLength(0); |
33 SkSVGLength fWidth = SkSVGLength(100, SkSVGLength::Unit::kPercentage); | 37 SkSVGLength fWidth = SkSVGLength(100, SkSVGLength::Unit::kPercentage); |
34 SkSVGLength fHeight = SkSVGLength(100, SkSVGLength::Unit::kPercentage); | 38 SkSVGLength fHeight = SkSVGLength(100, SkSVGLength::Unit::kPercentage); |
35 | 39 |
| 40 SkTLazy<SkSVGViewBoxType> fViewBox; |
| 41 |
36 typedef SkSVGContainer INHERITED; | 42 typedef SkSVGContainer INHERITED; |
37 }; | 43 }; |
38 | 44 |
39 #endif // SkSVGSVG_DEFINED | 45 #endif // SkSVGSVG_DEFINED |
OLD | NEW |