mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 06:04:03 +00:00
lottie/expressions: ++coverage enhancement
Allow to access layer index globally.
This commit is contained in:
parent
65fe1cb465
commit
803dcb3fb9
3 changed files with 2015 additions and 2 deletions
2002
examples/resources/lottie/expressions/1254.json
Normal file
2002
examples/resources/lottie/expressions/1254.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1149,11 +1149,19 @@ static void _buildMath(jerry_value_t context)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LottieExpressions::buildLayer(LottieLayer* layer)
|
||||||
|
{
|
||||||
|
auto index = jerry_number(layer->idx);
|
||||||
|
jerry_object_set_sz(global, EXP_INDEX, index);
|
||||||
|
jerry_value_free(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void LottieExpressions::buildComp(LottieComposition* comp)
|
void LottieExpressions::buildComp(LottieComposition* comp)
|
||||||
{
|
{
|
||||||
jerry_object_set_native_ptr(this->comp, nullptr, comp);
|
jerry_object_set_native_ptr(this->comp, nullptr, comp);
|
||||||
jerry_object_set_native_ptr(thisComp, nullptr, comp);
|
jerry_object_set_native_ptr(this->thisComp, nullptr, comp);
|
||||||
jerry_object_set_native_ptr(layer, nullptr, comp);
|
jerry_object_set_native_ptr(this->layer, nullptr, comp);
|
||||||
|
|
||||||
//marker
|
//marker
|
||||||
//marker.key(index)
|
//marker.key(index)
|
||||||
|
@ -1242,6 +1250,7 @@ jerry_value_t LottieExpressions::buildGlobal()
|
||||||
jerry_value_t LottieExpressions::evaluate(float frameNo, LottieExpression* exp)
|
jerry_value_t LottieExpressions::evaluate(float frameNo, LottieExpression* exp)
|
||||||
{
|
{
|
||||||
buildComp(exp->comp);
|
buildComp(exp->comp);
|
||||||
|
buildLayer(exp->layer);
|
||||||
|
|
||||||
//update global context values
|
//update global context values
|
||||||
jerry_object_set_native_ptr(thisLayer, nullptr, exp->layer);
|
jerry_object_set_native_ptr(thisLayer, nullptr, exp->layer);
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
struct LottieExpression;
|
struct LottieExpression;
|
||||||
struct LottieComposition;
|
struct LottieComposition;
|
||||||
|
struct LottieLayer;
|
||||||
struct RGB24;
|
struct RGB24;
|
||||||
|
|
||||||
#ifdef THORVG_LOTTIE_EXPRESSIONS_SUPPORT
|
#ifdef THORVG_LOTTIE_EXPRESSIONS_SUPPORT
|
||||||
|
@ -136,6 +137,7 @@ private:
|
||||||
jerry_value_t evaluate(float frameNo, LottieExpression* exp);
|
jerry_value_t evaluate(float frameNo, LottieExpression* exp);
|
||||||
jerry_value_t buildGlobal();
|
jerry_value_t buildGlobal();
|
||||||
void buildComp(LottieComposition* comp);
|
void buildComp(LottieComposition* comp);
|
||||||
|
void buildLayer(LottieLayer* layer);
|
||||||
|
|
||||||
//global object, attributes, methods
|
//global object, attributes, methods
|
||||||
jerry_value_t global;
|
jerry_value_t global;
|
||||||
|
|
Loading…
Add table
Reference in a new issue