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

#include <kis_update_selection_job.h>

+ Inheritance diagram for KisUpdateSelectionJob:

Public Member Functions

QString debugName () const override
 
 KisUpdateSelectionJob (KisSelectionSP selection, const QRect &updateRect=QRect())
 
int levelOfDetail () const override
 
bool overrides (const KisSpontaneousJob *otherJob) override
 
void run () override
 
- Public Member Functions inherited from KisSpontaneousJob
bool isExclusive () const
 
- Public Member Functions inherited from KisRunnable
virtual ~KisRunnable ()
 

Private Attributes

KisSelectionSP m_selection
 
QRect m_updateRect
 

Additional Inherited Members

- Protected Member Functions inherited from KisSpontaneousJob
void setExclusive (bool value)
 

Detailed Description

Definition at line 13 of file kis_update_selection_job.h.

Constructor & Destructor Documentation

◆ KisUpdateSelectionJob()

KisUpdateSelectionJob::KisUpdateSelectionJob ( KisSelectionSP selection,
const QRect & updateRect = QRect() )

TODO: we should implement correct KisShapeSelectionCanvas for projection. See a comment in KisUpdateSelectionJob::run().

Right now, since this job accesses some projections for write, we should declare it as exclusive

Definition at line 12 of file kis_update_selection_job.cpp.

13 : m_selection(selection),
14 m_updateRect(updateRect)
15{
24 setExclusive(true);
25}
void setExclusive(bool value)

References KisSpontaneousJob::setExclusive().

Member Function Documentation

◆ debugName()

QString KisUpdateSelectionJob::debugName ( ) const
overridevirtual

Implements KisRunnableWithDebugName.

Definition at line 78 of file kis_update_selection_job.cpp.

79{
80 return "KisUpdateSelectionJob";
81}

◆ levelOfDetail()

int KisUpdateSelectionJob::levelOfDetail ( ) const
overridevirtual

Implements KisSpontaneousJob.

Definition at line 73 of file kis_update_selection_job.cpp.

74{
75 return 0;
76}

◆ overrides()

bool KisUpdateSelectionJob::overrides ( const KisSpontaneousJob * otherJob)
overridevirtual

Implements KisSpontaneousJob.

Definition at line 27 of file kis_update_selection_job.cpp.

28{
29 const KisUpdateSelectionJob *otherJob =
30 dynamic_cast<const KisUpdateSelectionJob*>(_otherJob);
31
32 bool retval = false;
33
34 if (otherJob && otherJob->m_selection == m_selection) {
35 if (!m_updateRect.isEmpty()) {
36 m_updateRect |= otherJob->m_updateRect;
37 }
38 retval = true;
39 }
40
41 return retval;
42}

References m_selection, and m_updateRect.

◆ run()

void KisUpdateSelectionJob::run ( )
overridevirtual

TODO: in the future we should remove selection projection calculation from this job and to reuse a fully-featured shape layer canvas from KisShapeLayer. Then projection calculation will be a little bit more efficient.

Implements KisRunnable.

Definition at line 44 of file kis_update_selection_job.cpp.

45{
46 QRect dirtyRect;
47
48 KisNodeSP parentNode = m_selection->parentNode();
49 if (parentNode) {
50 dirtyRect = parentNode->extent();
51 }
52
53 if (!m_updateRect.isEmpty()) {
55 } else {
57 }
58
60
67 if (parentNode && parentNode->projectionLeaf()->isOverlayProjectionLeaf()) {
68 dirtyRect |= parentNode->extent();
69 parentNode->setDirty(dirtyRect);
70 }
71}
virtual QRect extent() const
KisProjectionLeafSP projectionLeaf
Definition kis_node.cpp:93
virtual void setDirty()
Definition kis_node.cpp:577
void updateProjection(const QRect &rect)
void notifySelectionChanged()
KisNodeWSP parentNode

References KisBaseNode::extent(), m_selection, m_updateRect, KisSelection::notifySelectionChanged(), KisSelection::parentNode, KisNode::projectionLeaf, KisNode::setDirty(), and KisSelection::updateProjection().

Member Data Documentation

◆ m_selection

KisSelectionSP KisUpdateSelectionJob::m_selection
private

Definition at line 24 of file kis_update_selection_job.h.

◆ m_updateRect

QRect KisUpdateSelectionJob::m_updateRect
private

Definition at line 25 of file kis_update_selection_job.h.


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