Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/tool/KisStabilizerDelayedPaintHelper.h
| Context not available. | |||||
| 19 | #ifndef KIS_STABILIZER_DELAYED_PAINT_HELPER_H | 19 | #ifndef KIS_STABILIZER_DELAYED_PAINT_HELPER_H | ||
|---|---|---|---|---|---|
| 20 | #define KIS_STABILIZER_DELAYED_PAINT_HELPER_H | 20 | #define KIS_STABILIZER_DELAYED_PAINT_HELPER_H | ||
| 21 | 21 | | |||
| 22 | #include <QBasicTimer> | ||||
| 22 | #include <QElapsedTimer> | 23 | #include <QElapsedTimer> | ||
| 23 | #include <QQueue> | 24 | #include <QQueue> | ||
| 24 | #include <QTimer> | | |||
| 25 | #include <QVector> | 25 | #include <QVector> | ||
| 26 | 26 | | |||
| 27 | #include <functional> | 27 | #include <functional> | ||
| Context not available. | |||||
| 40 | TimedPaintInfo(int elapsedTime, KisPaintInformation paintInfo); | 40 | TimedPaintInfo(int elapsedTime, KisPaintInformation paintInfo); | ||
| 41 | }; | 41 | }; | ||
| 42 | 42 | | |||
| 43 | QTimer m_paintTimer; | 43 | QBasicTimer m_paintTimer; | ||
| 44 | QQueue<TimedPaintInfo> m_paintQueue; | 44 | QQueue<TimedPaintInfo> m_paintQueue; | ||
| 45 | int m_lastPendingTime; | 45 | int m_lastPendingTime; | ||
| 46 | int m_paintInterval; | ||||
| 46 | QElapsedTimer m_elapsedTimer; | 47 | QElapsedTimer m_elapsedTimer; | ||
| 47 | 48 | | |||
| 48 | // Callbacks | 49 | // Callbacks | ||
| 49 | std::function<void(const KisPaintInformation &, const KisPaintInformation &)> m_paintLine; | 50 | std::function<void(const KisPaintInformation &, const KisPaintInformation &)> m_paintLine; | ||
| 50 | std::function<void()> m_requestUpdateOutline; | | |||
| 51 | 51 | | |||
| 52 | public: | 52 | public: | ||
| 53 | KisStabilizerDelayedPaintHelper(); | 53 | KisStabilizerDelayedPaintHelper(); | ||
| Context not available. | |||||
| 70 | m_paintLine = paintLine; | 70 | m_paintLine = paintLine; | ||
| 71 | } | 71 | } | ||
| 72 | 72 | | |||
| 73 | void setUpdateOutlineCallback(std::function<void()> requestUpdateOutline) { | | |||
| 74 | m_requestUpdateOutline = requestUpdateOutline; | | |||
| 75 | } | | |||
| 76 | | ||||
| 77 | void start(int paintInterval, const KisPaintInformation &firstPaintInfo); | 73 | void start(int paintInterval, const KisPaintInformation &firstPaintInfo); | ||
| 78 | void update(const QVector<KisPaintInformation> &newPaintInfos); | 74 | void update(const QVector<KisPaintInformation> &newPaintInfos); | ||
| 75 | void paintSome(); | ||||
| 79 | void end(); | 76 | void end(); | ||
| 80 | void cancel(); | 77 | void cancel(); | ||
| 81 | 78 | | |||
| 82 | private Q_SLOTS: | 79 | protected: | ||
| 83 | void stabilizerDelayedPaint(bool isEndStroke = false); | 80 | virtual void timerEvent(QTimerEvent *event) override; | ||
| 84 | }; | 81 | }; | ||
| 85 | 82 | | |||
| 86 | #endif // KIS_STABILIZER_DELAYED_PAINT_HELPER_H | 83 | #endif // KIS_STABILIZER_DELAYED_PAINT_HELPER_H | ||
| Context not available. | |||||