File indexing completed on 2024-05-12 15:58:39
0001 /* 0002 * SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kis_recalculate_generator_layer_job.h" 0008 0009 #include "generator/kis_generator_layer.h" 0010 #include "kis_debug.h" 0011 #include "kis_layer.h" 0012 #include "kis_image.h" 0013 0014 0015 KisRecalculateGeneratorLayerJob::KisRecalculateGeneratorLayerJob(KisGeneratorLayerSP layer) 0016 : m_layer(layer) 0017 { 0018 setExclusive(true); 0019 } 0020 0021 bool KisRecalculateGeneratorLayerJob::overrides(const KisSpontaneousJob *_otherJob) 0022 { 0023 const KisRecalculateGeneratorLayerJob *otherJob = 0024 dynamic_cast<const KisRecalculateGeneratorLayerJob*>(_otherJob); 0025 0026 return otherJob && otherJob->m_layer == m_layer; 0027 } 0028 0029 void KisRecalculateGeneratorLayerJob::run() 0030 { 0031 /** 0032 * The layer might have been deleted from the layers stack. In 0033 * such a case, don't try do update it. 0034 */ 0035 if (!m_layer->parent()) return; 0036 0037 m_layer->update(); 0038 } 0039 0040 int KisRecalculateGeneratorLayerJob::levelOfDetail() const 0041 { 0042 return 0; 0043 } 0044 0045 QString KisRecalculateGeneratorLayerJob::debugName() const 0046 { 0047 QString result; 0048 QDebug dbg(&result); 0049 dbg << "KisRecalculateGeneratorLayerJob" << m_layer; 0050 return result; 0051 }