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

#include <kis_image_signal_router.h>

+ Inheritance diagram for KisImageSignalRouter:

Public Slots

void emitImageModifiedNotification ()
 

Signals

void sigColorSpaceChanged (const KoColorSpace *cs)
 
void sigImageModified ()
 
void sigImageModifiedWithoutUndo ()
 
void sigLayersChangedAsync ()
 
void sigNodeAddedAsync (KisNodeSP node, KisNodeAdditionFlags flags)
 
void sigNodeChanged (KisNodeSP node)
 
void sigNotification (KisImageSignalType type)
 
void sigNotifyBatchUpdateEnded ()
 
void sigNotifyBatchUpdateStarted ()
 
void sigProfileChanged (const KoColorProfile *profile)
 
void sigRemoveNodeAsync (KisNodeSP node)
 
void sigRequestLodPlanesSyncBlocked (bool value)
 
void sigRequestNodeReselection (KisNodeSP activeNode, const KisNodeList &selectedNodes)
 
void sigResolutionChanged (double xRes, double yRes)
 
void sigSizeChanged (const QPointF &oldStillPoint, const QPointF &newStillPoint)
 

Public Member Functions

void emitAboutToRemoveANode (KisNode *parent, int index)
 
void emitNodeChanged (KisNodeSP node)
 
void emitNodeHasBeenAdded (KisNode *parent, int index, KisNodeAdditionFlags flags)
 
void emitNotification (KisImageSignalType type)
 
void emitNotifications (KisImageSignalVector notifications)
 
void emitNotifyBatchUpdateEnded ()
 
void emitNotifyBatchUpdateStarted ()
 
void emitRequestLodPlanesSyncBlocked (bool value)
 
 KisImageSignalRouter (KisImageWSP image)
 
 ~KisImageSignalRouter () override
 

Private Slots

void slotNotification (KisImageSignalType type)
 

Private Attributes

KisImageWSP m_image
 

Detailed Description

Definition at line 18 of file kis_image_signal_router.h.

Constructor & Destructor Documentation

◆ KisImageSignalRouter()

KisImageSignalRouter::KisImageSignalRouter ( KisImageWSP image)

Color space and profile conversion functions run without strokes, therefore they are executed in GUI hread under the global lock held.

To ensure that the receiver of the signal will not deadlock by barrier-locking the image, we should make these signals queued.

Definition at line 26 of file kis_image_signal_router.cpp.

27 : QObject(image.data()),
28 m_image(image)
29{
32
35 CONNECT_TO_IMAGE(sigSizeChanged(const QPointF&, const QPointF&));
38
40 CONNECT_TO_IMAGE(sigNodeAddedAsync(KisNodeSP, KisNodeAdditionFlags));
43
54}
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint)
void sigRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes)
void slotNotification(KisImageSignalType type)
void sigRemoveNodeAsync(KisNodeSP node)
void sigResolutionChanged(double xRes, double yRes)
void sigNodeChanged(KisNodeSP node)
void sigImageModifiedWithoutUndo()
void sigNotification(KisImageSignalType type)
void sigNodeAddedAsync(KisNodeSP node, KisNodeAdditionFlags flags)
void sigColorSpaceChanged(const KoColorSpace *cs)
void sigProfileChanged(const KoColorProfile *profile)
#define CONNECT_TO_IMAGE_QUEUED(signal)
#define CONNECT_TO_IMAGE(signal)

References connect(), CONNECT_TO_IMAGE, CONNECT_TO_IMAGE_QUEUED, sigColorSpaceChanged(), sigImageModified(), sigImageModifiedWithoutUndo(), sigLayersChangedAsync(), sigNodeAddedAsync(), sigNodeChanged(), sigNotification(), sigProfileChanged(), sigRemoveNodeAsync(), sigRequestNodeReselection(), sigResolutionChanged(), sigSizeChanged(), and slotNotification().

◆ ~KisImageSignalRouter()

KisImageSignalRouter::~KisImageSignalRouter ( )
override

Definition at line 56 of file kis_image_signal_router.cpp.

57{
58}

Member Function Documentation

◆ emitAboutToRemoveANode()

void KisImageSignalRouter::emitAboutToRemoveANode ( KisNode * parent,
int index )

Definition at line 108 of file kis_image_signal_router.cpp.

109{
110 KisNodeSP removedNode = parent->at(index);
111
112 // overlay selection masks reset frames themselves
113 if (!removedNode->inherits("KisSelectionMask")) {
115 if (image) {
116 image->invalidateAllFrames();
117 }
118 }
119
120 Q_EMIT sigRemoveNodeAsync(removedNode);
121}
void invalidateAllFrames() override
Definition kis_image.cc:632
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
ChildIterator< value_type, is_const > parent(const ChildIterator< value_type, is_const > &it)
Definition KisForest.h:327

