094ccde238
Coarse workflow: * Construction 1) build a Json tree 2) collect asset IDs (for preComp/image layer resolution) 3) "attach" pass - traverse the Json tree - build an SkSG dom, one fragment at a time - attach "animator" objects to the dom, for each animated prop 4) done, we can throw away the Json tree * For each animation tick 1) iterate over active animators and poke their respective dom nodes/attributes 2) revalidate the SkSG dom 3) draw the SkSG dom Note: post construction, things are super-simple - we just poke SkSG DOM attributes with interpolated values, and everything else is handled by SkSG (invalidation, revalidation, render). Change-Id: I96a02be7eb4fb4cb3831f59bf2b3908ea190c0dd Reviewed-on: https://skia-review.googlesource.com/89420 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
42 lines
1.1 KiB
C++
42 lines
1.1 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkottyPriv_DEFINED
|
|
#define SkottyPriv_DEFINED
|
|
|
|
#include "SkJSONCPP.h"
|
|
#include "SkScalar.h"
|
|
#include "SkString.h"
|
|
|
|
namespace skotty {
|
|
|
|
#define LOG SkDebugf
|
|
|
|
static inline SkScalar ParseScalar(const Json::Value& v, SkScalar defaultValue) {
|
|
return !v.isNull() && v.isConvertibleTo(Json::realValue)
|
|
? v.asFloat() : defaultValue;
|
|
}
|
|
|
|
static inline SkString ParseString(const Json::Value& v, const char defaultValue[]) {
|
|
return SkString(!v.isNull() && v.isConvertibleTo(Json::stringValue)
|
|
? v.asCString() : defaultValue);
|
|
}
|
|
|
|
static inline int ParseInt(const Json::Value& v, int defaultValue) {
|
|
return !v.isNull() && v.isConvertibleTo(Json::intValue)
|
|
? v.asInt() : defaultValue;
|
|
}
|
|
|
|
static inline bool ParseBool(const Json::Value& v, bool defaultValue) {
|
|
return !v.isNull() && v.isConvertibleTo(Json::booleanValue)
|
|
? v.asBool() : defaultValue;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
#endif // SkottyPriv_DEFINED
|