Chromium Code Reviews| OLD | NEW |
|---|---|
| (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: | |
|
robertphillips
2016/08/02 22:25:56
Make these two one line each ?
f(malita)
2016/08/03 16:50:52
Done.
| |
| 17 constexpr SkSVGNumber() | |
| 18 : fValue(0) {} | |
| 19 explicit constexpr SkSVGNumber(SkScalar v) | |
| 20 : fValue(v) {} | |
| 21 SkSVGNumber(const SkSVGNumber&) = default; | |
| 22 SkSVGNumber& operator=(const SkSVGNumber&) = default; | |
| 23 | |
| 24 | |
| 25 const SkScalar& value() const { return fValue; } | |
| 26 | |
| 27 operator const SkScalar&() const { return fValue; } | |
| 28 | |
| 29 private: | |
| 30 SkScalar fValue; | |
| 31 }; | |
| 32 | |
| 33 class SkSVGLength { | |
| 34 public: | |
| 35 enum class Unit { | |
| 36 kUnknown, | |
| 37 kNumber, | |
| 38 kPercentage, | |
| 39 kEMS, | |
| 40 kEXS, | |
| 41 kPX, | |
| 42 kCM, | |
| 43 kMM, | |
| 44 kIN, | |
| 45 kPT, | |
| 46 kPC, | |
| 47 }; | |
| 48 | |
|
robertphillips
2016/08/02 22:25:56
single line this guy ?
f(malita)
2016/08/03 16:50:52
Done.
| |
| 49 constexpr SkSVGLength() | |
| 50 : fValue(0), fUnit(Unit::kUnknown) {} | |
| 51 explicit constexpr SkSVGLength(SkScalar v, Unit u = Unit::kNumber) | |
| 52 : fValue(v), fUnit(u) {} | |
| 53 SkSVGLength(const SkSVGLength&) = default; | |
| 54 SkSVGLength& operator=(const SkSVGLength&) = default; | |
| 55 | |
| 56 const SkScalar& value() const { return fValue; } | |
| 57 const Unit& unit() const { return fUnit; } | |
| 58 | |
| 59 private: | |
| 60 SkScalar fValue; | |
| 61 Unit fUnit; | |
| 62 }; | |
| 63 | |
| 64 class SkSVGColor { | |
| 65 public: | |
|
robertphillips
2016/08/02 22:25:56
single lines ?
f(malita)
2016/08/03 16:50:52
Done.
| |
| 66 constexpr SkSVGColor() | |
| 67 : fValue(SK_ColorBLACK) {} | |
| 68 explicit constexpr SkSVGColor(SkColor c) | |
| 69 : fValue(c) {} | |
| 70 | |
| 71 operator const SkColor&() const { return fValue; } | |
| 72 | |
| 73 private: | |
| 74 SkColor fValue; | |
| 75 }; | |
| 76 | |
| 77 #endif // SkSVGTypes_DEFINED | |
| OLD | NEW |