References KisImage::invalidateAllFrames(), m_image, sigRemoveNodeAsync(), and KisWeakSharedPtr< T >::toStrongRef().

◆ emitImageModifiedNotification

void KisImageSignalRouter::emitImageModifiedNotification ( )
slot

Definition at line 60 of file kis_image_signal_router.cpp.

61{
62 Q_EMIT sigImageModified();
63}

References sigImageModified().

◆ emitNodeChanged()

void KisImageSignalRouter::emitNodeChanged ( KisNodeSP node)

Definition at line 88 of file kis_image_signal_router.cpp.

89{
90 Q_EMIT sigNodeChanged(node);
91}

References sigNodeChanged().

◆ emitNodeHasBeenAdded()

void KisImageSignalRouter::emitNodeHasBeenAdded ( KisNode * parent,
int index,
KisNodeAdditionFlags flags )

Definition at line 93 of file kis_image_signal_router.cpp.

94{
95 KisNodeSP newNode = parent->at(index);
96
97 // overlay selection masks reset frames themselves
98 if (!newNode->inherits("KisSelectionMask")) {
100 if (image) {
101 image->invalidateAllFrames();
102 }
103 }
104
105 Q_EMIT sigNodeAddedAsync(newNode, flags);
106}

References KisImage::invalidateAllFrames(), m_image, sigNodeAddedAsync(), and KisWeakSharedPtr< T >::toStrongRef().

◆ emitNotification()

void KisImageSignalRouter::emitNotification ( KisImageSignalType type)

All the notifications except LayersChangedSignal should go in a queued way. And LayersChangedSignal should be delivered to the recipients in a non-reordered way

Definition at line 72 of file kis_image_signal_router.cpp.

73{
80 if (type.id == LayersChangedSignal ||
82 slotNotification(type);
83 } else {
84 Q_EMIT sigNotification(type);
85 }
86}
@ NodeReselectionRequestSignal
@ LayersChangedSignal
KisImageSignalTypeEnum id

References KisImageSignalType::id, LayersChangedSignal, NodeReselectionRequestSignal, sigNotification(), and slotNotification().

◆ emitNotifications()

void KisImageSignalRouter::emitNotifications ( KisImageSignalVector notifications)

Definition at line 65 of file kis_image_signal_router.cpp.

66{
67 Q_FOREACH (const KisImageSignalType &type, notifications) {
68 emitNotification(type);
69 }
70}
void emitNotification(KisImageSignalType type)

References emitNotification().

◆ emitNotifyBatchUpdateEnded()

void KisImageSignalRouter::emitNotifyBatchUpdateEnded ( )

Definition at line 133 of file kis_image_signal_router.cpp.

134{
136}
void sigNotifyBatchUpdateEnded()

References sigNotifyBatchUpdateEnded().

◆ emitNotifyBatchUpdateStarted()

void KisImageSignalRouter::emitNotifyBatchUpdateStarted ( )

Definition at line 128 of file kis_image_signal_router.cpp.

129{
131}
void sigNotifyBatchUpdateStarted()

References sigNotifyBatchUpdateStarted().

◆ emitRequestLodPlanesSyncBlocked()

void KisImageSignalRouter::emitRequestLodPlanesSyncBlocked ( bool value)

Definition at line 123 of file kis_image_signal_router.cpp.

124{
126}
float value(const T *src, size_t ch)
void sigRequestLodPlanesSyncBlocked(bool value)

References sigRequestLodPlanesSyncBlocked(), and value().

◆ sigColorSpaceChanged

void KisImageSignalRouter::sigColorSpaceChanged ( const KoColorSpace * cs)
signal

◆ sigImageModified

void KisImageSignalRouter::sigImageModified ( )
signal

◆ sigImageModifiedWithoutUndo

void KisImageSignalRouter::sigImageModifiedWithoutUndo ( )
signal

◆ sigLayersChangedAsync

void KisImageSignalRouter::sigLayersChangedAsync ( )
signal

◆ sigNodeAddedAsync

void KisImageSignalRouter::sigNodeAddedAsync ( KisNodeSP node,
KisNodeAdditionFlags flags )
signal

◆ sigNodeChanged

void KisImageSignalRouter::sigNodeChanged ( KisNodeSP node)
signal

◆ sigNotification

