From 7c13da461ae449d8f7af4dae8db2a0c78563be39 Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Mon, 12 Aug 2024 23:32:08 +0200 Subject: [PATCH] lottie: prioritization of roundness in rectangles Added prioritization of rectangle roundness over rounded corners, in line with AE results. --- src/loaders/lottie/tvgLottieBuilder.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 503fac1d..085ad3ab 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -470,9 +470,11 @@ void LottieBuilder::updateRect(LottieGroup* parent, LottieObject** child, float auto position = rect->position(frameNo, exps); auto size = rect->size(frameNo, exps); auto roundness = rect->radius(frameNo, exps); - if (ctx->roundness > roundness) roundness = ctx->roundness; - - if (roundness > ROUNDNESS_EPSILON) roundness = std::min(roundness, std::max(size.x, size.y) * 0.5f); + if (roundness == 0.0f) { + if (ctx->roundness > ROUNDNESS_EPSILON) roundness = std::min(ctx->roundness, std::max(size.x, size.y) * 0.5f); + } else { + roundness = std::min({roundness, size.x * 0.5f, size.y * 0.5f}); + } if (!ctx->repeaters.empty()) { auto shape = rect->pooling();