summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Freling <fabien.freling@nokia.com>2011-05-18 14:17:17 (GMT)
committerFabien Freling <fabien.freling@nokia.com>2011-05-18 14:33:26 (GMT)
commit44e1526ee2585c0402c284aa94eb2472fa4a4145 (patch)
tree7967d6012eca9579a574660b2d407ab73770e429
parent0aa9b30432cec3b7f366983f451fc9a7f8f83243 (diff)
downloadQt-44e1526ee2585c0402c284aa94eb2472fa4a4145.zip
Qt-44e1526ee2585c0402c284aa94eb2472fa4a4145.tar.gz
Qt-44e1526ee2585c0402c284aa94eb2472fa4a4145.tar.bz2
Change the flushing of the CGContext to a synchronization.
When many NSView are being drawn, calling CGContextFlush() is too expensive and some flickering becomes apparent. We now call CGContextSynchronize() instead. Since this solves the flickering problem, we can now call setNeedsDisplay: for items in the unified toolbar. This allows us to smootly trigger many flushings inside the unified toolbar. Task-number: QTBUG-19267 Reviewed-by: Jiang Jiang
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm2
-rw-r--r--src/gui/painting/qunifiedtoolbarsurface_mac.cpp6
2 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index b5e5d18..578970c 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -320,7 +320,7 @@ static int qCocoaViewCount = 0;
}
- CGContextFlush(context);
+ CGContextSynchronize(context);
qt_mac_release_graphics_context(context);
return;
}
diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
index 2fda6b9..94a7417 100644
--- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
+++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp
@@ -171,10 +171,8 @@ void QUnifiedToolbarSurface::flush(QWidget *widget)
if (!d->image)
return;
- if (widget->d_func()->flushRequested) {
- // We call display: directly to avoid flickering in the toolbar.
- qt_mac_display(widget);
- }
+ if (widget->d_func()->flushRequested)
+ qt_mac_setNeedsDisplay(widget);
}
void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget)