Skip to content

Commit

Permalink
Fix wrong grabbing behavior
Browse files Browse the repository at this point in the history
QQuickWidget::grabFrameBuffer() was not polishing its items nor
syncing the scene graph compared to standard QQuickWindow::grabWindow().
This lead to QQuickWidget grabbed content to be outdated (render
the previous frame as a new frame).

Task-number: QTBUG-57596
Change-Id: I94f5e0aa5b096fb9e21259267c0e50473e8ed5bd
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
  • Loading branch information
pasnox committed Dec 20, 2016
1 parent 7b7322c commit 0d243a8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/quick/items/qquickrendercontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ QImage QQuickRenderControl::grab()

if (d->window->rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL) {
#if QT_CONFIG(opengl)
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(d->window);
cd->polishItems();
cd->syncSceneGraph();
render();
grabContent = qt_gl_read_framebuffer(d->window->size() * d->window->effectiveDevicePixelRatio(), false, false);
#endif
Expand All @@ -394,6 +397,8 @@ QImage QQuickRenderControl::grab()
QPaintDevice *prevDev = softwareRenderer->currentPaintDevice();
softwareRenderer->setCurrentPaintDevice(&grabContent);
softwareRenderer->markDirty();
cd->polishItems();
cd->syncSceneGraph();
render();
softwareRenderer->setCurrentPaintDevice(prevDev);
}
Expand Down

0 comments on commit 0d243a8

Please sign in to comment.