mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common: refactored the scene effect tint
Pre-convert the data type from float to uint8_t
This commit is contained in:
parent
0437d482bd
commit
285d1427ad
3 changed files with 4 additions and 4 deletions
|
@ -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. */
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue