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 SkSVGLinearGradient_DEFINED | 8 #ifndef SkSVGLinearGradient_DEFINED |
9 #define SkSVGLinearGradient_DEFINED | 9 #define SkSVGLinearGradient_DEFINED |
10 | 10 |
11 #include "SkSVGHiddenContainer.h" | 11 #include "SkSVGHiddenContainer.h" |
12 #include "SkSVGTypes.h" | 12 #include "SkSVGTypes.h" |
13 | 13 |
14 class SkSVGLinearGradient : public SkSVGHiddenContainer { | 14 class SkSVGLinearGradient : public SkSVGHiddenContainer { |
15 public: | 15 public: |
16 virtual ~SkSVGLinearGradient() = default; | 16 virtual ~SkSVGLinearGradient() = default; |
17 static sk_sp<SkSVGLinearGradient> Make() { | 17 static sk_sp<SkSVGLinearGradient> Make() { |
18 return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient()); | 18 return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient()); |
19 } | 19 } |
20 | 20 |
21 void setHref(const SkSVGStringType&); | 21 void setHref(const SkSVGStringType&); |
| 22 void setSpreadMethod(const SkSVGSpreadMethod&); |
22 void setX1(const SkSVGLength&); | 23 void setX1(const SkSVGLength&); |
23 void setY1(const SkSVGLength&); | 24 void setY1(const SkSVGLength&); |
24 void setX2(const SkSVGLength&); | 25 void setX2(const SkSVGLength&); |
25 void setY2(const SkSVGLength&); | 26 void setY2(const SkSVGLength&); |
26 | 27 |
27 protected: | 28 protected: |
28 bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const override; | 29 bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const override; |
29 | 30 |
30 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; | 31 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
31 | 32 |
32 private: | 33 private: |
33 SkSVGLinearGradient(); | 34 SkSVGLinearGradient(); |
34 | 35 |
35 void collectColorStops(const SkSVGRenderContext&, | 36 void collectColorStops(const SkSVGRenderContext&, |
36 SkSTArray<2, SkScalar, true>*, | 37 SkSTArray<2, SkScalar, true>*, |
37 SkSTArray<2, SkColor, true>*) const; | 38 SkSTArray<2, SkColor, true>*) const; |
38 | 39 |
39 SkSVGLength fX1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); | 40 SkSVGLength fX1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); |
40 SkSVGLength fY1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); | 41 SkSVGLength fY1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); |
41 SkSVGLength fX2 = SkSVGLength(100, SkSVGLength::Unit::kPercentage); | 42 SkSVGLength fX2 = SkSVGLength(100, SkSVGLength::Unit::kPercentage); |
42 SkSVGLength fY2 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); | 43 SkSVGLength fY2 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); |
43 | 44 |
44 SkSVGStringType fHref; | 45 SkSVGStringType fHref; |
| 46 SkSVGSpreadMethod fSpreadMethod = SkSVGSpreadMethod(SkSVGSpreadMethod::Type:
:kPad); |
45 | 47 |
46 typedef SkSVGHiddenContainer INHERITED; | 48 typedef SkSVGHiddenContainer INHERITED; |
47 }; | 49 }; |
48 | 50 |
49 #endif // SkSVGLinearGradient_DEFINED | 51 #endif // SkSVGLinearGradient_DEFINED |
OLD | NEW |