diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-02-11 14:59:30 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-13 20:54:01 +0100 |
commit | ff11af4fbc2948a3a3bc635549c7ac349d249abc (patch) | |
tree | 79d6544923010bb740913842c550a010c6ae6922 /src/widgets/kernel | |
parent | 5b422304a9b97b628dc9990fd67e2f293d535b41 (diff) |
QOpenGLWidget and new-style compositing on eglfs
Integrate with QOpenGLTextureBlitter, QOpenGLWidget and friends.
Change-Id: Ic2867b713a21a3d2820d546174fc9164b3dd220c
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore.cpp | 35 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetbackingstore_p.h | 20 |
2 files changed, 53 insertions, 2 deletions
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index c8d5440999..dc918657b4 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -736,7 +736,8 @@ QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) dirtyOnScreenWidgets(0), widgetTextures(0), fullUpdatePending(0), - updateRequestSent(0) + updateRequestSent(0), + textureListWatcher(0) { store = tlw->backingStore(); Q_ASSERT(store); @@ -962,6 +963,25 @@ static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatfo } #endif +QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetBackingStore *backingStore) + : m_locked(false), + m_backingStore(backingStore) +{ +} + +void QPlatformTextureListWatcher::watch(QPlatformTextureList *textureList) +{ + connect(textureList, SIGNAL(locked(bool)), SLOT(onLockStatusChanged(bool))); + m_locked = textureList->isLocked(); +} + +void QPlatformTextureListWatcher::onLockStatusChanged(bool locked) +{ + m_locked = locked; + if (!locked) + m_backingStore->sync(); +} + /*! Synchronizes the backing store, i.e. dirty areas are repainted and flushed. */ @@ -985,6 +1005,17 @@ void QWidgetBackingStore::sync() return; } + if (textureListWatcher && !textureListWatcher->isLocked()) { + textureListWatcher->deleteLater(); + textureListWatcher = 0; + } else if (widgetTextures && widgetTextures->isLocked()) { + if (!textureListWatcher) + textureListWatcher = new QPlatformTextureListWatcher(this); + if (!textureListWatcher->isLocked()) + textureListWatcher->watch(widgetTextures); + return; + } + doSync(); } @@ -1077,7 +1108,7 @@ void QWidgetBackingStore::doSync() delete widgetTextures; widgetTextures = 0; if (tlw->d_func()->textureChildSeen) { - widgetTextures = new QPlatformTextureList; // TODO: implement support for locking + widgetTextures = new QPlatformTextureList; findTextureWidgetsRecursively(tlw, tlw, widgetTextures); } fullUpdatePending = false; diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index c6f6541e1f..2fe58fa4a7 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE class QPlatformTextureList; +class QWidgetBackingStore; struct BeginPaintInfo { inline BeginPaintInfo() : wasFlushed(0), nothingToPaint(0), backingStoreRecreated(0) {} @@ -69,6 +70,23 @@ struct BeginPaintInfo { uint backingStoreRecreated : 1; }; +class QPlatformTextureListWatcher : public QObject +{ + Q_OBJECT + +public: + QPlatformTextureListWatcher(QWidgetBackingStore *backingStore); + void watch(QPlatformTextureList *textureList); + bool isLocked() const { return m_locked; } + +private slots: + void onLockStatusChanged(bool locked); + +private: + bool m_locked; + QWidgetBackingStore *m_backingStore; +}; + class Q_AUTOTEST_EXPORT QWidgetBackingStore { public: @@ -111,6 +129,8 @@ private: QPoint tlwOffset; + QPlatformTextureListWatcher *textureListWatcher; + void sendUpdateRequest(QWidget *widget, bool updateImmediately); static bool flushPaint(QWidget *widget, const QRegion &rgn); |