mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 12:54:40 +00:00
Fix setting duration of first frame when we call Sprite::addFrame(0)
This commit is contained in:
parent
12444943ad
commit
b1dccb1843
@ -24,6 +24,7 @@
|
|||||||
#include "doc/remap.h"
|
#include "doc/remap.h"
|
||||||
#include "doc/rgbmap.h"
|
#include "doc/rgbmap.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -357,7 +358,9 @@ RgbMap* Sprite::rgbMap(frame_t frame, RgbMapFor forLayer) const
|
|||||||
void Sprite::addFrame(frame_t newFrame)
|
void Sprite::addFrame(frame_t newFrame)
|
||||||
{
|
{
|
||||||
setTotalFrames(m_frames+1);
|
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));
|
setFrameDuration(i, frameDuration(i-1));
|
||||||
|
|
||||||
root()->displaceFrames(newFrame, +1);
|
root()->displaceFrames(newFrame, +1);
|
||||||
|
Loading…
Reference in New Issue
Block a user