Fix setting duration of first frame when we call Sprite::addFrame(0)

This commit is contained in:
David Capello 2018-12-06 12:59:25 -03:00
parent 12444943ad
commit b1dccb1843

View File

@ -24,6 +24,7 @@
#include "doc/remap.h"
#include "doc/rgbmap.h"
#include <algorithm>
#include <cstring>
#include <memory>
#include <vector>
@ -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);