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 SkSVGTypes_DEFINED | 8 #ifndef SkSVGTypes_DEFINED |
9 #define SkSVGTypes_DEFINED | 9 #define SkSVGTypes_DEFINED |
10 | 10 |
11 #include "SkColor.h" | 11 #include "SkColor.h" |
| 12 #include "SkMatrix.h" |
12 #include "SkRect.h" | 13 #include "SkRect.h" |
13 #include "SkScalar.h" | 14 #include "SkScalar.h" |
14 #include "SkTypes.h" | 15 #include "SkTypes.h" |
15 | 16 |
16 template <typename T> | 17 template <typename T> |
17 class SkSVGPrimitiveTypeWrapper { | 18 class SkSVGPrimitiveTypeWrapper { |
18 public: | 19 public: |
19 SkSVGPrimitiveTypeWrapper() = default; | 20 SkSVGPrimitiveTypeWrapper() = default; |
20 explicit constexpr SkSVGPrimitiveTypeWrapper(T v) : fValue(v) {} | 21 explicit constexpr SkSVGPrimitiveTypeWrapper(T v) : fValue(v) {} |
21 | 22 |
22 SkSVGPrimitiveTypeWrapper(const SkSVGPrimitiveTypeWrapper&) = def
ault; | 23 SkSVGPrimitiveTypeWrapper(const SkSVGPrimitiveTypeWrapper&) = def
ault; |
23 SkSVGPrimitiveTypeWrapper& operator=(const SkSVGPrimitiveTypeWrapper&) = def
ault; | 24 SkSVGPrimitiveTypeWrapper& operator=(const SkSVGPrimitiveTypeWrapper&) = def
ault; |
24 | 25 |
25 const T& value() const { return fValue; } | 26 const T& value() const { return fValue; } |
26 operator const T&() const { return fValue; } | 27 operator const T&() const { return fValue; } |
27 | 28 |
28 private: | 29 private: |
29 T fValue; | 30 T fValue; |
30 }; | 31 }; |
31 | 32 |
32 using SkSVGColorType = SkSVGPrimitiveTypeWrapper<SkColor >; | 33 using SkSVGColorType = SkSVGPrimitiveTypeWrapper<SkColor >; |
33 using SkSVGNumberType = SkSVGPrimitiveTypeWrapper<SkScalar>; | 34 using SkSVGNumberType = SkSVGPrimitiveTypeWrapper<SkScalar>; |
34 using SkSVGViewBoxType = SkSVGPrimitiveTypeWrapper<SkRect >; | 35 using SkSVGViewBoxType = SkSVGPrimitiveTypeWrapper<SkRect >; |
| 36 using SkSVGTransformType = SkSVGPrimitiveTypeWrapper<SkMatrix>; |
35 | 37 |
36 class SkSVGLength { | 38 class SkSVGLength { |
37 public: | 39 public: |
38 enum class Unit { | 40 enum class Unit { |
39 kUnknown, | 41 kUnknown, |
40 kNumber, | 42 kNumber, |
41 kPercentage, | 43 kPercentage, |
42 kEMS, | 44 kEMS, |
43 kEXS, | 45 kEXS, |
44 kPX, | 46 kPX, |
(...skipping 12 matching lines...) Expand all Loading... |
57 | 59 |
58 const SkScalar& value() const { return fValue; } | 60 const SkScalar& value() const { return fValue; } |
59 const Unit& unit() const { return fUnit; } | 61 const Unit& unit() const { return fUnit; } |
60 | 62 |
61 private: | 63 private: |
62 SkScalar fValue; | 64 SkScalar fValue; |
63 Unit fUnit; | 65 Unit fUnit; |
64 }; | 66 }; |
65 | 67 |
66 #endif // SkSVGTypes_DEFINED | 68 #endif // SkSVGTypes_DEFINED |
OLD | NEW |