summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorBłażej Szczygieł <spaz16@wp.pl>2016-02-01 11:49:02 +0100
committerBłażej Szczygieł <spaz16@wp.pl>2016-05-19 10:11:27 +0000
commitbc410cc706e107881d3ee982287441993cabb8a6 (patch)
tree76c5724265520128602c20f83c38b5af5270448c /src/widgets
parent640441882d20f86db05ab5fd1141abe39a0bd409 (diff)
QtWidgets: Reduce paint events when resizing native widget
This patch reduces paint events by removing code which sets native widgets dirty in QWidgetWindow::handleExposeEvent. Native widgets are also marked dirty in QWidgetPrivate::drawWidget, so it is enough for proper painting. This restores Qt4 behavior when one resize means one repaint for native widgets. Without this patch the native widget is marked as dirty on every expose event, so one repaint is from syncBackingStore and second (or more) is from marking the widget dirty explicitly. This patch improves performance of native widgets and it also reduces locks when paint event is v-synced, e.g. on OpenGL swap buffers or on any other technology like VDPAU, VA-API, etc. Added autotest for checking number of paint events for native widgets. Task-number: QTBUG-50796 Change-Id: I4e1649069e2e73d15b038fd1834d0551915252ee Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 5290d79d9e..872572a7e2 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -873,14 +873,8 @@ void QWidgetWindow::handleExposeEvent(QExposeEvent *event)
{
if (isExposed()) {
m_widget->setAttribute(Qt::WA_Mapped);
- if (!event->region().isNull()) {
- // Exposed native widgets need to be marked dirty to get them repainted correctly.
- if (m_widget->internalWinId() && !m_widget->isWindow() && m_widget->isVisible() && m_widget->updatesEnabled()) {
- if (QWidgetBackingStore *bs = m_widget->d_func()->maybeBackingStore())
- bs->markDirty(event->region(), m_widget);
- }
+ if (!event->region().isNull())
m_widget->d_func()->syncBackingStore(event->region());
- }
} else {
m_widget->setAttribute(Qt::WA_Mapped, false);
}