From b1dccb1843f6cd4124110ed5211ae6143362c6f9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 6 Dec 2018 12:59:25 -0300 Subject: [PATCH] Fix setting duration of first frame when we call Sprite::addFrame(0) --- src/doc/sprite.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/doc/sprite.cpp b/src/doc/sprite.cpp index eec447bc5..c38a4d039 100644 --- a/src/doc/sprite.cpp +++ b/src/doc/sprite.cpp @@ -24,6 +24,7 @@ #include "doc/remap.h" #include "doc/rgbmap.h" +#include #include #include #include @@ -357,7 +358,9 @@ RgbMap* Sprite::rgbMap(frame_t frame, RgbMapFor forLayer) const void Sprite::addFrame(frame_t newFrame) { setTotalFrames(m_frames+1); - for (frame_t i=m_frames-1; i>=newFrame; --i) + + frame_t to = std::max(1, newFrame); + for (frame_t i=m_frames-1; i>=to; --i) setFrameDuration(i, frameDuration(i-1)); root()->displaceFrames(newFrame, +1);