summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-08-21 15:42:40 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-08-25 23:13:43 +0200
commit5bcfe771a5ce53f9cf88340effe3559a5c6d7c66 (patch)
tree437c6d1ff3eefbda43e197d54832a3609581afba /src/widgets/kernel
parent6a859f8112e33c1373b6b6899475ee79b3ba3137 (diff)
widgets: Merge QPlatformTextureListWatcher into implementation file
Change-Id: Icf177a5b559bd1c108a66ee14a51fb23cd36e083 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager.cpp73
-rw-r--r--src/widgets/kernel/qwidgetrepaintmanager_p.h19
2 files changed, 39 insertions, 53 deletions
diff --git a/src/widgets/kernel/qwidgetrepaintmanager.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp
index b70ce39159..3e988cff00 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager.cpp
+++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp
@@ -69,6 +69,44 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_OPENGL
Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList)
+
+// Watches one or more QPlatformTextureLists for changes in the lock state and
+// triggers a backingstore sync when all the registered lists turn into
+// unlocked state. This is essential when a custom composeAndFlush()
+// implementation in a platform plugin is not synchronous and keeps
+// holding on to the textures for some time even after returning from there.
+class QPlatformTextureListWatcher : public QObject
+{
+ Q_OBJECT
+public:
+ QPlatformTextureListWatcher(QWidgetRepaintManager *repaintManager)
+ : m_repaintManager(repaintManager) {}
+
+ void watch(QPlatformTextureList *textureList) {
+ connect(textureList, SIGNAL(locked(bool)), SLOT(onLockStatusChanged(bool)));
+ m_locked[textureList] = textureList->isLocked();
+ }
+
+ bool isLocked() const {
+ foreach (bool v, m_locked) {
+ if (v)
+ return true;
+ }
+ return false;
+ }
+
+private slots:
+ void onLockStatusChanged(bool locked) {
+ QPlatformTextureList *tl = static_cast<QPlatformTextureList *>(sender());
+ m_locked[tl] = locked;
+ if (!isLocked())
+ m_repaintManager->sync();
+ }
+
+private:
+ QHash<QPlatformTextureList *, bool> m_locked;
+ QWidgetRepaintManager *m_repaintManager;
+};
#endif
// ---------------------------------------------------------------------------
@@ -656,39 +694,6 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
return 0;
}
-// Watches one or more QPlatformTextureLists for changes in the lock state and
-// triggers a backingstore sync when all the registered lists turn into
-// unlocked state. This is essential when a custom composeAndFlush()
-// implementation in a platform plugin is not synchronous and keeps
-// holding on to the textures for some time even after returning from there.
-QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetRepaintManager *paintManager)
- : m_repaintManager(paintManager)
-{
-}
-
-void QPlatformTextureListWatcher::watch(QPlatformTextureList *textureList)
-{
- connect(textureList, SIGNAL(locked(bool)), SLOT(onLockStatusChanged(bool)));
- m_locked[textureList] = textureList->isLocked();
-}
-
-bool QPlatformTextureListWatcher::isLocked() const
-{
- foreach (bool v, m_locked) {
- if (v)
- return true;
- }
- return false;
-}
-
-void QPlatformTextureListWatcher::onLockStatusChanged(bool locked)
-{
- QPlatformTextureList *tl = static_cast<QPlatformTextureList *>(sender());
- m_locked[tl] = locked;
- if (!isLocked())
- m_repaintManager->sync();
-}
-
#else
static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget)
@@ -1445,4 +1450,4 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c
QT_END_NAMESPACE
-#include "moc_qwidgetrepaintmanager_p.cpp"
+#include "qwidgetrepaintmanager.moc"
diff --git a/src/widgets/kernel/qwidgetrepaintmanager_p.h b/src/widgets/kernel/qwidgetrepaintmanager_p.h
index 5686457dfb..0a137c3c49 100644
--- a/src/widgets/kernel/qwidgetrepaintmanager_p.h
+++ b/src/widgets/kernel/qwidgetrepaintmanager_p.h
@@ -63,25 +63,6 @@ class QPlatformTextureList;
class QPlatformTextureListWatcher;
class QWidgetRepaintManager;
-#ifndef QT_NO_OPENGL
-class QPlatformTextureListWatcher : public QObject
-{
- Q_OBJECT
-
-public:
- QPlatformTextureListWatcher(QWidgetRepaintManager *repaintManager);
- void watch(QPlatformTextureList *textureList);
- bool isLocked() const;
-
-private slots:
- void onLockStatusChanged(bool locked);
-
-private:
- QHash<QPlatformTextureList *, bool> m_locked;
- QWidgetRepaintManager *m_repaintManager;
-};
-#endif
-
class Q_AUTOTEST_EXPORT QWidgetRepaintManager
{
public: