Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAsyncAnimationCacheRenderDialog Class Reference

#include <KisAsyncAnimationCacheRenderDialog.h>

+ Inheritance diagram for KisAsyncAnimationCacheRenderDialog:

Classes

struct  Private
 

Public Member Functions

 KisAsyncAnimationCacheRenderDialog (KisAnimationFrameCacheSP cache, const KisTimeSpan &range, int busyWait=200)
 
virtual ~KisAsyncAnimationCacheRenderDialog ()
 
- Public Member Functions inherited from KisAsyncAnimationRenderDialogBase
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 ()
 

Static Public Member Functions

static int calcFirstDirtyFrame (KisAnimationFrameCacheSP cache, const KisTimeSpan &playbackRange, const KisTimeSpan &skipRange)
 

Protected Member Functions

QList< int > calcDirtyFrames () const override
 returns a list of frames that should be regenerated by the dialog
 
KisAsyncAnimationRendererBasecreateRenderer (KisImageSP image) override
 create a renderer object linked to image
 
void initializeRendererForFrame (KisAsyncAnimationRendererBase *renderer, KisImageSP image, int frame) override
 

Private Attributes

const QScopedPointer< Privatem_d
 

Additional Inherited Members

- Public Types inherited from KisAsyncAnimationRenderDialogBase
enum  Result { RenderComplete , RenderCancelled , RenderFailed , RenderTimedOut }
 

Detailed Description

Definition at line 14 of file KisAsyncAnimationCacheRenderDialog.h.

Constructor & Destructor Documentation

◆ KisAsyncAnimationCacheRenderDialog()

KisAsyncAnimationCacheRenderDialog::KisAsyncAnimationCacheRenderDialog ( KisAnimationFrameCacheSP cache,
const KisTimeSpan & range,
int busyWait = 200 )

Definition at line 103 of file KisAsyncAnimationCacheRenderDialog.cpp.

104 : KisAsyncAnimationRenderDialogBase(i18n("Regenerating cache..."), cache->image(), busyWait),
105 m_d(new Private(cache, range))
106{
107}
KisAsyncAnimationRenderDialogBase(const QString &actionTitle, KisImageSP image, int busyWait=200)
construct and initialize the dialog

◆ ~KisAsyncAnimationCacheRenderDialog()

KisAsyncAnimationCacheRenderDialog::~KisAsyncAnimationCacheRenderDialog ( )
virtual

Definition at line 109 of file KisAsyncAnimationCacheRenderDialog.cpp.

110{
111
112}

Member Function Documentation

◆ calcDirtyFrames()

QList< int > KisAsyncAnimationCacheRenderDialog::calcDirtyFrames ( ) const
overrideprotectedvirtual

returns a list of frames that should be regenerated by the dialog

Called by the dialog in the very beginning of regenerateRange()

Implements KisAsyncAnimationRenderDialogBase.

Definition at line 114 of file KisAsyncAnimationCacheRenderDialog.cpp.

115{
116 return calcDirtyFramesList(m_d->cache, m_d->range);
117}

References m_d.

◆ calcFirstDirtyFrame()

int KisAsyncAnimationCacheRenderDialog::calcFirstDirtyFrame ( KisAnimationFrameCacheSP cache,
const KisTimeSpan & playbackRange,
const KisTimeSpan & skipRange )
static

Definition at line 56 of file KisAsyncAnimationCacheRenderDialog.cpp.

57{
58 int result = -1;
59
60 KisImageSP image = cache->image();
61 if (!image) return result;
62
64 if (!animation->hasAnimation()) return result;
65
66 if (playbackRange.isValid()) {
67 KIS_ASSERT_RECOVER_RETURN_VALUE(!playbackRange.isInfinite(), result);
68
69 // TODO: optimize check for fully-cached case
70 for (int frame = playbackRange.start(); frame <= playbackRange.end(); frame++) {
71 if (skipRange.contains(frame)) {
72 if (skipRange.isInfinite()) {
73 break;
74 } else {
75 frame = skipRange.end();
76 continue;
77 }
78 }
79
80 if (cache->frameStatus(frame) != KisAnimationFrameCache::Cached) {
81 result = frame;
82 break;
83 }
84 }
85 }
86
87 return result;
88}
CacheStatus frameStatus(int time) const
KisImageAnimationInterface * animationInterface() const
bool contains(int time) const
int start() const
bool isInfinite() const
int end() const
bool isValid() const
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val)
Definition kis_assert.h:85

References KisImage::animationInterface(), KisAnimationFrameCache::Cached, KisTimeSpan::contains(), KisTimeSpan::end(), KisAnimationFrameCache::frameStatus(), KisImageAnimationInterface::hasAnimation(), KisAnimationFrameCache::image(), KisTimeSpan::isInfinite(), KisTimeSpan::isValid(), KIS_ASSERT_RECOVER_RETURN_VALUE, and KisTimeSpan::start().

◆ createRenderer()

KisAsyncAnimationRendererBase * KisAsyncAnimationCacheRenderDialog::createRenderer ( KisImageSP image)
overrideprotectedvirtual

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

See also
KisAsyncAnimationRendererBase

Implements KisAsyncAnimationRenderDialogBase.

Definition at line 119 of file KisAsyncAnimationCacheRenderDialog.cpp.

◆ initializeRendererForFrame()

void KisAsyncAnimationCacheRenderDialog::initializeRendererForFrame ( KisAsyncAnimationRendererBase * renderer,
KisImageSP image,
int frame )
overrideprotectedvirtual

Implements KisAsyncAnimationRenderDialogBase.

Definition at line 125 of file KisAsyncAnimationCacheRenderDialog.cpp.

126{
127 Q_UNUSED(image);
128 Q_UNUSED(frame);
129
130 KisAsyncAnimationCacheRenderer *cacheRenderer =
131 dynamic_cast<KisAsyncAnimationCacheRenderer*>(renderer);
132
133 KIS_SAFE_ASSERT_RECOVER_RETURN(cacheRenderer);
134
135 cacheRenderer->setFrameCache(m_d->cache);
136}
void setFrameCache(KisAnimationFrameCacheSP cache)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128

References KIS_SAFE_ASSERT_RECOVER_RETURN, m_d, and KisAsyncAnimationCacheRenderer::setFrameCache().

Member Data Documentation

◆ m_d

const QScopedPointer<Private> KisAsyncAnimationCacheRenderDialog::m_d
private

Definition at line 30 of file KisAsyncAnimationCacheRenderDialog.h.


The documentation for this class was generated from the following files: