Defer Q(OpenGL|Raster)Window updates when non-exposed
This is similar to how widgets work. On platforms like OS X this becomes essential since in non-exposed state SwapBuffers does not block so continuing to update continuously leads to undesirable effects. Task-number: QTBUG-45524 Change-Id: I80f4c00b218561b9e62c3cad1e66f61f4debd4af Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
This commit is contained in:
parent
666486b3ef
commit
472216da2d
@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
\note Subsequent calls to this function before the next paint
|
||||
event will get ignored.
|
||||
|
||||
\note For non-exposed windows the update is deferred until the
|
||||
window becomes exposed again.
|
||||
*/
|
||||
void QPaintDeviceWindow::update()
|
||||
{
|
||||
@ -70,12 +73,16 @@ void QPaintDeviceWindow::update()
|
||||
Marks the \a rect of the window as dirty and schedules a repaint.
|
||||
|
||||
\note Subsequent calls to this function before the next paint
|
||||
event will get ignored.
|
||||
event will get ignored, but \a rect is added to the region to update.
|
||||
|
||||
\note For non-exposed windows the update is deferred until the
|
||||
window becomes exposed again.
|
||||
*/
|
||||
void QPaintDeviceWindow::update(const QRect &rect)
|
||||
{
|
||||
Q_D(QPaintDeviceWindow);
|
||||
d->dirtyRegion += rect;
|
||||
if (isExposed())
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
@ -83,12 +90,16 @@ void QPaintDeviceWindow::update(const QRect &rect)
|
||||
Marks the \a region of the window as dirty and schedules a repaint.
|
||||
|
||||
\note Subsequent calls to this function before the next paint
|
||||
event will get ignored.
|
||||
event will get ignored, but \a region is added to the region to update.
|
||||
|
||||
\note For non-exposed windows the update is deferred until the
|
||||
window becomes exposed again.
|
||||
*/
|
||||
void QPaintDeviceWindow::update(const QRegion ®ion)
|
||||
{
|
||||
Q_D(QPaintDeviceWindow);
|
||||
d->dirtyRegion += region;
|
||||
if (isExposed())
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
@ -168,6 +179,9 @@ void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
|
||||
// sometimes relative to the parent, depending on the platform plugin.
|
||||
// We require local coords here.
|
||||
d->doFlush(QRect(QPoint(0, 0), size()));
|
||||
} else if (!d->dirtyRegion.isEmpty()) {
|
||||
// Updates while non-exposed were ignored. Schedule an update now.
|
||||
requestUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user