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.

parent 9005f1b8
Pipeline #80789 skipped with stage
......@@ -194,6 +194,7 @@ Q_SIGNALS:
// 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()
KisSuspendProjectionUpdatesStrokeStrategy::SuspendFrameInvalidationHandle::SuspendFrameInvalidationHandle(KisImageAnimationInterface *interface)
: m_interface(interface)
......@@ -19,6 +19,16 @@ public:
using SharedDataSP = QSharedPointer<SharedData>;
struct SuspendFrameInvalidationHandle {
SuspendFrameInvalidationHandle(class KisImageAnimationInterface* interface);
KisImageAnimationInterface* m_interface;
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();
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