frameCompletedCallback is called by the renderer when a new frame becomes ready
NOTE1: the callback is called from the context of a image worker thread! So it is asynchronous from the GUI thread. NOTE2: in case of successful processing of the frame, the callback must issue some signal, connected to notifyFrameCompleted() via auto connection, to continue processing. Please do not call the method directly, because notifyFame*() slots should be called from the context of the GUI thread. NOTE3: In case of failure, notifyFrameCancelled(). The same threading rules apply.
Implements KisAsyncAnimationRendererBase.
Definition at line 92 of file KisAsyncAnimationFramesSavingRenderer.cpp.
93{
95 if (!image) return;
96
99 return;
100 }
101
103
105
106 QString frameNumber = QString(
"%1").arg(frame +
m_d->sequenceNumberingOffset, 4, 10, QChar(
'0'));
107 QString filename =
m_d->filenamePrefix + frameNumber +
m_d->filenameSuffix;
108
109 if (!
m_d->savingDoc->exportDocumentSync(filename,
m_d->outputMimeType,
m_d->exportConfiguration)) {
111 }
112
113
116 identicals &=
m_d->range;
117 if( !
m_d->onlyNeedsUniqueFrames && identicals.
start() < identicals.
end() ) {
118 for (
int identicalFrame = (identicals.
start() + 1); identicalFrame <= identicals.
end(); identicalFrame++) {
119 QString identicalFrameNumber = QString(
"%1").arg(identicalFrame +
m_d->sequenceNumberingOffset, 4, 10, QChar(
'0'));
120 QString identicalFrameName =
m_d->filenamePrefix + identicalFrameNumber +
m_d->filenameSuffix;
121
122 bool copyOk;
123 QString copyErrorMessage;
124#ifdef Q_OS_ANDROID
126#else
127 QFile sourceFile(filename);
128 if (sourceFile.copy(identicalFrameName)) {
129 copyOk = true;
130 } else {
131 copyOk = false;
132 copyErrorMessage = sourceFile.errorString();
133 }
134#endif
135 if (!copyOk) {
136 warnFile.nospace() <<
"Failed to copy frame '" << filename <<
"' to '" << identicalFrameName
137 << "': " << copyErrorMessage;
139 break;
140 }
141
142
143
144
145
146
147
148
149
150
151 }
152 }
153 }
154
157 } else {
159 }
160}
KisPaintDeviceSP projection() const
QRect bounds() const override
static KisTimeSpan calculateIdenticalFramesRecursive(const KisNode *node, int time)
#define KIS_SAFE_ASSERT_RECOVER(cond)
bool copyFile(const QString &inputPath, const QString &outputPath, QString *outErrorMessage)
KisImageSP requestedImage
KisRegion requestedRegion
References KisImage::bounds(), KisTimeSpan::calculateIdenticalFramesRecursive(), KisAndroidUtils::copyFile(), KisTimeSpan::end(), ImportExportCodes::ErrorWhileWriting, ImportExportCodes::InternalError, KisImportExportErrorCode::isOk(), KIS_SAFE_ASSERT_RECOVER, m_d, ImportExportCodes::OK, KisImage::projection(), KisAsyncAnimationRendererBase::RenderingFailed, KisAsyncAnimationRendererBase::requestedImage, KisAsyncAnimationRendererBase::requestedRegion, KisNodeFacade::root, sigCancelRegenerationInternal(), sigCompleteRegenerationInternal(), KisTimeSpan::start(), and warnFile.