mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
lottie/expressions: rectified fill color support
Assign the fill color value properly.
This commit is contained in:
parent
de9da0b93a
commit
69dccc326a
2 changed files with 20 additions and 12 deletions
|
@ -349,7 +349,7 @@ static void _updateSolidFill(TVG_UNUSED LottieGroup* parent, LottieObject** chil
|
||||||
auto fill = static_cast<LottieSolidFill*>(*child);
|
auto fill = static_cast<LottieSolidFill*>(*child);
|
||||||
|
|
||||||
ctx->merging = nullptr;
|
ctx->merging = nullptr;
|
||||||
auto color = fill->color(frameNo);
|
auto color = fill->color(frameNo, exps);
|
||||||
ctx->propagator->fill(color.rgb[0], color.rgb[1], color.rgb[2], fill->opacity(frameNo, exps));
|
ctx->propagator->fill(color.rgb[0], color.rgb[1], color.rgb[2], fill->opacity(frameNo, exps));
|
||||||
ctx->propagator->fill(fill->rule);
|
ctx->propagator->fill(fill->rule);
|
||||||
|
|
||||||
|
|
|
@ -59,17 +59,15 @@ public:
|
||||||
auto bm_rt = evaluate(frameNo, exp);
|
auto bm_rt = evaluate(frameNo, exp);
|
||||||
if (jerry_value_is_undefined(bm_rt)) return false;
|
if (jerry_value_is_undefined(bm_rt)) return false;
|
||||||
|
|
||||||
if (jerry_value_is_object(bm_rt)) {
|
if (auto prop = static_cast<Property*>(jerry_object_get_native_ptr(bm_rt, nullptr))) {
|
||||||
if (auto prop = static_cast<Property*>(jerry_object_get_native_ptr(bm_rt, nullptr))) {
|
out = (*prop)(frameNo);
|
||||||
out = (*prop)(frameNo);
|
} else {
|
||||||
} else {
|
auto x = jerry_object_get_index(bm_rt, 0);
|
||||||
auto x = jerry_object_get_index(bm_rt, 0);
|
auto y = jerry_object_get_index(bm_rt, 1);
|
||||||
auto y = jerry_object_get_index(bm_rt, 1);
|
out.x = jerry_value_as_number(x);
|
||||||
out.x = jerry_value_as_number(x);
|
out.y = jerry_value_as_number(y);
|
||||||
out.y = jerry_value_as_number(y);
|
jerry_value_free(x);
|
||||||
jerry_value_free(x);
|
jerry_value_free(y);
|
||||||
jerry_value_free(y);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
jerry_value_free(bm_rt);
|
jerry_value_free(bm_rt);
|
||||||
return true;
|
return true;
|
||||||
|
@ -83,6 +81,16 @@ public:
|
||||||
|
|
||||||
if (auto color = static_cast<Property*>(jerry_object_get_native_ptr(bm_rt, nullptr))) {
|
if (auto color = static_cast<Property*>(jerry_object_get_native_ptr(bm_rt, nullptr))) {
|
||||||
out = (*color)(frameNo);
|
out = (*color)(frameNo);
|
||||||
|
} else {
|
||||||
|
auto r = jerry_object_get_index(bm_rt, 0);
|
||||||
|
auto g = jerry_object_get_index(bm_rt, 1);
|
||||||
|
auto b = jerry_object_get_index(bm_rt, 2);
|
||||||
|
out.rgb[0] = REMAP255(jerry_value_as_number(r));
|
||||||
|
out.rgb[1] = REMAP255(jerry_value_as_number(g));
|
||||||
|
out.rgb[2] = REMAP255(jerry_value_as_number(b));
|
||||||
|
jerry_value_free(r);
|
||||||
|
jerry_value_free(g);
|
||||||
|
jerry_value_free(b);
|
||||||
}
|
}
|
||||||
jerry_value_free(bm_rt);
|
jerry_value_free(bm_rt);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue