move_selection_stroke_strategy.cpp (krita-5.1.3.tar.xz) | : | move_selection_stroke_strategy.cpp (krita-5.1.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 15 | skipping to change at line 15 | |||
*/ | */ | |||
#include "move_selection_stroke_strategy.h" | #include "move_selection_stroke_strategy.h" | |||
#include <klocalizedstring.h> | #include <klocalizedstring.h> | |||
#include <KoColorSpace.h> | #include <KoColorSpace.h> | |||
#include <KoCompositeOpRegistry.h> | #include <KoCompositeOpRegistry.h> | |||
#include "kis_image.h" | #include "kis_image.h" | |||
#include "kis_paint_layer.h" | #include "kis_paint_layer.h" | |||
#include "kis_painter.h" | #include "kis_painter.h" | |||
#include "kis_paint_device.h" | ||||
#include "kis_image_animation_interface.h" | ||||
#include "kis_raster_keyframe_channel.h" | ||||
#include "kis_transaction.h" | #include "kis_transaction.h" | |||
#include "KisRunnableStrokeJobUtils.h" | ||||
#include <commands_new/kis_selection_move_command2.h> | #include <commands_new/kis_selection_move_command2.h> | |||
#include "kis_lod_transform.h" | #include "kis_lod_transform.h" | |||
#include "KisAnimAutoKey.h" | ||||
MoveSelectionStrokeStrategy::MoveSelectionStrokeStrategy(KisPaintLayerSP paintLa yer, | MoveSelectionStrokeStrategy::MoveSelectionStrokeStrategy(KisPaintLayerSP paintLa yer, | |||
KisSelectionSP selectio n, | KisSelectionSP selectio n, | |||
KisUpdatesFacade *updat esFacade, | KisUpdatesFacade *updat esFacade, | |||
KisStrokeUndoFacade *un doFacade) | KisStrokeUndoFacade *un doFacade) | |||
: KisStrokeStrategyUndoCommandBased(kundo2_i18n("Move Selection"), false, un doFacade), | : KisStrokeStrategyUndoCommandBased(kundo2_i18n("Move Selection"), false, un doFacade), | |||
m_paintLayer(paintLayer), | m_paintLayer(paintLayer), | |||
m_selection(selection), | m_selection(selection), | |||
m_updatesFacade(updatesFacade) | m_updatesFacade(updatesFacade) | |||
{ | { | |||
skipping to change at line 54 | skipping to change at line 59 | |||
} | } | |||
void MoveSelectionStrokeStrategy::initStrokeCallback() | void MoveSelectionStrokeStrategy::initStrokeCallback() | |||
{ | { | |||
KisStrokeStrategyUndoCommandBased::initStrokeCallback(); | KisStrokeStrategyUndoCommandBased::initStrokeCallback(); | |||
KisPaintDeviceSP paintDevice = m_paintLayer->paintDevice(); | KisPaintDeviceSP paintDevice = m_paintLayer->paintDevice(); | |||
KisPaintDeviceSP movedDevice = new KisPaintDevice(m_paintLayer.data(), paint Device->colorSpace()); | KisPaintDeviceSP movedDevice = new KisPaintDevice(m_paintLayer.data(), paint Device->colorSpace()); | |||
QVector<KisStrokeJobData *> extraInitJobs; | ||||
if (KisAutoKey::activeMode() > KisAutoKey::NONE) { | ||||
KritaUtils::addJobSequential(extraInitJobs, [this]() { | ||||
KisPaintDeviceSP device = m_paintLayer->paintDevice(); | ||||
KIS_ASSERT(device); | ||||
if (device->keyframeChannel()) { | ||||
KUndo2CommandSP undo(new KUndo2Command); | ||||
const int activeKeyframe = device->keyframeChannel()->activeKeyf | ||||
rameTime(); | ||||
const int targetKeyframe = m_paintLayer->image()->animationInter | ||||
face()->currentTime(); | ||||
device->keyframeChannel()->copyKeyframe(activeKeyframe, targetKe | ||||
yframe, undo.data()); | ||||
runAndSaveCommand(undo, KisStrokeJobData::BARRIER, KisStrokeJobD | ||||
ata::NORMAL); | ||||
} | ||||
}); | ||||
} | ||||
addMutatedJobs(extraInitJobs); | ||||
QRect copyRect = m_selection->selectedRect(); | QRect copyRect = m_selection->selectedRect(); | |||
KisPainter gc(movedDevice); | KisPainter gc(movedDevice); | |||
gc.setSelection(m_selection); | gc.setSelection(m_selection); | |||
gc.bitBlt(copyRect.topLeft(), paintDevice, copyRect); | gc.bitBlt(copyRect.topLeft(), paintDevice, copyRect); | |||
gc.end(); | gc.end(); | |||
KisTransaction cutTransaction(name(), paintDevice); | KisTransaction cutTransaction(name(), paintDevice); | |||
paintDevice->clearSelection(m_selection); | paintDevice->clearSelection(m_selection); | |||
runAndSaveCommand(KUndo2CommandSP(cutTransaction.endAndTake()), | runAndSaveCommand(KUndo2CommandSP(cutTransaction.endAndTake()), | |||
KisStrokeJobData::SEQUENTIAL, | KisStrokeJobData::SEQUENTIAL, | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 27 lines changed or added |