aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2017-12-30 18:47:41 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-31 00:07:39 +0000
commite8750e1078fe72ed8486c2cc4b13c967dc750baf (patch)
tree2f48da6bd441b1f645cdb24b37208040858c0ab2 /experimental
parent094ccde2380bfbb615e25d0d80208148fcd47f17 (diff)
[skotty] Fix path close handling
... and add a transform animation sample TBR= Change-Id: I27a67d7861dffb9ca22a5e7155ee0eba3b4575f6 Reviewed-on: https://skia-review.googlesource.com/90023 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental')
-rw-r--r--experimental/skotty/SkottyAnimator.cpp3
-rw-r--r--experimental/skotty/SkottyProperties.cpp10
2 files changed, 11 insertions, 2 deletions
diff --git a/experimental/skotty/SkottyAnimator.cpp b/experimental/skotty/SkottyAnimator.cpp
index e08cf35995..f08e7088da 100644
--- a/experimental/skotty/SkottyAnimator.cpp
+++ b/experimental/skotty/SkottyAnimator.cpp
@@ -54,6 +54,9 @@ void KeyframeInterval<ShapeValue>::lerp(float t, ShapeValue* v) const {
lerp_point(fV0.fVertices[i].fVertex , fV1.fVertices[i].fVertex , t)
}));
}
+
+ // hmm, any meaningful interpolation to consider here?
+ v->fClose = fV0.fClose;
}
} // namespace skotty
diff --git a/experimental/skotty/SkottyProperties.cpp b/experimental/skotty/SkottyProperties.cpp
index f65a106735..1a3a14593c 100644
--- a/experimental/skotty/SkottyProperties.cpp
+++ b/experimental/skotty/SkottyProperties.cpp
@@ -39,6 +39,11 @@ bool ParsePoints(const Json::Value& v, PointArray* pts) {
} // namespace
bool ScalarValue::Parse(const Json::Value& v, ScalarValue* scalar) {
+ // Some files appear to wrap keyframes in arrays for no reason.
+ if (v.isArray() && v.size() == 1) {
+ return Parse(v[0], scalar);
+ }
+
if (v.isNull() || !v.isConvertibleTo(Json::realValue))
return false;
@@ -68,8 +73,8 @@ bool ShapeValue::Parse(const Json::Value& v, ShapeValue* shape) {
outPts,
verts;
- // Some files appear to wrap these in arrays for no reason.
- if (v.isArray()) {
+ // Some files appear to wrap keyframes in arrays for no reason.
+ if (v.isArray() && v.size() == 1) {
return Parse(v[0], shape);
}
@@ -135,6 +140,7 @@ SkPath ShapeValue::as<SkPath>() const {
if (fClose) {
addCubic(fVertices.back(), fVertices.front(), &path);
+ path.close();
}
return path;