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

#include <kis_refresh_subtree_walker.h>

+ Inheritance diagram for KisRefreshSubtreeWalker:

Public Types

enum  Flag {
  None = 0x0 , SkipNonRenderableNodes = 0x1 , NoFilthyMode = 0x2 , DontAdjustChangeRect = 0x4 ,
  ClonesDontInvalidateFrames = 0x8
}
 
- Public Types inherited from KisBaseRectsWalker
typedef QVector< CloneNotificationCloneNotificationsVector
 
typedef QStack< JobItemLeafStack
 
typedef qint32 NodePosition
 
enum  NodePositionValues {
  N_NORMAL = 0x00 , N_TOPMOST = 0x01 , N_BOTTOMMOST = 0x02 , N_EXTRA = 0x04 ,
  N_ABOVE_FILTHY = 0x08 , N_FILTHY_ORIGINAL = 0x10 , N_FILTHY_PROJECTION = 0x20 , N_FILTHY = 0x40 ,
  N_BELOW_FILTHY = 0x80
}
 
enum  SubtreeVisitFlag { None = 0x0 , SkipNonRenderableNodes = 0x1 , NoFilthyMode = 0x2 , DontNotifyClones = 0x4 }
 
enum  UpdateType {
  UPDATE , UPDATE_NO_FILTHY , FULL_REFRESH , FULL_REFRESH_NO_FILTHY ,
  UNSUPPORTED
}
 

Public Member Functions

Flags flags () const
 
 KisRefreshSubtreeWalker (QRect cropRect, Flags flags=None)
 
 Q_DECLARE_FLAGS (Flags, Flag)
 
UpdateType type () const override
 
 ~KisRefreshSubtreeWalker () override
 
- Public Member Functions inherited from KisBaseRectsWalker
QRect accessRect () const
 
QRect changeRect () const
 
bool changeRectVaries () const
 
bool checksumValid ()
 
CloneNotificationsVectorcloneNotifications ()
 
bool clonesDontInvalidateFrames () const
 
void collectRects (KisNodeSP node, const QRect &requestedRect)
 
QRect cropRect () const
 
 KisBaseRectsWalker ()
 
LeafStackleafStack ()
 
int levelOfDetail () const
 
bool needRectVaries () const
 
 Q_DECLARE_FLAGS (SubtreeVisitFlags, SubtreeVisitFlag)
 
void recalculate (const QRect &requestedRect)
 
QRect requestedRect () const
 
void setClonesDontInvalidateFrames (bool value)
 
void setCropRect (QRect cropRect)
 
KisNodeSP startNode () const
 
QRect uncroppedChangeRect () const
 
virtual ~KisBaseRectsWalker ()
 
- Public Member Functions inherited from KisShared
bool deref ()
 
bool ref ()
 
int refCount ()
 
QAtomicInt * sharedWeakReference ()
 

Protected Member Functions

 KisRefreshSubtreeWalker ()
 
void startTrip (KisProjectionLeafSP startWith) override
 
- Protected Member Functions inherited from KisBaseRectsWalker
void addCloneSourceRegenerationJobs ()
 
virtual void adjustMasksChangeRect (KisProjectionLeafSP firstMask)
 
void clear ()
 
QRect cropThisRect (const QRect &rect, const QRect &cropRect)
 
bool isStartLeaf (KisProjectionLeafSP leaf) const
 
void pushJob (KisProjectionLeafSP leaf, NodePosition position, QRect applyRect, KisRenderPassFlags flags)
 
virtual void registerChangeRect (KisProjectionLeafSP leaf, NodePosition position)
 
void registerCloneNotification (KisNodeSP node, NodePosition position)
 
void registerNeedRect (KisProjectionLeafSP leaf, NodePosition position, KisRenderPassFlags flags)
 
virtual void registerNeedRect (KisProjectionLeafSP leaf, NodePosition position, KisRenderPassFlags flags, const QRect &cropRect)
 
void setExplicitChangeRect (const QRect &changeRect, bool changeRectVaries)
 
void visitSubtreeTopToBottom (KisProjectionLeafSP startWith, SubtreeVisitFlags flags, KisRenderPassFlags renderFlags, const QRect &cropRect)
 
- Protected Member Functions inherited from KisShared
 KisShared ()
 
 ~KisShared ()
 

Static Protected Member Functions

static std::pair< QRect, bool > calculateChangeRect (KisProjectionLeafSP startWith, const QRect &requestedRect)
 
- Static Protected Member Functions inherited from KisBaseRectsWalker
static qint32 calculateChecksum (KisProjectionLeafSP leaf, const QRect &requestedRect)
 
static NodePosition calculateNodePosition (KisProjectionLeafSP leaf)
 
static qint32 getGraphPosition (qint32 position)
 
static bool hasClones (KisNodeSP node)
 

Private Attributes

Flags m_flags = None
 

Additional Inherited Members

- Static Public Member Functions inherited from KisBaseRectsWalker
static KisNode::PositionToFilthy convertPositionToFilthy (NodePosition position)
 

Detailed Description

Definition at line 14 of file kis_refresh_subtree_walker.h.

Member Enumeration Documentation

◆ Flag

Enumerator
None 
SkipNonRenderableNodes 
NoFilthyMode 
DontAdjustChangeRect 
ClonesDontInvalidateFrames 

Definition at line 17 of file kis_refresh_subtree_walker.h.

Constructor & Destructor Documentation

◆ KisRefreshSubtreeWalker() [1/2]

KisRefreshSubtreeWalker::KisRefreshSubtreeWalker ( QRect cropRect,
Flags flags = None )
inline

◆ ~KisRefreshSubtreeWalker()

