Commit ad2373e9 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Merge branch 'master' into rempt/set-preferences-on-close

parents 690cee59 4356f2a7
......@@ -73,7 +73,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_BREAK(cond) KIS_ASSERT_RECOVER(cond) { break; }
#define KIS_ASSERT_RECOVER_BREAK(cond) do { KIS_ASSERT_RECOVER(cond) { break; } } while (0)
/**
* Equivalent of the following:
......@@ -83,7 +83,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_RETURN(cond) KIS_ASSERT_RECOVER(cond) { return; }
#define KIS_ASSERT_RECOVER_RETURN(cond) do { KIS_ASSERT_RECOVER(cond) { return; } } while (0)
/**
* Equivalent of the following:
......@@ -93,7 +93,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val) KIS_ASSERT_RECOVER(cond) { return (val); }
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val) do { KIS_ASSERT_RECOVER(cond) { return (val); } } while (0)
/**
* Does nothing in case of a failure. Just continues execution.
......@@ -105,7 +105,7 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
* }
*
*/
#define KIS_ASSERT_RECOVER_NOOP(cond) KIS_ASSERT_RECOVER(cond) { qt_noop(); }
#define KIS_ASSERT_RECOVER_NOOP(cond) do { KIS_ASSERT_RECOVER(cond) { qt_noop(); } } while (0)
/**
......@@ -135,9 +135,9 @@ KRITAGLOBAL_EXPORT void kis_safe_assert_recoverable(const char *assertion, const
*/
#define KIS_SAFE_ASSERT_RECOVER(cond) if (!(cond) && (kis_safe_assert_recoverable(#cond,__FILE__,__LINE__), true))
#define KIS_SAFE_ASSERT_RECOVER_BREAK(cond) KIS_SAFE_ASSERT_RECOVER(cond) { break; }
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond) KIS_SAFE_ASSERT_RECOVER(cond) { return; }
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val) KIS_SAFE_ASSERT_RECOVER(cond) { return (val); }
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond) KIS_SAFE_ASSERT_RECOVER(cond) { qt_noop(); }
#define KIS_SAFE_ASSERT_RECOVER_BREAK(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { break; } } while (0)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { return; } } while (0)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val) do { KIS_SAFE_ASSERT_RECOVER(cond) { return (val); } } while (0)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond) do { KIS_SAFE_ASSERT_RECOVER(cond) { qt_noop(); } } while (0)
#endif /* __KIS_ASSERT_H */
......@@ -46,3 +46,8 @@ int KisRecycleProjectionsJob::levelOfDetail() const
{
return 0;
}
QString KisRecycleProjectionsJob::debugName() const
{
return "KisRecycleProjectionsJob";
}
......@@ -41,6 +41,8 @@ public:
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisSafeNodeProjectionStoreBaseWSP m_projectionStore;
};
......
......@@ -47,7 +47,7 @@ private:
};
KisRunnableBasedStrokeStrategy::KisRunnableBasedStrokeStrategy(QString id, const KUndo2MagicString &name)
KisRunnableBasedStrokeStrategy::KisRunnableBasedStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name)
: KisSimpleStrokeStrategy(id, name),
m_jobsInterface(new JobsInterface(this))
{
......
......@@ -29,7 +29,7 @@ private:
struct JobsInterface;
public:
KisRunnableBasedStrokeStrategy(QString id, const KUndo2MagicString &name = KUndo2MagicString());
KisRunnableBasedStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name = KUndo2MagicString());
KisRunnableBasedStrokeStrategy(const KisRunnableBasedStrokeStrategy &rhs);
~KisRunnableBasedStrokeStrategy();
......
......@@ -48,7 +48,7 @@ struct StoreImplementaionInterface
template <typename DeviceSP>
struct StoreImplementation : public StoreImplementaionInterface
{
bool releaseDevice() {
bool releaseDevice() override {
bool hasDeletedProjection = false;
if (m_projection) {
......@@ -61,12 +61,12 @@ struct StoreImplementation : public StoreImplementaionInterface
return hasDeletedProjection;
}
virtual void discardCaches() {
virtual void discardCaches() override {
// qDebug() << "discard caches";
m_dirtyProjections.clear();
}
virtual void recycleProjectionsInSafety() {
virtual void recycleProjectionsInSafety() override {
// qDebug() << "recycle caches";
Q_FOREACH (DeviceSP projection, m_dirtyProjections) {
projection->clear();
......@@ -93,7 +93,7 @@ struct StoreImplementationForDevice : StoreImplementation<KisPaintDeviceSP>
m_projection = new KisPaintDevice(prototype);
}
StoreImplementaionInterface* clone() const {
StoreImplementaionInterface* clone() const override {
return m_projection ?
new StoreImplementationForDevice(*m_projection) :
new StoreImplementationForDevice();
......@@ -128,7 +128,7 @@ struct StoreImplementationForSelection : StoreImplementation<KisSelectionSP>
m_projection = new KisSelection(prototype);
}
StoreImplementaionInterface* clone() const {
StoreImplementaionInterface* clone() const override {
return m_projection ?
new StoreImplementationForSelection(*m_projection) :
new StoreImplementationForSelection();
......
......@@ -206,7 +206,8 @@ void KisNodePropertyListCommand::setNodePropertiesNoUndo(KisNodeSP node, KisImag
struct SimpleLodResettingStroke : public KisSimpleStrokeStrategy {
SimpleLodResettingStroke(KUndo2Command *cmd)
: m_cmd(cmd)
: KisSimpleStrokeStrategy(QLatin1String("SimpleLodResettingStroke")),
m_cmd(cmd)
{
setClearsRedoOnStart(false);
this->enableJob(JOB_INIT, true);
......
......@@ -63,7 +63,9 @@ KisCloneLayer::KisCloneLayer(KisLayerSP from, KisImageWSP image, const QString &
if (!imageSP) {
return;
}
m_d->fallback = new KisPaintDevice(imageSP->colorSpace());
m_d->fallback = new KisPaintDevice(this,
imageSP->colorSpace(),
new KisDefaultBounds(imageSP));
m_d->copyFrom = from;
m_d->type = COPY_PROJECTION;
......@@ -77,7 +79,9 @@ KisCloneLayer::KisCloneLayer(const KisCloneLayer& rhs)
: KisLayer(rhs)
, m_d(new Private(new KisDefaultBounds(rhs.image())))
{
m_d->fallback = new KisPaintDevice(rhs.m_d->fallback->colorSpace());
m_d->fallback = new KisPaintDevice(this,
rhs.m_d->fallback->colorSpace(),
new KisDefaultBounds(rhs.image()));
m_d->copyFrom = rhs.copyFrom();
m_d->type = rhs.copyType();
m_d->offset = rhs.m_d->offset;
......@@ -107,6 +111,12 @@ KisLayerSP KisCloneLayer::reincarnateAsPaintLayer() const
return newLayer;
}
void KisCloneLayer::setImage(KisImageWSP image)
{
m_d->fallback->setDefaultBounds(new KisDefaultBounds(image));
KisLayer::setImage(image);
}
bool KisCloneLayer::allowAsChild(KisNodeSP node) const
{
return node->inherits("KisMask");
......
......@@ -65,6 +65,8 @@ public:
*/
KisLayerSP reincarnateAsPaintLayer() const;
void setImage(KisImageWSP image) override;
bool allowAsChild(KisNodeSP) const override;
KisPaintDeviceSP original() const override;
......
......@@ -408,7 +408,7 @@ void KisImage::copyFromImageImpl(const KisImage &rhs, int policy)
bool exactCopy = policy & EXACT_COPY;
if (exactCopy || rhs.m_d->isolatedRootNode) {
if (exactCopy || rhs.m_d->isolatedRootNode || rhs.m_d->overlaySelectionMask) {
QQueue<KisNodeSP> linearizedNodes;
KisLayerUtils::recursiveApplyNodes(rhs.root(),
[&linearizedNodes](KisNodeSP node) {
......@@ -426,6 +426,13 @@ void KisImage::copyFromImageImpl(const KisImage &rhs, int policy)
rhs.m_d->isolatedRootNode == refNode) {
m_d->isolatedRootNode = node;
}
if (rhs.m_d->overlaySelectionMask &&
KisNodeSP(rhs.m_d->overlaySelectionMask) == refNode) {
m_d->targetOverlaySelectionMask = dynamic_cast<KisSelectionMask*>(node.data());
m_d->overlaySelectionMask = m_d->targetOverlaySelectionMask;
m_d->rootLayer->notifyChildMaskChanged();
}
});
}
......@@ -456,13 +463,6 @@ void KisImage::copyFromImageImpl(const KisImage &rhs, int policy)
m_d->blockLevelOfDetail = rhs.m_d->blockLevelOfDetail;
/**
* The overlay device is not inherited when cloning the image!
*/
if (rhs.m_d->overlaySelectionMask) {
const QRect dirtyRect = rhs.m_d->overlaySelectionMask->extent();
m_d->rootLayer->setDirty(dirtyRect);
}
#undef EMIT_IF_NEEDED
}
......@@ -532,7 +532,7 @@ void KisImage::setOverlaySelectionMask(KisSelectionMaskSP mask)
struct UpdateOverlaySelectionStroke : public KisSimpleStrokeStrategy {
UpdateOverlaySelectionStroke(KisImageSP image)
: KisSimpleStrokeStrategy("update-overlay-selection-mask", kundo2_noi18n("update-overlay-selection-mask")),
: KisSimpleStrokeStrategy(QLatin1String("update-overlay-selection-mask"), kundo2_noi18n("update-overlay-selection-mask")),
m_image(image)
{
this->enableJob(JOB_INIT, true, KisStrokeJobData::BARRIER, KisStrokeJobData::EXCLUSIVE);
......@@ -1263,9 +1263,21 @@ bool KisImage::assignLayerProfile(KisNodeSP node, const KoColorProfile *profile)
bool KisImage::assignImageProfile(const KoColorProfile *profile, bool blockAllUpdates)
{
if (!profile) return false;
const KoColorSpace *srcColorSpace = m_d->colorSpace;
bool imageProfileIsSame = *srcColorSpace->profile() == *profile;
if (!profile || *srcColorSpace->profile() == *profile) return false;
imageProfileIsSame &=
!KisLayerUtils::recursiveFindNode(m_d->rootLayer,
[profile] (KisNodeSP node) {
return *node->colorSpace()->profile() != *profile;
});
if (imageProfileIsSame) {
dbgImage << "Trying to set the same image profile again" << ppVar(srcColorSpace->profile()->name()) << ppVar(profile->name());
return true;
}
KUndo2MagicString actionName = kundo2_i18n("Assign Profile");
......@@ -1700,7 +1712,8 @@ bool KisImage::startIsolatedMode(KisNodeSP node)
{
struct StartIsolatedModeStroke : public KisRunnableBasedStrokeStrategy {
StartIsolatedModeStroke(KisNodeSP node, KisImageSP image)
: KisRunnableBasedStrokeStrategy("start-isolated-mode", kundo2_noi18n("start-isolated-mode")),
: KisRunnableBasedStrokeStrategy(QLatin1String("start-isolated-mode"),
kundo2_noi18n("start-isolated-mode")),
m_node(node),
m_image(image)
{
......@@ -1744,7 +1757,7 @@ void KisImage::stopIsolatedMode()
struct StopIsolatedModeStroke : public KisRunnableBasedStrokeStrategy {
StopIsolatedModeStroke(KisImageSP image)
: KisRunnableBasedStrokeStrategy("stop-isolated-mode", kundo2_noi18n("stop-isolated-mode")),
: KisRunnableBasedStrokeStrategy(QLatin1String("stop-isolated-mode"), kundo2_noi18n("stop-isolated-mode")),
m_image(image)
{
this->enableJob(JOB_INIT);
......
......@@ -53,3 +53,11 @@ int KisRecalculateGeneratorLayerJob::levelOfDetail() const
{
return 0;
}
QString KisRecalculateGeneratorLayerJob::debugName() const
{
QString result;
QDebug dbg(&result);
dbg << "KisRecalculateGeneratorLayerJob" << m_layer;
return result;
}
......@@ -32,6 +32,8 @@ public:
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisGeneratorLayerSP m_layer;
};
......
......@@ -90,3 +90,11 @@ int KisRecalculateTransformMaskJob::levelOfDetail() const
{
return 0;
}
QString KisRecalculateTransformMaskJob::debugName() const
{
QString result;
QDebug dbg(&result);
dbg << "KisRecalculateTransformMaskJob" << m_mask;
return result;
}
......@@ -32,6 +32,8 @@ public:
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisTransformMaskSP m_mask;
};
......
......@@ -78,7 +78,7 @@ struct KisRegenerateFrameStrokeStrategy::Private
KisRegenerateFrameStrokeStrategy::KisRegenerateFrameStrokeStrategy(int frameId,
const QRegion &dirtyRegion,
KisImageAnimationInterface *interface)
: KisSimpleStrokeStrategy("regenerate_external_frame_stroke"),
: KisSimpleStrokeStrategy(QLatin1String("regenerate_external_frame_stroke")),
m_d(new Private)
{
m_d->type = EXTERNAL_FRAME;
......@@ -102,7 +102,7 @@ KisRegenerateFrameStrokeStrategy::KisRegenerateFrameStrokeStrategy(int frameId,
}
KisRegenerateFrameStrokeStrategy::KisRegenerateFrameStrokeStrategy(KisImageAnimationInterface *interface)
: KisSimpleStrokeStrategy("regenerate_current_frame_stroke", kundo2_i18n("Render Animation")),
: KisSimpleStrokeStrategy(QLatin1String("regenerate_current_frame_stroke"), kundo2_i18n("Render Animation")),
m_d(new Private)
{
m_d->type = CURRENT_FRAME;
......@@ -200,7 +200,7 @@ KisStrokeStrategy* KisRegenerateFrameStrokeStrategy::createLodClone(int levelOfD
*/
return m_d->type == CURRENT_FRAME ?
new KisRegenerateFrameStrokeStrategy(m_d->interface) :
new KisSimpleStrokeStrategy("dumb-lodn-KisRegenerateFrameStrokeStrategy");
new KisSimpleStrokeStrategy(QLatin1String("dumb-lodn-KisRegenerateFrameStrokeStrategy"));
}
void KisRegenerateFrameStrokeStrategy::suspendStrokeCallback()
......
/*
* Copyright (c) 2018 Dmitry Kazakov <dimula73@gmail.com>
* Copyright (c) 2019 Dmitry Kazakov <dimula73@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -16,15 +16,16 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "kis_spontaneous_job.h"
#ifndef KIS_RUNNABLE_WITH_DEBUG_NAME_H
#define KIS_RUNNABLE_WITH_DEBUG_NAME_H
#include "kis_runnable.h"
#include <QString>
bool KisSpontaneousJob::isExclusive() const
class KRITAIMAGE_EXPORT KisRunnableWithDebugName : public KisRunnable
{
return m_isExclusive;
}
public:
virtual QString debugName() const = 0;
};
void KisSpontaneousJob::setExclusive(bool value)
{
}
#endif // KIS_RUNNABLE_WITH_DEBUG_NAME_H
......@@ -57,6 +57,7 @@ public:
KoColor maskColor;
void slotSelectionChangedCompressed();
void slotConfigChangedImpl(bool blockUpdates);
void slotConfigChanged();
};
......@@ -77,7 +78,7 @@ KisSelectionMask::KisSelectionMask(KisImageWSP image)
this->moveToThread(image->thread());
connect(KisImageConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged()));
m_d->slotConfigChanged();
m_d->slotConfigChangedImpl(false);
}
KisSelectionMask::KisSelectionMask(const KisSelectionMask& rhs)
......@@ -92,7 +93,7 @@ KisSelectionMask::KisSelectionMask(const KisSelectionMask& rhs)
this->moveToThread(m_d->image->thread());
connect(KisImageConfigNotifier::instance(), SIGNAL(configChanged()), SLOT(slotConfigChanged()));
m_d->slotConfigChanged();
m_d->slotConfigChangedImpl(false);
}
KisSelectionMask::~KisSelectionMask()
......@@ -303,7 +304,7 @@ void KisSelectionMask::Private::slotSelectionChangedCompressed()
currentSelection->notifySelectionChanged();
}
void KisSelectionMask::Private::slotConfigChanged()
void KisSelectionMask::Private::slotConfigChangedImpl(bool doUpdates)
{
const KoColorSpace *cs = image ?
image->colorSpace() :
......@@ -313,9 +314,14 @@ void KisSelectionMask::Private::slotConfigChanged()
maskColor = KoColor(cfg.selectionOverlayMaskColor(), cs);
if (image && image->overlaySelectionMask() == q) {
if (doUpdates && image && image->overlaySelectionMask() == q) {
q->setDirty();
}
}
void KisSelectionMask::Private::slotConfigChanged()
{
slotConfigChangedImpl(true);
}
#include "moc_kis_selection_mask.cpp"
......@@ -61,6 +61,12 @@ public:
}
}
QString debugId() const override {
return QString("%1/%2")
.arg(m_parentStroke->id())
.arg(KisSimpleStrokeStrategy::jobTypeToString(m_type));
}
private:
KisSimpleStrokeStrategy::JobType m_type;
KisSimpleStrokeStrategy *m_parentStroke;
......@@ -71,7 +77,7 @@ private:
/* KisSimpleStrokeStrategy */
/***************************************************************/
KisSimpleStrokeStrategy::KisSimpleStrokeStrategy(QString id, const KUndo2MagicString &name)
KisSimpleStrokeStrategy::KisSimpleStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name)
: KisStrokeStrategy(id, name),
m_jobEnabled(NJOBS, false),
m_jobSequentiality(NJOBS, KisStrokeJobData::SEQUENTIAL),
......@@ -195,3 +201,33 @@ void KisSimpleStrokeStrategy::suspendStrokeCallback()
void KisSimpleStrokeStrategy::resumeStrokeCallback()
{
}
QLatin1String KisSimpleStrokeStrategy::jobTypeToString(KisSimpleStrokeStrategy::JobType type)
{
QLatin1String result;
switch (type) {
case JOB_INIT:
result = QLatin1String("init");
break;
case JOB_DOSTROKE:
result = QLatin1String("dostroke");
break;
case JOB_FINISH:
result = QLatin1String("finish");
break;
case JOB_CANCEL:
result = QLatin1String("cancel");
break;
case JOB_SUSPEND:
result = QLatin1String("suspend");
break;
case JOB_RESUME:
result = QLatin1String("resume");
break;
case NJOBS:
qFatal("Undefined stroke job type: %d", type);
}
return result;
}
......@@ -39,7 +39,7 @@ public:
};
public:
KisSimpleStrokeStrategy(QString id = QString(), const KUndo2MagicString &name = KUndo2MagicString());
KisSimpleStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name = KUndo2MagicString());
KisStrokeJobStrategy* createInitStrategy() override;
KisStrokeJobStrategy* createFinishStrategy() override;
......@@ -61,6 +61,8 @@ public:
virtual void suspendStrokeCallback();
virtual void resumeStrokeCallback();
static QLatin1String jobTypeToString(JobType type);
protected:
void enableJob(JobType type, bool enable = true,
KisStrokeJobData::Sequentiality sequentiality = KisStrokeJobData::SEQUENTIAL,
......
......@@ -19,7 +19,7 @@
#ifndef __KIS_SPONTANEOUS_JOB_H
#define __KIS_SPONTANEOUS_JOB_H
#include "kis_runnable.h"
#include "kis_runnable_with_debug_name.h"
/**
* This class represents a simple update just that should be
......@@ -27,7 +27,7 @@
* any undo support. Just some useful update that
* can be run concurrently with other types updates.
*/
class KRITAIMAGE_EXPORT KisSpontaneousJob : public KisRunnable
class KRITAIMAGE_EXPORT KisSpontaneousJob : public KisRunnableWithDebugName
{
public:
virtual bool overrides(const KisSpontaneousJob *otherJob) = 0;
......
......@@ -19,10 +19,10 @@
#ifndef __KIS_STROKE_JOB_H
#define __KIS_STROKE_JOB_H
#include "kis_runnable.h"
#include "kis_runnable_with_debug_name.h"
#include "kis_stroke_job_strategy.h"
class KisStrokeJob : public KisRunnable
class KisStrokeJob : public KisRunnableWithDebugName
{
public:
KisStrokeJob(KisStrokeJobStrategy *strategy,
......@@ -76,6 +76,10 @@ public:
return m_isOwnJob;
}
QString debugName() const override {
return m_dabStrategy->debugId();
}
private:
// for testing use only, do not use in real code
friend QString getJobName(KisStrokeJob *job);
......
......@@ -20,6 +20,7 @@
#define __KIS_STROKE_JOB_STRATEGY_H
#include "kritaimage_export.h"
#include <QLatin1String>
class KRITAIMAGE_EXPORT KisStrokeJobData
......@@ -71,6 +72,7 @@ public:
virtual ~KisStrokeJobStrategy();
virtual void run(KisStrokeJobData *data) = 0;
virtual QString debugId() const = 0;
private:
......
......@@ -22,7 +22,7 @@
#include "KisStrokesQueueMutatedJobInterface.h"
KisStrokeStrategy::KisStrokeStrategy(QString id, const KUndo2MagicString &name)
KisStrokeStrategy::KisStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name)
: m_exclusive(false),
m_supportsWrapAroundMode(false),
m_clearsRedoOnStart(true),
......
......@@ -32,7 +32,7 @@ class KisStrokesQueueMutatedJobInterface;
class KRITAIMAGE_EXPORT KisStrokeStrategy
{
public:
KisStrokeStrategy(QString id = QString(), const KUndo2MagicString &name = KUndo2MagicString());
KisStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name = KUndo2MagicString());
virtual ~KisStrokeStrategy();
/**
......@@ -199,7 +199,7 @@ private:
bool m_needsExplicitCancel;
qreal m_balancingRatioOverride;
QString m_id;
QLatin1String m_id;
KUndo2MagicString m_name;
KisStrokeId m_cancelStrokeId;
......
......@@ -30,7 +30,7 @@ KisStrokeStrategyUndoCommandBased(const KUndo2MagicString &name,
KisStrokeUndoFacade *undoFacade,
KUndo2CommandSP initCommand,
KUndo2CommandSP finishCommand)
: KisRunnableBasedStrokeStrategy("STROKE_UNDO_COMMAND_BASED", name),
: KisRunnableBasedStrokeStrategy(QLatin1String("STROKE_UNDO_COMMAND_BASED"), name),
m_undo(undo),
m_initCommand(initCommand),
m_finishCommand(finishCommand),
......
......@@ -359,7 +359,9 @@ struct KisSuspendProjectionUpdatesStrokeStrategy::Private
};
KisSuspendProjectionUpdatesStrokeStrategy::KisSuspendProjectionUpdatesStrokeStrategy(KisImageWSP image, bool suspend)
: KisRunnableBasedStrokeStrategy(suspend ? "suspend_stroke_strategy" : "resume_stroke_strategy"),
: KisRunnableBasedStrokeStrategy(suspend ?
QLatin1String("suspend_stroke_strategy") :
QLatin1String("resume_stroke_strategy")),
m_d(new Private)
{
m_d->image = image;
......
......@@ -41,7 +41,7 @@ KisSwitchTimeStrokeStrategy::KisSwitchTimeStrokeStrategy(int frameId,
bool needsRegeneration,
KisImageAnimationInterface *interface,
KisPostExecutionUndoAdapter *undoAdapter)
: KisSimpleStrokeStrategy("switch_current_frame_stroke", kundo2_i18n("Switch Frames")),
: KisSimpleStrokeStrategy(QLatin1String("switch_current_frame_stroke"), kundo2_i18n("Switch Frames")),
m_d(new Private(frameId, needsRegeneration))
{
m_d->interface = interface;
......
......@@ -67,7 +67,7 @@ struct KisSyncLodCacheStrokeStrategy::Private
};
KisSyncLodCacheStrokeStrategy::KisSyncLodCacheStrokeStrategy(KisImageWSP image, bool forgettable)
: KisSimpleStrokeStrategy("SyncLodCacheStroke", kundo2_i18n("Instant Preview")),
: KisSimpleStrokeStrategy(QLatin1String("SyncLodCacheStroke"), kundo2_i18n("Instant Preview")),
m_d(new Private)
{
m_d->image = image;
......
......@@ -30,6 +30,8 @@
#include "kis_async_merger.h"
#include "kis_updater_context.h"
//#define DEBUG_JOBS_SEQUENCE
class KisUpdateJobItem : public QObject, public QRunnable
{
......@@ -88,7 +90,19 @@ public:
KIS_ASSERT(m_atomicType == Type::STROKE ||
m_atomicType == Type::SPONTANEOUS);
if (m_runnableJob) m_runnableJob->run();
if (m_runnableJob) {
#ifdef DEBUG_JOBS_SEQUENCE
if (m_atomicType == Type::STROKE) {
qDebug() << "running: stroke" << m_runnableJob->debugName();
} else if (m_atomicType == Type::SPONTANEOUS) {
qDebug() << "running: spont " << m_runnableJob->debugName();
} else {
qDebug() << "running: unkn. " << m_runnableJob->debugName();
}
#endif
m_runnableJob->run();
}
}
setDone();
......@@ -114,6 +128,12 @@ public:
KIS_SAFE_ASSERT_RECOVER_RETURN(m_walker);
// dbgKrita << "Executing merge job" << m_walker->changeRect()
// << "on thread" << QThread::currentThreadId();
#ifdef DEBUG_JOBS_SEQUENCE
qDebug() << "running: merge " << m_walker->startNode() << m_walker->changeRect();
#endif
m_merger.startMerge(*m_walker);
QRect changeRect = m_walker->changeRect();
......@@ -230,7 +250,7 @@ private:
* Runnable jobs part
* The job is owned by the context and deleted after completion
*/
KisRunnable *m_runnableJob;
KisRunnableWithDebugName *m_runnableJob;
/**
* Merge jobs part
......
......@@ -44,3 +44,8 @@ int KisUpdateOutlineJob::levelOfDetail() const
{
return 0;
}
QString KisUpdateOutlineJob::debugName() const
{
return "KisUpdateOutlineJob";
}
......@@ -32,6 +32,7 @@ public:
bool overrides(const KisSpontaneousJob *otherJob) override;
void run() override;
int levelOfDetail() const override;
QString debugName() const override;
private:
KisSelectionSP m_selection;
......
......@@ -86,3 +86,8 @@ int KisUpdateSelectionJob::levelOfDetail() const
{
return 0;
}
QString KisUpdateSelectionJob::debugName() const
{
return "KisUpdateSelectionJob";
}