common: refactored the scene effect tint

Pre-convert the data type from float to uint8_t
This commit is contained in:
Hermet Park 2024-12-20 12:01:48 +09:00 committed by Hermet Park
parent 0437d482bd
commit 285d1427ad
3 changed files with 4 additions and 4 deletions

View file

@ -1326,7 +1326,7 @@ void LottieBuilder::updateEffect(LottieLayer* layer, float frameNo)
case LottieEffect::Fill: {
auto effect = static_cast<LottieFxFill*>(*ef);
auto color = effect->color(frameNo);
layer->scene->push(SceneEffect::Fill, color.rgb[0], color.rgb[1], color.rgb[2], (int)(255.0f *effect->opacity(frameNo)));
layer->scene->push(SceneEffect::Fill, color.rgb[0], color.rgb[1], color.rgb[2], (int)(255.0f * effect->opacity(frameNo)));
break;
}
case LottieEffect::Tritone: {

View file

@ -473,7 +473,7 @@ bool effectTint(SwCompositor* cmp, const RenderEffectTint* params, bool direct)
auto opacity = cmp->opacity;
auto luma = cmp->recoverSfc->alphas[2]; //luma function
TVGLOG("SW_ENGINE", "Tint region(%ld, %ld, %ld, %ld), param(%d %d %d, %d %d %d, %f)", bbox.min.x, bbox.min.y, bbox.max.x, bbox.max.y, params->black[0], params->black[1], params->black[2], params->white[0], params->white[1], params->white[2], params->intensity);
TVGLOG("SW_ENGINE", "Tint region(%ld, %ld, %ld, %ld), param(%d %d %d, %d %d %d, %d)", bbox.min.x, bbox.min.y, bbox.max.x, bbox.max.y, params->black[0], params->black[1], params->black[2], params->white[0], params->white[1], params->white[2], params->intensity);
/* Tint Formula: (1 - L) * Black + L * White, where the L is Luminance. */

View file

@ -332,7 +332,7 @@ struct RenderEffectTint : RenderEffect
{
uint8_t black[3]; //rgb
uint8_t white[3]; //rgb
float intensity; //0 - 100
uint8_t intensity; //0 - 255
static RenderEffectTint* gen(va_list& args)
{
@ -343,7 +343,7 @@ struct RenderEffectTint : RenderEffect
inst->white[0] = va_arg(args, int);
inst->white[1] = va_arg(args, int);
inst->white[2] = va_arg(args, int);
inst->intensity = std::min((float)va_arg(args, double), 100.0f) * 2.55f;
inst->intensity = (uint8_t)(va_arg(args, double) * 2.55f);
inst->type = SceneEffect::Tint;
return inst;
}