Use round in frameAtPos
authorAnton Sergeev <antonsergeev88@gmail.com>
Sat, 25 Apr 2020 11:15:37 +0000 (14:15 +0300)
committerJongmin Lee <jm105.lee@samsung.com>
Mon, 13 Jul 2020 03:33:20 +0000 (12:33 +0900)
Without this fix frameAtPos doesn't return last frame
for position (1 - eps)

src/lottie/lottiemodel.h

index fe94bca2d11963ca6353511978c8749c3e47d53d..c61c920d53009974438ee031ace5ac5c2a44c5d0 100644 (file)
@@ -663,7 +663,7 @@ public:
     size_t frameAtPos(double pos) const {
         if (pos < 0) pos = 0;
         if (pos > 1) pos = 1;
-        return size_t(pos * frameDuration());
+        return size_t(round(pos * frameDuration()));
     }
     long frameAtTime(double timeInSec) const {
         return long(frameAtPos(timeInSec / duration()));