From 2141f14e27321133ec40092af8a80d166f598f3f Mon Sep 17 00:00:00 2001 From: Mira Grudzinska Date: Fri, 9 Aug 2024 18:47:37 +0200 Subject: [PATCH] lottie: handle edge case for rounded rect For rounded rectangles the roundness value should be determined using to the formula: r = min(r, max(size.x, size.y)/2) rather than the previous method: r = min(size.x/2, size.y/2, r) --- src/loaders/lottie/tvgLottieBuilder.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 2faaeac8..ceda2070 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -472,11 +472,8 @@ void LottieBuilder::updateRect(LottieGroup* parent, LottieObject** child, float auto roundness = rect->radius(frameNo, exps); if (ctx->roundness > roundness) roundness = ctx->roundness; - if (roundness > ROUNDNESS_EPSILON) { - if (roundness > size.x * 0.5f) roundness = size.x * 0.5f; - if (roundness > size.y * 0.5f) roundness = size.y * 0.5f; - } - + if (roundness > ROUNDNESS_EPSILON) roundness = std::min(roundness, std::max(size.x, size.y) * 0.5f); + if (!ctx->repeaters.empty()) { auto shape = rect->pooling(); shape->reset();