File indexing completed on 2024-05-12 15:58:52

0001 /*
0002  *  SPDX-FileCopyrightText: 2019 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 #include "KisRecycleProjectionsJob.h"
0007 #include "KisSafeNodeProjectionStore.h"
0008 #include "kis_paint_device.h"
0009 
0010 KisRecycleProjectionsJob::KisRecycleProjectionsJob(KisSafeNodeProjectionStoreBaseWSP projectionStore)
0011     : m_projectionStore(projectionStore)
0012 {
0013     setExclusive(true);
0014 }
0015 
0016 bool KisRecycleProjectionsJob::overrides(const KisSpontaneousJob *_otherJob)
0017 {
0018     const KisRecycleProjectionsJob *otherJob =
0019         dynamic_cast<const KisRecycleProjectionsJob*>(_otherJob);
0020 
0021     return otherJob &&
0022         otherJob->m_projectionStore == m_projectionStore;
0023 }
0024 
0025 void KisRecycleProjectionsJob::run()
0026 {
0027     KisSafeNodeProjectionStoreBaseSP store = m_projectionStore;
0028     if (store) {
0029         store->recycleProjectionsInSafety();
0030     }
0031 }
0032 
0033 int KisRecycleProjectionsJob::levelOfDetail() const
0034 {
0035     return 0;
0036 }
0037 
0038 QString KisRecycleProjectionsJob::debugName() const
0039 {
0040     return "KisRecycleProjectionsJob";
0041 }