| Index: experimental/svg/model/SkSVGTypes.h
|
| diff --git a/experimental/svg/model/SkSVGTypes.h b/experimental/svg/model/SkSVGTypes.h
|
| index b2e2db10764860a2b90d57ee286749f02b937c09..c8330e1088960789cef4b60ae8728ff3328b57c2 100644
|
| --- a/experimental/svg/model/SkSVGTypes.h
|
| +++ b/experimental/svg/model/SkSVGTypes.h
|
| @@ -23,6 +23,13 @@ public:
|
| SkSVGPrimitiveTypeWrapper(const SkSVGPrimitiveTypeWrapper&) = default;
|
| SkSVGPrimitiveTypeWrapper& operator=(const SkSVGPrimitiveTypeWrapper&) = default;
|
|
|
| + bool operator==(const SkSVGPrimitiveTypeWrapper<T>& other) const {
|
| + return fValue == other.fValue;
|
| + }
|
| + bool operator!=(const SkSVGPrimitiveTypeWrapper<T>& other) const {
|
| + return !(*this == other);
|
| + }
|
| +
|
| const T& value() const { return fValue; }
|
| operator const T&() const { return fValue; }
|
|
|
| @@ -57,6 +64,11 @@ public:
|
| SkSVGLength(const SkSVGLength&) = default;
|
| SkSVGLength& operator=(const SkSVGLength&) = default;
|
|
|
| + bool operator==(const SkSVGLength& other) const {
|
| + return fUnit == other.fUnit && fValue == other.fValue;
|
| + }
|
| + bool operator!=(const SkSVGLength& other) const { return !(*this == other); }
|
| +
|
| const SkScalar& value() const { return fValue; }
|
| const Unit& unit() const { return fUnit; }
|
|
|
| @@ -65,4 +77,82 @@ private:
|
| Unit fUnit;
|
| };
|
|
|
| +class SkSVGPaint {
|
| +public:
|
| + enum class Type {
|
| + kNone,
|
| + kCurrentColor,
|
| + kColor,
|
| + kInherit,
|
| + };
|
| +
|
| + constexpr SkSVGPaint() : fType(Type::kInherit), fColor(SK_ColorBLACK) {}
|
| + explicit constexpr SkSVGPaint(Type t) : fType(t), fColor(SK_ColorBLACK) {}
|
| + explicit constexpr SkSVGPaint(const SkSVGColorType& c) : fType(Type::kColor), fColor(c) {}
|
| +
|
| + SkSVGPaint(const SkSVGPaint&) = default;
|
| + SkSVGPaint& operator=(const SkSVGPaint&) = default;
|
| +
|
| + bool operator==(const SkSVGPaint& other) const {
|
| + return fType == other.fType && fColor == other.fColor;
|
| + }
|
| + bool operator!=(const SkSVGPaint& other) const { return !(*this == other); }
|
| +
|
| + Type type() const { return fType; }
|
| + const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; }
|
| +
|
| +private:
|
| + Type fType;
|
| +
|
| + SkSVGColorType fColor;
|
| +};
|
| +
|
| +class SkSVGLineCap {
|
| +public:
|
| + enum class Type {
|
| + kButt,
|
| + kRound,
|
| + kSquare,
|
| + kInherit,
|
| + };
|
| +
|
| + constexpr SkSVGLineCap() : fType(Type::kInherit) {}
|
| + constexpr explicit SkSVGLineCap(Type t) : fType(t) {}
|
| +
|
| + SkSVGLineCap(const SkSVGLineCap&) = default;
|
| + SkSVGLineCap& operator=(const SkSVGLineCap&) = default;
|
| +
|
| + bool operator==(const SkSVGLineCap& other) const { return fType == other.fType; }
|
| + bool operator!=(const SkSVGLineCap& other) const { return !(*this == other); }
|
| +
|
| + Type type() const { return fType; }
|
| +
|
| +private:
|
| + Type fType;
|
| +};
|
| +
|
| +class SkSVGLineJoin {
|
| +public:
|
| + enum class Type {
|
| + kMiter,
|
| + kRound,
|
| + kBevel,
|
| + kInherit,
|
| + };
|
| +
|
| + constexpr SkSVGLineJoin() : fType(Type::kInherit) {}
|
| + constexpr explicit SkSVGLineJoin(Type t) : fType(t) {}
|
| +
|
| + SkSVGLineJoin(const SkSVGLineJoin&) = default;
|
| + SkSVGLineJoin& operator=(const SkSVGLineJoin&) = default;
|
| +
|
| + bool operator==(const SkSVGLineJoin& other) const { return fType == other.fType; }
|
| + bool operator!=(const SkSVGLineJoin& other) const { return !(*this == other); }
|
| +
|
| + Type type() const { return fType; }
|
| +
|
| +private:
|
| + Type fType;
|
| +};
|
| +
|
| #endif // SkSVGTypes_DEFINED
|
|
|