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

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

Issue 2235273003: [SVGDom] <polygon> & <polyline> support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: GN build fix 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/SkSVGPoly.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 "SkMatrix.h"
13 #include "SkPoint.h"
13 #include "SkRect.h" 14 #include "SkRect.h"
14 #include "SkScalar.h" 15 #include "SkScalar.h"
16 #include "SkTDArray.h"
15 #include "SkTypes.h" 17 #include "SkTypes.h"
16 18
17 template <typename T> 19 template <typename T>
18 class SkSVGPrimitiveTypeWrapper { 20 class SkSVGPrimitiveTypeWrapper {
19 public: 21 public:
20 SkSVGPrimitiveTypeWrapper() = default; 22 SkSVGPrimitiveTypeWrapper() = default;
21 explicit constexpr SkSVGPrimitiveTypeWrapper(T v) : fValue(v) {} 23 explicit constexpr SkSVGPrimitiveTypeWrapper(T v) : fValue(v) {}
22 24
23 SkSVGPrimitiveTypeWrapper(const SkSVGPrimitiveTypeWrapper&) = def ault; 25 SkSVGPrimitiveTypeWrapper(const SkSVGPrimitiveTypeWrapper&) = def ault;
24 SkSVGPrimitiveTypeWrapper& operator=(const SkSVGPrimitiveTypeWrapper&) = def ault; 26 SkSVGPrimitiveTypeWrapper& operator=(const SkSVGPrimitiveTypeWrapper&) = def ault;
27 SkSVGPrimitiveTypeWrapper& operator=(const T& v) { fValue = v; return *this; }
25 28
26 bool operator==(const SkSVGPrimitiveTypeWrapper<T>& other) const { 29 bool operator==(const SkSVGPrimitiveTypeWrapper<T>& other) const {
27 return fValue == other.fValue; 30 return fValue == other.fValue;
28 } 31 }
29 bool operator!=(const SkSVGPrimitiveTypeWrapper<T>& other) const { 32 bool operator!=(const SkSVGPrimitiveTypeWrapper<T>& other) const {
30 return !(*this == other); 33 return !(*this == other);
31 } 34 }
32 35
33 const T& value() const { return fValue; } 36 const T& value() const { return fValue; }
34 operator const T&() const { return fValue; } 37 operator const T&() const { return fValue; }
35 38
36 private: 39 private:
37 T fValue; 40 T fValue;
38 }; 41 };
39 42
40 using SkSVGColorType = SkSVGPrimitiveTypeWrapper<SkColor >; 43 using SkSVGColorType = SkSVGPrimitiveTypeWrapper<SkColor >;
41 using SkSVGNumberType = SkSVGPrimitiveTypeWrapper<SkScalar>; 44 using SkSVGNumberType = SkSVGPrimitiveTypeWrapper<SkScalar>;
42 using SkSVGViewBoxType = SkSVGPrimitiveTypeWrapper<SkRect >; 45 using SkSVGViewBoxType = SkSVGPrimitiveTypeWrapper<SkRect >;
43 using SkSVGTransformType = SkSVGPrimitiveTypeWrapper<SkMatrix>; 46 using SkSVGTransformType = SkSVGPrimitiveTypeWrapper<SkMatrix>;
47 using SkSVGPointsType = SkSVGPrimitiveTypeWrapper<SkTDArray<SkPoint>>;
44 48
45 class SkSVGLength { 49 class SkSVGLength {
46 public: 50 public:
47 enum class Unit { 51 enum class Unit {
48 kUnknown, 52 kUnknown,
49 kNumber, 53 kNumber,
50 kPercentage, 54 kPercentage,
51 kEMS, 55 kEMS,
52 kEXS, 56 kEXS,
53 kPX, 57 kPX,
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 bool operator==(const SkSVGLineJoin& other) const { return fType == other.fT ype; } 153 bool operator==(const SkSVGLineJoin& other) const { return fType == other.fT ype; }
150 bool operator!=(const SkSVGLineJoin& other) const { return !(*this == other) ; } 154 bool operator!=(const SkSVGLineJoin& other) const { return !(*this == other) ; }
151 155
152 Type type() const { return fType; } 156 Type type() const { return fType; }
153 157
154 private: 158 private:
155 Type fType; 159 Type fType;
156 }; 160 };
157 161
158 #endif // SkSVGTypes_DEFINED 162 #endif // SkSVGTypes_DEFINED
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGPoly.cpp ('k') | experimental/svg/model/SkSVGValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698