lottie/expressions: ++coverage enhancement

Allow to access layer index globally.
This commit is contained in:
Hermet Park 2024-07-19 18:28:45 +09:00 committed by Hermet Park
parent 65fe1cb465
commit 803dcb3fb9
3 changed files with 2015 additions and 2 deletions

File diff suppressed because it is too large Load diff

View file

@ -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)
{
jerry_object_set_native_ptr(this->comp, nullptr, comp);
jerry_object_set_native_ptr(thisComp, nullptr, comp);
jerry_object_set_native_ptr(layer, nullptr, comp);
jerry_object_set_native_ptr(this->thisComp, nullptr, comp);
jerry_object_set_native_ptr(this->layer, nullptr, comp);
//marker
//marker.key(index)
@ -1242,6 +1250,7 @@ jerry_value_t LottieExpressions::buildGlobal()
jerry_value_t LottieExpressions::evaluate(float frameNo, LottieExpression* exp)
{
buildComp(exp->comp);
buildLayer(exp->layer);
//update global context values
jerry_object_set_native_ptr(thisLayer, nullptr, exp->layer);

View file

@ -27,6 +27,7 @@
struct LottieExpression;
struct LottieComposition;
struct LottieLayer;
struct RGB24;
#ifdef THORVG_LOTTIE_EXPRESSIONS_SUPPORT
@ -136,6 +137,7 @@ private:
jerry_value_t evaluate(float frameNo, LottieExpression* exp);
jerry_value_t buildGlobal();
void buildComp(LottieComposition* comp);
void buildLayer(LottieLayer* layer);
//global object, attributes, methods
jerry_value_t global;