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 SkSVGAttribute_DEFINED | 8 #ifndef SkSVGAttribute_DEFINED |
9 #define SkSVGAttribute_DEFINED | 9 #define SkSVGAttribute_DEFINED |
10 | 10 |
11 #include "SkSVGTypes.h" | 11 #include "SkSVGTypes.h" |
12 #include "SkTLazy.h" | 12 #include "SkTLazy.h" |
13 | 13 |
14 class SkSVGRenderContext; | 14 class SkSVGRenderContext; |
15 | 15 |
16 enum class SkSVGAttribute { | 16 enum class SkSVGAttribute { |
17 kD, | 17 kD, |
18 kFill, | 18 kFill, |
| 19 kFillOpacity, |
19 kHeight, | 20 kHeight, |
20 kRx, | 21 kRx, |
21 kRy, | 22 kRy, |
22 kStroke, | 23 kStroke, |
| 24 kStrokeOpacity, |
| 25 kStrokeLineCap, |
| 26 kStrokeLineJoin, |
| 27 kStrokeWidth, |
23 kTransform, | 28 kTransform, |
24 kViewBox, | 29 kViewBox, |
25 kWidth, | 30 kWidth, |
26 kX, | 31 kX, |
27 kY, | 32 kY, |
28 | 33 |
29 kUnknown, | 34 kUnknown, |
30 }; | 35 }; |
31 | 36 |
32 class SkSVGPresentationAttributes { | 37 struct SkSVGPresentationAttributes { |
33 public: | 38 static SkSVGPresentationAttributes MakeInitial(); |
34 SkSVGPresentationAttributes(); | |
35 | 39 |
36 void setFill(const SkSVGColorType&); | 40 // TODO: SkTLazy adds an extra ptr per attribute; refactor to reduce overhea
d. |
37 void setStroke(const SkSVGColorType&); | |
38 | 41 |
39 void applyTo(SkSVGRenderContext*) const; | 42 SkTLazy<SkSVGPaint> fFill; |
| 43 SkTLazy<SkSVGNumberType> fFillOpacity; |
40 | 44 |
41 private: | 45 SkTLazy<SkSVGPaint> fStroke; |
42 // Color only for now. | 46 SkTLazy<SkSVGLineCap> fStrokeLineCap; |
43 SkSVGColorType fFill; | 47 SkTLazy<SkSVGLineJoin> fStrokeLineJoin; |
44 SkSVGColorType fStroke; | 48 SkTLazy<SkSVGNumberType> fStrokeOpacity; |
45 | 49 SkTLazy<SkSVGLength> fStrokeWidth; |
46 unsigned fFillIsSet : 1; | |
47 unsigned fStrokeIsSet : 1; | |
48 }; | 50 }; |
49 | 51 |
50 #endif // SkSVGAttribute_DEFINED | 52 #endif // SkSVGAttribute_DEFINED |
OLD | NEW |