lottie: corrected drop-shadow handling

opacity value type should be float with range 0 ~ 256
This commit is contained in:
Hermet Park 2024-11-08 00:43:14 +09:00
parent 13aa26109f
commit e95f80c18f
3 changed files with 3 additions and 3 deletions

View file

@ -1308,7 +1308,7 @@ void LottieBuilder::updateEffect(LottieLayer* layer, float frameNo)
case LottieEffect::DropShadow: {
auto effect = static_cast<LottieDropShadow*>(*ef);
auto color = effect->color(frameNo);
layer->scene->push(SceneEffect::DropShadow, color.rgb[0], color.rgb[1], color.rgb[2], effect->opacity(frameNo), effect->angle(frameNo), effect->distance(frameNo), effect->blurness(frameNo), QUALITY);
layer->scene->push(SceneEffect::DropShadow, color.rgb[0], color.rgb[1], color.rgb[2], (int)effect->opacity(frameNo), effect->angle(frameNo), effect->distance(frameNo), effect->blurness(frameNo) * BLUR_TO_SIGMA, QUALITY);
break;
}
case LottieEffect::GaussianBlur: {

View file

@ -95,7 +95,7 @@ struct LottieEffect
struct LottieDropShadow : LottieEffect
{
LottieColor color;
LottieOpacity opacity = 0;
LottieFloat opacity = 0;
LottieAngle angle = 0.0f;
LottieSlider distance = 0.0f;
LottieSlider blurness = 0.0f;

View file

@ -309,7 +309,7 @@ struct RenderEffectDropShadow : RenderEffect
inst->color[0] = va_arg(args, int);
inst->color[1] = va_arg(args, int);
inst->color[2] = va_arg(args, int);
inst->color[3] = va_arg(args, int);
inst->color[3] = std::min(va_arg(args, int), 255);
inst->angle = (float) va_arg(args, double);
inst->distance = (float) va_arg(args, double);
inst->sigma = std::max((float) va_arg(args, double), 0.0f);