void KisImageSignalRouter::sigNotification ( KisImageSignalType type)
signal

◆ sigNotifyBatchUpdateEnded

void KisImageSignalRouter::sigNotifyBatchUpdateEnded ( )
signal

◆ sigNotifyBatchUpdateStarted

void KisImageSignalRouter::sigNotifyBatchUpdateStarted ( )
signal

Emitted whenever the image is going to issue a lot of canvas update signals and it is a good idea to group then and rerender the canvas in one go. The canvas should initiate new rerenders while the batch is in progress.

NOTE: even though the batched updates will not initiate a rerender, it does not guarantee that there will be processed during the batch. The updates may come from other sources, e.g. from mouse moves.

NOTE: this feature is used to avoid flickering when switching back from lodN plane back to lod0. All the texture tiles should be loaded with new information before mipmaps can be regenerated.

◆ sigProfileChanged

void KisImageSignalRouter::sigProfileChanged ( const KoColorProfile * profile)
signal

◆ sigRemoveNodeAsync

void KisImageSignalRouter::sigRemoveNodeAsync ( KisNodeSP node)
signal

◆ sigRequestLodPlanesSyncBlocked

void KisImageSignalRouter::sigRequestLodPlanesSyncBlocked ( bool value)
signal

Emitted whenever the image wants to update Lod0 plane of the canvas. Blocking syncing effectively means that the canvas will not try to read from these planes until the all the data is loaded. Otherwise the user will see weird flickering because of partially loaded lod0 tiles.

NOTE: while the sync is blocked, the canvas is considered to use LodN planes that are expected to contain valid data.

◆ sigRequestNodeReselection

void KisImageSignalRouter::sigRequestNodeReselection ( KisNodeSP activeNode,
const KisNodeList & selectedNodes )
signal

◆ sigResolutionChanged

void KisImageSignalRouter::sigResolutionChanged ( double xRes,
double yRes )
signal

◆ sigSizeChanged

void KisImageSignalRouter::sigSizeChanged ( const QPointF & oldStillPoint,
const QPointF & newStillPoint )
signal

◆ slotNotification

void KisImageSignalRouter::slotNotification ( KisImageSignalType type)
privateslot

Definition at line 138 of file kis_image_signal_router.cpp.

139{
141 if (!image) {
142 return;
143 }
144
145 switch(type.id) {
147 image->invalidateAllFrames();
148 Q_EMIT sigLayersChangedAsync();
149 break;
152 break;
154 image->invalidateAllFrames();
157 break;
159 image->invalidateAllFrames();
160 Q_EMIT sigProfileChanged(image->profile());
161 break;
163 image->invalidateAllFrames();
164 Q_EMIT sigColorSpaceChanged(image->colorSpace());
165 break;
167 image->invalidateAllFrames();
168 Q_EMIT sigResolutionChanged(image->xRes(), image->yRes());
169 break;
172 !type.nodeReselectionSignal.newSelectedNodes.isEmpty()) {
173
176 }
177 break;
178 }
179}
@ ColorSpaceChangedSignal
@ SizeChangedSignal
@ ProfileChangedSignal
@ ModifiedWithoutUndoSignal
@ ResolutionChangedSignal
const KoColorSpace * colorSpace() const
double xRes() const
double yRes() const
const KoColorProfile * profile() const
ComplexSizeChangedSignal sizeChangedSignal
ComplexNodeReselectionSignal nodeReselectionSignal

References KisImage::colorSpace(), ColorSpaceChangedSignal, KisImageSignalType::id, KisImage::invalidateAllFrames(), LayersChangedSignal, m_image, ModifiedWithoutUndoSignal, ComplexNodeReselectionSignal::newActiveNode, ComplexNodeReselectionSignal::newSelectedNodes, ComplexSizeChangedSignal::newStillPoint, NodeReselectionRequestSignal, KisImageSignalType::nodeReselectionSignal, ComplexSizeChangedSignal::oldStillPoint, KisImage::profile(), ProfileChangedSignal, ResolutionChangedSignal, sigColorSpaceChanged(), sigImageModifiedWithoutUndo(), sigLayersChangedAsync(), sigProfileChanged(), sigRequestNodeReselection(), sigResolutionChanged(), sigSizeChanged(), SizeChangedSignal, KisImageSignalType::sizeChangedSignal, KisWeakSharedPtr< T >::toStrongRef(), KisImage::xRes(), and KisImage::yRes().

Member Data Documentation

◆ m_image

KisImageWSP KisImageSignalRouter::m_image
private

Definition at line 95 of file kis_image_signal_router.h.


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