[aseprite] 14/64: Fix crash copy & paste one frame in its previous frame position
Tobias Hansen
thansen at moszumanska.debian.org
Tue Jun 21 14:43:01 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 6a1a9556aea502df8f3fbdcb51863b53c54c74bd
Author: David Capello <davidcapello at gmail.com>
Date: Mon May 9 15:47:09 2016 -0300
Fix crash copy & paste one frame in its previous frame position
This should fix #1101 too.
---
src/app/util/clipboard.cpp | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/app/util/clipboard.cpp b/src/app/util/clipboard.cpp
index e451572..e4b2f5a 100644
--- a/src/app/util/clipboard.cpp
+++ b/src/app/util/clipboard.cpp
@@ -448,25 +448,40 @@ void paste()
case DocumentRange::kFrames: {
Transaction transaction(UIContext::instance(), "Paste Frames");
DocumentApi api = dstDoc->getApi(transaction);
- frame_t dstFrame = frame_t(editor->frame() + 1);
+ frame_t dstFrame = editor->frame();
+ if (srcSpr == dstSpr) {
+ if (srcRange.inRange(dstFrame))
+ dstFrame = srcRange.frameEnd()+1;
+ }
+
+ frame_t srcFrame = srcRange.frameBegin();
for (frame_t frame = srcRange.frameBegin(); frame <= srcRange.frameEnd(); ++frame) {
- api.addFrame(dstSpr, dstFrame);
- api.setFrameDuration(dstSpr, dstFrame, srcSpr->frameDuration(frame));
+ api.addEmptyFrame(dstSpr, dstFrame);
+
+ // If we are copying frames from/to the same sprite, we
+ // have to adjust the source frame.
+ if (srcSpr == dstSpr) {
+ if (dstFrame < srcFrame)
+ ++srcFrame;
+ }
+
+ api.setFrameDuration(dstSpr, dstFrame, srcSpr->frameDuration(srcFrame));
for (LayerIndex
i = LayerIndex(srcLayers.size()-1),
j = LayerIndex(dstLayers.size()-1);
i >= LayerIndex(0) &&
j >= LayerIndex(0); --i, --j) {
- Cel* cel = static_cast<LayerImage*>(srcLayers[i])->cel(frame);
+ Cel* cel = static_cast<LayerImage*>(srcLayers[i])->cel(srcFrame);
if (cel && cel->image()) {
api.copyCel(
- static_cast<LayerImage*>(srcLayers[i]), frame,
+ static_cast<LayerImage*>(srcLayers[i]), srcFrame,
static_cast<LayerImage*>(dstLayers[j]), dstFrame);
}
}
+ ++srcFrame;
++dstFrame;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list