Commit b9eed7ba authored by Eoin O'Neill's avatar Eoin O'Neill 🍀
Browse files

Fix frame cache invalidation with live preview on Windows.

I couldn't determine why this behavior is different between windows and
linux, but I was able to solve the issue. Basically, when we refresh
graph async we want to block frame invalidation temporarily since we
will do so later in the method manually if it's necessary.

I also noticed we have a few uses of `friend class` here or there that
need to eventually be cleaned up. I've made a note of it, and I will
handle it once Krita 5 is officially out.

BUG:441587
parent 9005f1b8
Pipeline #80789 skipped with stage
......@@ -194,6 +194,7 @@ Q_SIGNALS:
private:
// interface for:
friend class KisRegenerateFrameStrokeStrategy;
friend class KisSuspendProjectionUpdatesStrokeStrategy; //TODO These friend classes are ugly. Let's refactor after Krita 5 release.
friend class KisAnimationFrameCacheTest;
friend struct KisLayerUtils::SwitchFrameCommand;
friend class KisImageTest;
......
......@@ -10,6 +10,7 @@
#include <krita_utils.h>
#include <kis_projection_updates_filter.h>
#include "kis_image_signal_router.h"
#include "kis_image_animation_interface.h"
#include "kundo2command.h"
#include "KisRunnableStrokeJobDataBase.h"
......@@ -156,6 +157,8 @@ struct KisSuspendProjectionUpdatesStrokeStrategy::Private
for (; reqIt != fullRefreshRequests.end(); ++reqIt) {
const QVector<QRect> simplifiedRects = KisRegion::fromOverlappingRects(reqIt.value(), step).rects();
//Block frame cache drop here. We handle this manually later anyway, so we should just block invalidation.
SuspendFrameInvalidationHandle handle(image->animationInterface());
image->refreshGraphAsync(node, simplifiedRects, reqIt.key());
}
}
......@@ -657,3 +660,15 @@ void KisSuspendProjectionUpdatesStrokeStrategy::resumeStrokeCallback()
runnableJobsInterface()->addRunnableJobs(jobs);
}
KisSuspendProjectionUpdatesStrokeStrategy::SuspendFrameInvalidationHandle::SuspendFrameInvalidationHandle(KisImageAnimationInterface *interface)
: m_interface(interface)
{
KIS_ASSERT(m_interface);
m_interface->blockFrameInvalidation(true);
}
KisSuspendProjectionUpdatesStrokeStrategy::SuspendFrameInvalidationHandle::~SuspendFrameInvalidationHandle()
{
m_interface->blockFrameInvalidation(false);
}
......@@ -19,6 +19,16 @@ public:
};
using SharedDataSP = QSharedPointer<SharedData>;
struct SuspendFrameInvalidationHandle {
public:
SuspendFrameInvalidationHandle(class KisImageAnimationInterface* interface);
~SuspendFrameInvalidationHandle();
private:
KisImageAnimationInterface* m_interface;
};
public:
KisSuspendProjectionUpdatesStrokeStrategy(KisImageWSP image, bool suspend, SharedDataSP sharedData);
~KisSuspendProjectionUpdatesStrokeStrategy() override;
......@@ -26,6 +36,7 @@ public:
static QList<KisStrokeJobData*> createSuspendJobsData(KisImageWSP image);
static QList<KisStrokeJobData*> createResumeJobsData(KisImageWSP image);
static SharedDataSP createSharedData();
private:
void initStrokeCallback() override;
void doStrokeCallback(KisStrokeJobData *data) override;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment