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

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

Issue 2202053002: [SVGDom/experimental] Initial SVGLength support (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/SkSVGShape.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
(Empty)
1 /*
2 * Copyright 2016 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef SkSVGTypes_DEFINED
9 #define SkSVGTypes_DEFINED
10
11 #include "SkColor.h"
12 #include "SkScalar.h"
13 #include "SkTypes.h"
14
15 class SkSVGNumber {
16 public:
17 constexpr SkSVGNumber() : fValue(0) {}
18 explicit constexpr SkSVGNumber(SkScalar v) : fValue(v) {}
19 SkSVGNumber(const SkSVGNumber&) = default;
20 SkSVGNumber& operator=(const SkSVGNumber&) = default;
21
22
23 const SkScalar& value() const { return fValue; }
24
25 operator const SkScalar&() const { return fValue; }
26
27 private:
28 SkScalar fValue;
29 };
30
31 class SkSVGLength {
32 public:
33 enum class Unit {
34 kUnknown,
35 kNumber,
36 kPercentage,
37 kEMS,
38 kEXS,
39 kPX,
40 kCM,
41 kMM,
42 kIN,
43 kPT,
44 kPC,
45 };
46
47 constexpr SkSVGLength() : fValue(0), fUnit(Unit::kUnknown ) {}
48 explicit constexpr SkSVGLength(SkScalar v, Unit u = Unit::kNumber)
49 : fValue(v), fUnit(u) {}
50 SkSVGLength(const SkSVGLength&) = default;
51 SkSVGLength& operator=(const SkSVGLength&) = default;
52
53 const SkScalar& value() const { return fValue; }
54 const Unit& unit() const { return fUnit; }
55
56 private:
57 SkScalar fValue;
58 Unit fUnit;
59 };
60
61 class SkSVGColor {
62 public:
63 constexpr SkSVGColor() : fValue(SK_ColorBLACK) {}
64 explicit constexpr SkSVGColor(SkColor c) : fValue(c) {}
65
66 operator const SkColor&() const { return fValue; }
67
68 private:
69 SkColor fValue;
70 };
71
72 #endif // SkSVGTypes_DEFINED
OLDNEW
« no previous file with comments | « experimental/svg/model/SkSVGShape.cpp ('k') | experimental/svg/model/SkSVGValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698