diff --git a/libs/image/kis_strokes_queue.cpp b/libs/image/kis_strokes_queue.cpp index f679d50..fa2a941 100644 --- a/libs/image/kis_strokes_queue.cpp +++ b/libs/image/kis_strokes_queue.cpp @@ -200,10 +200,30 @@ KisStrokeId KisStrokesQueue::startStroke(KisStrokeStrategy *strokeStrategy) m_d->cancelForgettableStrokes(); + /** + * Debugging random non-lod strokes when you expected them to be LoD. When you see a "slow" stroke, check the last debugging line (it appears once per stroke + * + * Possibilities: + * + * * If m_d->desiredLevelOfDetail is zero, then some GUI signal has reset the LoD with image->setDesiredLevelOfDetail. That usually happens during zoom + * + * * [MOST PROBABLE CAUSE] m_d->canUseLodN() --- then there is some slow non-lod stroke is still running and therefore the LoD is not available (this is by design, it can be fixed but needs work) + * + * * lodBuddyStrategy is null --- the stroke doesn't support lod + * + * * m_d->lodNNeedsSynchronization --- can only cause a delay before starting a LoD stroke + */ + + qDebug() << ppVar(m_d->desiredLevelOfDetail) << ppVar(m_d->canUseLodN()) << ppVar(m_d->lodNNeedsSynchronization); + + bool strokeSupportsLod = false; + + if (m_d->desiredLevelOfDetail && m_d->canUseLodN() && (lodBuddyStrategy = - strokeStrategy->createLodClone(m_d->desiredLevelOfDetail))) { + strokeStrategy->createLodClone(m_d->desiredLevelOfDetail)) && + (strokeSupportsLod = lodBuddyStrategy)) { if (m_d->lodNNeedsSynchronization) { m_d->startLod0ToNStroke(m_d->desiredLevelOfDetail, false); @@ -232,6 +252,18 @@ KisStrokeId KisStrokesQueue::startStroke(KisStrokeStrategy *strokeStrategy) } } else { + if (m_d->desiredLevelOfDetail && + strokeSupportsLod && + !m_d->canUseLodN()) { + + qDebug() << "Failed to start a LodN stroke although the strategy supports it!"; + qDebug() << "Dump of currently running strokes:"; + + Q_FOREACH (KisStrokeSP stroke, m_d->strokesQueue) { + qDebug() << ppVar(stroke->name()) << ppVar(stroke->type()); + } + } + stroke = KisStrokeSP(new KisStroke(strokeStrategy, KisStroke::LEGACY, 0)); m_d->strokesQueue.enqueue(stroke); }