KisRefreshSubtreeWalker::~KisRefreshSubtreeWalker ( )
inlineoverride

Definition at line 39 of file kis_refresh_subtree_walker.h.

40 {
41 }

◆ KisRefreshSubtreeWalker() [2/2]

KisRefreshSubtreeWalker::KisRefreshSubtreeWalker ( )
inlineprotected

Definition at line 48 of file kis_refresh_subtree_walker.h.

48{}

Member Function Documentation

◆ calculateChangeRect()

static std::pair< QRect, bool > KisRefreshSubtreeWalker::calculateChangeRect ( KisProjectionLeafSP startWith,
const QRect & requestedRect )
inlinestaticprotected

Definition at line 53 of file kis_refresh_subtree_walker.h.

54 {
55
56 if(!startWith->isLayer())
57 return std::make_pair(requestedRect, false);
58
59 QRect finalChangeRect = requestedRect;
60 bool changeRectVaries = false;
61
62 KisProjectionLeafSP currentLeaf = startWith->firstChild();
63
64 while (currentLeaf) {
65 if (currentLeaf->isLayer() && currentLeaf->shouldBeRendered()) {
66 QRect leafRect;
67
68 std::tie(leafRect, changeRectVaries) =
70
71 finalChangeRect |= leafRect;
72 }
73
74 currentLeaf = currentLeaf->nextSibling();
75 }
76
77 finalChangeRect |= startWith->projectionPlane()->changeRect(finalChangeRect);
78
79 if (!changeRectVaries) {
80 changeRectVaries = finalChangeRect != requestedRect;
81 }
82
83 return std::make_pair(finalChangeRect, changeRectVaries);
84 }
static std::pair< QRect, bool > calculateChangeRect(KisProjectionLeafSP startWith, const QRect &requestedRect)

References KisBaseRectsWalker::requestedRect().

◆ flags()

Flags KisRefreshSubtreeWalker::flags ( ) const
inline

Definition at line 43 of file kis_refresh_subtree_walker.h.

43 {
44 return m_flags;
45 }

◆ Q_DECLARE_FLAGS()

KisRefreshSubtreeWalker::Q_DECLARE_FLAGS ( Flags ,
Flag  )

◆ startTrip()

void KisRefreshSubtreeWalker::startTrip ( KisProjectionLeafSP startWith)
inlineoverrideprotectedvirtual

Initiates collecting of rects. Should be implemented in derived classes

When the mask is the root of the update, update its parent projection using N_EXTRA method.

This special update is necessary because the following wolker will work in N_ABOVE_FILTHY mode only

Sometimes it may happen that the mask is placed outside layers hierarchy (e.g. inactive selection mask), then the projection leafs will not point to anywhere

In normal walkers we register notifications in the change-rect pass to avoid regeneration of the nodes that are below filthy. In the subtree walker there is no change-rect pass and all the nodes are considered as filthy, so we should do that explicitly.

Implements KisBaseRectsWalker.

Definition at line 86 of file kis_refresh_subtree_walker.h.

86 {
87 if (!m_flags.testFlag(DontAdjustChangeRect)) {
89 }
90
91 if (isStartLeaf(startWith)) {
92 KisProjectionLeafSP extraUpdateLeaf = startWith;
93
94 if (startWith->isMask()) {
103 extraUpdateLeaf = startWith->parent();
104 }
105
111 if (extraUpdateLeaf) {
112 NodePosition pos = N_EXTRA | calculateNodePosition(extraUpdateLeaf);
113 registerNeedRect(extraUpdateLeaf, pos, KisRenderPassFlag::None);
114
123 registerCloneNotification(extraUpdateLeaf->node(), pos);
124 }
125 }
126
127 SubtreeVisitFlags subtreeFlags = SubtreeVisitFlag::None;
130 }
131 if (m_flags & NoFilthyMode) {
132 subtreeFlags |= SubtreeVisitFlag::NoFilthyMode;
133 }
134
135 visitSubtreeTopToBottom(startWith, subtreeFlags, KisRenderPassFlag::None, cropRect());
136 }
static NodePosition calculateNodePosition(KisProjectionLeafSP leaf)
void registerCloneNotification(KisNodeSP node, NodePosition position)
bool isStartLeaf(KisProjectionLeafSP leaf) const
void visitSubtreeTopToBottom(KisProjectionLeafSP startWith, SubtreeVisitFlags flags, KisRenderPassFlags renderFlags, const QRect &cropRect)
void setExplicitChangeRect(const QRect &changeRect, bool changeRectVaries)
void registerNeedRect(KisProjectionLeafSP leaf, NodePosition position, KisRenderPassFlags flags)

References KisBaseRectsWalker::calculateNodePosition(), KisBaseRectsWalker::cropRect(), KisBaseRectsWalker::isStartLeaf(), KisBaseRectsWalker::NoFilthyMode, KisBaseRectsWalker::None, None, KisBaseRectsWalker::registerCloneNotification(), KisBaseRectsWalker::registerNeedRect(), KisBaseRectsWalker::requestedRect(), KisBaseRectsWalker::setExplicitChangeRect(), KisBaseRectsWalker::SkipNonRenderableNodes, and KisBaseRectsWalker::visitSubtreeTopToBottom().

◆ type()

UpdateType KisRefreshSubtreeWalker::type ( ) const
inlineoverridevirtual

Implements KisBaseRectsWalker.

Definition at line 35 of file kis_refresh_subtree_walker.h.

35 {
36 return UNSUPPORTED;
37 }

References KisBaseRectsWalker::UNSUPPORTED.

Member Data Documentation

◆ m_flags

Flags KisRefreshSubtreeWalker::m_flags = None
private

Definition at line 139 of file kis_refresh_subtree_walker.h.


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