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

0001 /*
0002  *  SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "KisFakeRunnableStrokeJobsExecutor.h"
0008 
0009 #include <KisRunnableStrokeJobData.h>
0010 #include <kis_assert.h>
0011 
0012 #include <QVector>
0013 
0014 KisFakeRunnableStrokeJobsExecutor::KisFakeRunnableStrokeJobsExecutor()
0015     : m_flags(None)
0016 {
0017 }
0018 
0019 KisFakeRunnableStrokeJobsExecutor::KisFakeRunnableStrokeJobsExecutor(Flags flags)
0020     : m_flags(flags)
0021 {
0022 }
0023 
0024 void KisFakeRunnableStrokeJobsExecutor::addRunnableJobs(const QVector<KisRunnableStrokeJobDataBase *> &list)
0025 {
0026     Q_FOREACH (KisRunnableStrokeJobDataBase *data, list) {
0027         KIS_SAFE_ASSERT_RECOVER_NOOP(m_flags.testFlag(AllowBarrierJobs) ||
0028                                      data->sequentiality() != KisStrokeJobData::BARRIER && "barrier jobs are not supported on the fake executor");
0029         KIS_SAFE_ASSERT_RECOVER_NOOP(data->exclusivity() != KisStrokeJobData::EXCLUSIVE && "exclusive jobs are not supported on the fake executor");
0030 
0031         data->run();
0032     }
0033 
0034     qDeleteAll(list);
0035 }