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

0001 /*
0002  *  SPDX-FileCopyrightText: 2018 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISSELECTIONUPDATECOMPRESSOR_H
0008 #define KISSELECTIONUPDATECOMPRESSOR_H
0009 
0010 #include "kritaimage_export.h"
0011 #include "kis_thread_safe_signal_compressor.h"
0012 
0013 #include "kis_types.h"
0014 #include <QRect>
0015 
0016 
0017 class KisSelectionUpdateCompressor : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     KisSelectionUpdateCompressor(KisSelection *selection);
0022     ~KisSelectionUpdateCompressor();
0023 
0024 public Q_SLOTS:
0025     void requestUpdate(const QRect &updateRect);
0026     void tryProcessStalledUpdate();
0027 
0028 private Q_SLOTS:
0029     void startUpdateJob();
0030 
0031 private:
0032     KisSelection *m_parentSelection {0};
0033     KisThreadSafeSignalCompressor *m_updateSignalCompressor {0};
0034     QRect m_updateRect;
0035     bool m_fullUpdateRequested {false};
0036 
0037     bool m_hasStalledUpdate {false};
0038 };
0039 
0040 #endif // KISSELECTIONUPDATECOMPRESSOR_H