Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: experimental/svg/model/SkSVGTypes.h

Issue 2220933003: [SVGDom] Improved transform parsing (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « experimental/svg/model/SkSVGTransformableNode.cpp ('k') | experimental/svg/model/SkSVGValue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGTransformableNode.cpp ('k') | experimental/svg/model/SkSVGValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698