|
Krita Source Code Documentation
|
KisAsyncAnimationRenderDialogBase is a special class for rendering multiple frames of the image and putting them somewhere (saving into a file or just pushing into an openGL cache) More...
#include <KisAsyncAnimationRenderDialogBase.h>
Inheritance diagram for KisAsyncAnimationRenderDialogBase:Classes | |
| struct | Private |
Public Types | |
| enum | Result { RenderComplete , RenderCancelled , RenderFailed , RenderTimedOut } |
Public Member Functions | |
| bool | batchMode () const |
| KisAsyncAnimationRenderDialogBase (const QString &actionTitle, KisImageSP image, int busyWait=200) | |
| construct and initialize the dialog | |
| virtual Result | regenerateRange (KisViewManager *viewManager) |
| start generation of frames and (if not in batch mode) show the dialog | |
| KisRegion | regionOfInterest () const |
| void | setBatchMode (bool value) |
| setting batch mode to true will prevent any dialogs or message boxes from showing on screen. Please take it into account that using batch mode prevents some potentially dangerous recovery execution paths (e.g. delete the existing frames in the destination folder). In such case the rendering will be stopped with RenderFailed result. | |
| void | setRegionOfInterest (const KisRegion &roi) |
| virtual | ~KisAsyncAnimationRenderDialogBase () |
Protected Member Functions | |
| virtual QList< int > | calcDirtyFrames () const =0 |
| returns a list of frames that should be regenerated by the dialog | |
| virtual KisAsyncAnimationRendererBase * | createRenderer (KisImageSP image)=0 |
create a renderer object linked to image | |
| virtual void | initializeRendererForFrame (KisAsyncAnimationRendererBase *renderer, KisImageSP image, int frame)=0 |
Private Slots | |
| void | slotCancelRegeneration () |
| void | slotFrameCancelled (int frame, KisAsyncAnimationRendererBase::CancelReason cancelReason) |
| void | slotFrameCompleted (int frame) |
| void | slotUpdateCompressedProgressData () |
Private Member Functions | |
| void | cancelProcessingImpl (KisAsyncAnimationRendererBase::CancelReason cancelReason) |
| void | tryInitiateFrameRegeneration () |
| void | updateProgressLabel () |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
KisAsyncAnimationRenderDialogBase is a special class for rendering multiple frames of the image and putting them somewhere (saving into a file or just pushing into an openGL cache)
The class handles a lot of boilerplate code for you and optimizes regeneration of the frames using multithreading, according to the user's settings. The responsibilities of the class are the following:
Rendering itself:
Progress reporting:
Usage Details:
Definition at line 50 of file KisAsyncAnimationRenderDialogBase.h.
| Enumerator | |
|---|---|
| RenderComplete | |
| RenderCancelled | |
| RenderFailed | |
| RenderTimedOut | |
Definition at line 54 of file KisAsyncAnimationRenderDialogBase.h.
| KisAsyncAnimationRenderDialogBase::KisAsyncAnimationRenderDialogBase | ( | const QString & | actionTitle, |
| KisImageSP | image, | ||
| int | busyWait = 200 ) |
construct and initialize the dialog
| actionTitle | the first line of the status reports that the user sees in the dialog |
| image | the image that will be as a source of frames. Make sure the image is not locked by the time regenerateRange() is called |
| busyWait | the dialog will not show for the specified time (in milliseconds) |
Definition at line 112 of file KisAsyncAnimationRenderDialogBase.cpp.
References connect(), m_d, and slotUpdateCompressedProgressData().
|
virtual |
Definition at line 119 of file KisAsyncAnimationRenderDialogBase.cpp.
| bool KisAsyncAnimationRenderDialogBase::batchMode | ( | ) | const |
Definition at line 404 of file KisAsyncAnimationRenderDialogBase.cpp.
References m_d.
|
protectedpure virtual |
returns a list of frames that should be regenerated by the dialog
Called by the dialog in the very beginning of regenerateRange()
Implemented in KisAsyncAnimationCacheRenderDialog, and KisAsyncAnimationFramesSaveDialog.
|
private |
Definition at line 286 of file KisAsyncAnimationRenderDialogBase.cpp.
References KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, RenderCancelled, RenderFailed, KisAsyncAnimationRendererBase::RenderingFailed, RenderTimedOut, updateProgressLabel(), and KisAsyncAnimationRendererBase::UserCancelled.
|
protectedpure virtual |
create a renderer object linked to image
Renderer are special objects that connect to the individual image signals, react on them and fetch the final frames data
Implemented in KisAsyncAnimationCacheRenderDialog, and KisAsyncAnimationFramesSaveDialog.
|
protectedpure virtual |
Implemented in KisAsyncAnimationCacheRenderDialog, and KisAsyncAnimationFramesSaveDialog.
|
virtual |
start generation of frames and (if not in batch mode) show the dialog
The link to view manager is used to barrier lock with visual feedback in the end of the operation
Since this method can be called from the places where no view manager is available, we need this manually crafted ugly construction to "try-lock-cancel" the image.
Reimplemented in KisAsyncAnimationFramesSaveDialog.
Definition at line 124 of file KisAsyncAnimationRenderDialogBase.cpp.
References KisImage::barrierLock(), KisViewManager::blockUntilOperationsFinished(), KisViewManager::blockUntilOperationsFinishedForced(), calcDirtyFrames(), KisImage::clone(), connect(), createRenderer(), KisImageConfig::frameRenderingClones(), KIS_SAFE_ASSERT_RECOVER_NOOP, m_d, KisViewManager::mainWindowAsQWidget(), KisImageConfig::maxNumberOfThreads(), RenderCancelled, RenderComplete, KisImage::setWorkingThreadsLimit(), slotCancelRegeneration(), slotFrameCancelled(), slotFrameCompleted(), tryInitiateFrameRegeneration(), KisImage::unlock(), updateProgressLabel(), and KisAsyncActionFeedback::waitForMutex().
| KisRegion KisAsyncAnimationRenderDialogBase::regionOfInterest | ( | ) | const |
Definition at line 259 of file KisAsyncAnimationRenderDialogBase.cpp.
References m_d.
| void KisAsyncAnimationRenderDialogBase::setBatchMode | ( | bool | value | ) |
setting batch mode to true will prevent any dialogs or message boxes from showing on screen. Please take it into account that using batch mode prevents some potentially dangerous recovery execution paths (e.g. delete the existing frames in the destination folder). In such case the rendering will be stopped with RenderFailed result.
Definition at line 399 of file KisAsyncAnimationRenderDialogBase.cpp.
Set area of image that will be regenerated. If roi is empty, full area of the image is regenerated.
Definition at line 254 of file KisAsyncAnimationRenderDialogBase.cpp.
References m_d.
|
privateslot |
Definition at line 281 of file KisAsyncAnimationRenderDialogBase.cpp.
References cancelProcessingImpl(), and KisAsyncAnimationRendererBase::UserCancelled.
|
privateslot |
Definition at line 274 of file KisAsyncAnimationRenderDialogBase.cpp.
References cancelProcessingImpl().
|
privateslot |
Definition at line 264 of file KisAsyncAnimationRenderDialogBase.cpp.
References m_d, tryInitiateFrameRegeneration(), and updateProgressLabel().
|
privateslot |
Qt's implementation of QProgressDialog is a bit weird: it calls QApplication::processEvents() from inside setValue(), which means that our update method may reenter multiple times.
This code avoids reentering by using a compressor and an explicit entrance counter.
Definition at line 372 of file KisAsyncAnimationRenderDialogBase.cpp.
References m_d.
|
private |
Definition at line 305 of file KisAsyncAnimationRenderDialogBase.cpp.
References initializeRendererForFrame(), m_d, and KisAsyncAnimationRendererBase::None.
|
private |
We should avoid reentrancy caused by explicit QApplication::processEvents() in QProgressDialog::setValue(), so use a compressor instead
Definition at line 330 of file KisAsyncAnimationRenderDialogBase.cpp.
References m_d.
|
private |
Definition at line 140 of file KisAsyncAnimationRenderDialogBase.h.