diff options
Diffstat (limited to 'experimental/skottie/SkottieValue.h')
-rw-r--r-- | experimental/skottie/SkottieValue.h | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/experimental/skottie/SkottieValue.h b/experimental/skottie/SkottieValue.h index 6d6d94a7a3..cfdbd7aba7 100644 --- a/experimental/skottie/SkottieValue.h +++ b/experimental/skottie/SkottieValue.h @@ -21,11 +21,43 @@ struct ValueTraits { template <typename U> static U As(const T&); + + static T Lerp(const T&, const T&, float); }; using ScalarValue = SkScalar; using VectorValue = std::vector<ScalarValue>; -using ShapeValue = SkPath; + +struct BezierVertex { + SkPoint fInPoint, // "in" control point, relative to the vertex + fOutPoint, // "out" control point, relative to the vertex + fVertex; + + bool operator==(const BezierVertex& other) const { + return fInPoint == other.fInPoint + && fOutPoint == other.fOutPoint + && fVertex == other.fVertex; + } + + bool operator!=(const BezierVertex& other) const { return !(*this == other); } +}; + +struct ShapeValue { + std::vector<BezierVertex> fVertices; + bool fClosed : 1, + fVolatile : 1; + + ShapeValue() : fClosed(false), fVolatile(false) {} + ShapeValue(const ShapeValue&) = default; + ShapeValue(ShapeValue&&) = default; + ShapeValue& operator=(const ShapeValue&) = default; + + bool operator==(const ShapeValue& other) const { + return fVertices == other.fVertices && fClosed == other.fClosed; + } + + bool operator!=(const ShapeValue& other) const { return !(*this == other); } +}; } // namespace skottie |