From a5f69a9bbc733443ddfdddb665d3ad7adeb48708 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 1 Aug 2024 12:48:17 +0900 Subject: [PATCH] lottie: remove useless condition check. lottie is always animatable. --- src/loaders/lottie/tvgLottieAnimation.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/loaders/lottie/tvgLottieAnimation.cpp b/src/loaders/lottie/tvgLottieAnimation.cpp index 9f165b51..4ae6396e 100644 --- a/src/loaders/lottie/tvgLottieAnimation.cpp +++ b/src/loaders/lottie/tvgLottieAnimation.cpp @@ -43,9 +43,7 @@ Result LottieAnimation::override(const char* slot) noexcept { if (!pImpl->picture->pImpl->loader) return Result::InsufficientCondition; - if (static_cast(pImpl->picture->pImpl->loader)->override(slot)) { - return Result::Success; - } + if (static_cast(pImpl->picture->pImpl->loader)->override(slot)) return Result::Success; return Result::InvalidArguments; } @@ -55,7 +53,6 @@ Result LottieAnimation::segment(const char* marker) noexcept { auto loader = pImpl->picture->pImpl->loader; if (!loader) return Result::InsufficientCondition; - if (!loader->animatable()) return Result::NonSupport; if (!marker) { static_cast(loader)->segment(0.0f, 1.0f); @@ -63,9 +60,8 @@ Result LottieAnimation::segment(const char* marker) noexcept } float begin, end; - if (!static_cast(loader)->segment(marker, begin, end)) { - return Result::InvalidArguments; - } + if (!static_cast(loader)->segment(marker, begin, end)) return Result::InvalidArguments; + return static_cast(this)->segment(begin, end); } @@ -73,7 +69,7 @@ Result LottieAnimation::segment(const char* marker) noexcept uint32_t LottieAnimation::markersCnt() noexcept { auto loader = pImpl->picture->pImpl->loader; - if (!loader || !loader->animatable()) return 0; + if (!loader) return 0; return static_cast(loader)->markersCnt(); } @@ -81,7 +77,7 @@ uint32_t LottieAnimation::markersCnt() noexcept const char* LottieAnimation::marker(uint32_t idx) noexcept { auto loader = pImpl->picture->pImpl->loader; - if (!loader || !loader->animatable()) return nullptr; + if (!loader) return nullptr; return static_cast(loader)->markers(idx); }