diff --git a/src/app/document_range_ops.cpp b/src/app/document_range_ops.cpp index b79d58d9e..6c1ebe124 100644 --- a/src/app/document_range_ops.cpp +++ b/src/app/document_range_ops.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2001-2015 David Capello +// Copyright (C) 2001-2016 David Capello // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as @@ -353,6 +353,7 @@ void reverse_frames(Document* doc, const DocumentRange& range) frame_t frameBegin, frameEnd; int layerBegin, layerEnd; bool moveFrames = false; + bool swapCels = false; switch (range.type()) { case DocumentRange::kCels: @@ -360,6 +361,7 @@ void reverse_frames(Document* doc, const DocumentRange& range) frameEnd = range.frameEnd(); layerBegin = range.layerBegin(); layerEnd = range.layerEnd() + 1; + swapCels = true; break; case DocumentRange::kFrames: frameBegin = range.frameBegin(); @@ -371,6 +373,7 @@ void reverse_frames(Document* doc, const DocumentRange& range) frameEnd = sprite->totalFrames()-1; layerBegin = range.layerBegin(); layerEnd = range.layerEnd() + 1; + swapCels = true; break; } @@ -381,7 +384,7 @@ void reverse_frames(Document* doc, const DocumentRange& range) api.moveFrame(sprite, frameBegin, frameRev); } } - else { + else if (swapCels) { std::vector layers; sprite->getLayersList(layers); @@ -390,6 +393,9 @@ void reverse_frames(Document* doc, const DocumentRange& range) frameRev = frameEnd; frame != (frameBegin+frameEnd)/2+1; ++frame, --frameRev) { + if (frame == frameRev) + continue; + LayerImage* layer = static_cast(layers[layerIdx]); api.swapCel(layer, frame, frameRev); }