From 0febd75d5242653be3202ea0e46ed6107e4333bd Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Thu, 20 Feb 2014 14:54:35 +0100 Subject: QWidget: do not allocate a QOpenGLContext unless needed by QQuickWidget Task-number: QTBUG-36871 Change-Id: I739f270e9344f888593e04c6221807dbcf6cb55e Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qwidgetbackingstore.cpp | 16 +++++++--------- src/widgets/kernel/qwidgetbackingstore_p.h | 3 +++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp index dc918657b4..6cfe6a6b35 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetbackingstore.cpp @@ -73,16 +73,14 @@ extern QRegion qt_dirtyRegion(QWidget *); * \a tlwOffset is the position of the top level widget relative to the window surface. * \a region is the region to be updated in \a widget coordinates. */ -static inline void qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, - QWidget *tlw, const QPoint &tlwOffset, QPlatformTextureList *widgetTextures = 0, - QOpenGLContext *context = 0) +void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, + QWidget *tlw, const QPoint &tlwOffset, QPlatformTextureList *widgetTextures) { #ifdef QT_NO_OPENGL Q_UNUSED(widgetTextures); - Q_UNUSED(context); #endif Q_ASSERT(widget); - Q_ASSERT(!region.isEmpty() || (context && widgetTextures && widgetTextures->count())); + Q_ASSERT(!region.isEmpty() || (widgetTextures && widgetTextures->count())); Q_ASSERT(backingStore); Q_ASSERT(tlw); @@ -117,7 +115,7 @@ static inline void qt_flush(QWidget *widget, const QRegion ®ion, QBackingStor #ifndef QT_NO_OPENGL if (widgetTextures) - backingStore->handle()->composeAndFlush(widget->windowHandle(), region, offset, widgetTextures, context); + backingStore->handle()->composeAndFlush(widget->windowHandle(), region, offset, widgetTextures, tlw->d_func()->shareContext()); else #endif backingStore->flush(region, widget->windowHandle(), offset); @@ -936,7 +934,7 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg // Nothing to repaint. if (!isDirty()) { - qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset, widgetTextures, tlw->d_func()->shareContext()); + qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset, widgetTextures); return; } @@ -1190,7 +1188,7 @@ void QWidgetBackingStore::flush(QWidget *widget) { if (!dirtyOnScreen.isEmpty()) { QWidget *target = widget ? widget : tlw; - qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTextures, tlw->d_func()->shareContext()); + qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTextures); dirtyOnScreen = QRegion(); } @@ -1198,7 +1196,7 @@ void QWidgetBackingStore::flush(QWidget *widget) #ifndef QT_NO_OPENGL if (widgetTextures && widgetTextures->count()) { QWidget *target = widget ? widget : tlw; - qt_flush(target, QRegion(), store, tlw, tlwOffset, widgetTextures, tlw->d_func()->shareContext()); + qt_flush(target, QRegion(), store, tlw, tlwOffset, widgetTextures); } #endif return; diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h index 2fe58fa4a7..9c8ed3d5ca 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetbackingstore_p.h @@ -135,6 +135,9 @@ private: static bool flushPaint(QWidget *widget, const QRegion &rgn); static void unflushPaint(QWidget *widget, const QRegion &rgn); + static void qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, + QWidget *tlw, const QPoint &tlwOffset, + QPlatformTextureList *widgetTextures = 0); void doSync(); bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget); -- cgit v1.2.3