aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/adaptations
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@qt.io>2016-04-26 11:49:52 +0200
committerAndy Nichols <andy.nichols@qt.io>2016-05-06 19:17:28 +0000
commit928915cabe4b8efacf9766962b60f895f51b6b98 (patch)
tree708242f045390621702d3c94251cfdea7ab36ab7 /src/quick/scenegraph/adaptations
parent11e788c9a555694f3ec5c4839eb98c4048801bf2 (diff)
Fix some test failures with QT_NO_OPENGL builds
Change-Id: I4154084b4a0e0709ee8cb39a856a37a611e2d537 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Diffstat (limited to 'src/quick/scenegraph/adaptations')
-rw-r--r--src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
index ef0378fe04..bfcc99c4c2 100644
--- a/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
+++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarerenderloop.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
QSGSoftwareRenderLoop::QSGSoftwareRenderLoop()
{
- sg = QSGContext::createDefaultContext();
+ sg = new QSGSoftwareContext();
rc = sg->createRenderContext();
}
@@ -104,11 +104,15 @@ void QSGSoftwareRenderLoop::windowDestroyed(QQuickWindow *window)
void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
{
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
- if (!cd->isRenderable() || !m_windows.contains(window))
+ if (!m_windows.contains(window))
return;
WindowData &data = const_cast<WindowData &>(m_windows[window]);
+ //If were not in grabOnly mode, dont render a non-renderable window
+ if (!data.grabOnly && !cd->isRenderable())
+ return;
+
//Resize the backing store if necessary
if (m_backingStores[window]->size() != window->size()) {
m_backingStores[window]->resize(window->size());
@@ -163,10 +167,7 @@ void QSGSoftwareRenderLoop::renderWindow(QQuickWindow *window)
Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
if (data.grabOnly) {
-#ifndef QT_NO_OPENGL
- // QPlatformBackingStore::toImage() only with OpenGL for some reason
grabContent = m_backingStores[window]->handle()->toImage();
-#endif
data.grabOnly = false;
}
@@ -209,8 +210,19 @@ void QSGSoftwareRenderLoop::exposureChanged(QQuickWindow *window)
QImage QSGSoftwareRenderLoop::grab(QQuickWindow *window)
{
- if (!m_windows.contains(window))
- return QImage();
+ //If the window was never shown, create a new backing store
+ if (!m_backingStores.contains(window)) {
+ m_backingStores[window] = new QBackingStore(window);
+ // Call create on window to make sure platform window is created
+ window->create();
+ }
+
+ //If there is no WindowData, add one
+ if (!m_windows.contains(window)) {
+ WindowData data;
+ data.updatePending = false;
+ m_windows[window] = data;
+ }
m_windows[window].grabOnly = true;