summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Nichols <andy.nichols@theqtcompany.com>2015-10-15 15:51:19 +0200
committerAndy Nichols <andy.nichols@theqtcompany.com>2015-10-15 15:52:00 +0200
commit90fd671857c303d7dafe0e1717cae765acb67fbc (patch)
tree018a921c84b949b9349db174268e5ab6ee8c16a3
parent6b794223f2ce4349044ae13337f31a249cc2c173 (diff)
parent5aa0efd86a5379bd51c7a1195fd5c5d36f94dfda (diff)
Merge remote-tracking branch 'origin/5.6' into dev
-rw-r--r--src/doc/src/qtquick2drenderer-index.qdoc22
-rw-r--r--src/doc/src/qtquick2drenderer-installation-guide.qdoc22
-rw-r--r--src/doc/src/qtquick2drenderer-limitations.qdoc26
-rw-r--r--src/doc/src/qtquick2drenderer-performance.qdoc22
-rw-r--r--src/plugins/scenegraph/softwarecontext/context.cpp27
-rw-r--r--src/plugins/scenegraph/softwarecontext/context.h23
-rw-r--r--src/plugins/scenegraph/softwarecontext/glyphnode.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/glyphnode.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/imagenode.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/imagenode.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/ninepatchnode.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/ninepatchnode.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/painternode.cpp57
-rw-r--r--src/plugins/scenegraph/softwarecontext/painternode.h24
-rw-r--r--src/plugins/scenegraph/softwarecontext/pixmaptexture.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/pixmaptexture.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/pluginmain.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/pluginmain.h19
-rw-r--r--src/plugins/scenegraph/softwarecontext/rectanglenode.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/rectanglenode.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/renderingvisitor.cpp20
-rw-r--r--src/plugins/scenegraph/softwarecontext/renderingvisitor.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/renderloop.cpp53
-rw-r--r--src/plugins/scenegraph/softwarecontext/renderloop.h20
-rw-r--r--src/plugins/scenegraph/softwarecontext/softwarecontext.pro3
-rw-r--r--src/plugins/scenegraph/softwarecontext/softwarelayer.cpp47
-rw-r--r--src/plugins/scenegraph/softwarecontext/softwarelayer.h24
-rw-r--r--src/plugins/scenegraph/softwarecontext/threadedrenderloop.cpp209
-rw-r--r--src/plugins/scenegraph/softwarecontext/threadedrenderloop.h27
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/cmake/CMakeLists.txt7
-rw-r--r--tests/auto/cmake/cmake.pro6
-rw-r--r--tests/tests.pro3
33 files changed, 513 insertions, 392 deletions
diff --git a/src/doc/src/qtquick2drenderer-index.qdoc b/src/doc/src/qtquick2drenderer-index.qdoc
index 2edf181..7af642e 100644
--- a/src/doc/src/qtquick2drenderer-index.qdoc
+++ b/src/doc/src/qtquick2drenderer-index.qdoc
@@ -1,19 +1,19 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of Qt Quick 2d Renderer.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
+** $QT_BEGIN_LICENSE$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://qt.digia.com/
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/doc/src/qtquick2drenderer-installation-guide.qdoc b/src/doc/src/qtquick2drenderer-installation-guide.qdoc
index 4ebe579..3dc408a 100644
--- a/src/doc/src/qtquick2drenderer-installation-guide.qdoc
+++ b/src/doc/src/qtquick2drenderer-installation-guide.qdoc
@@ -1,19 +1,19 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of Qt Quick 2d Renderer.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
+** $QT_BEGIN_LICENSE$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://qt.digia.com/
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/doc/src/qtquick2drenderer-limitations.qdoc b/src/doc/src/qtquick2drenderer-limitations.qdoc
index 42cdd42..8271001 100644
--- a/src/doc/src/qtquick2drenderer-limitations.qdoc
+++ b/src/doc/src/qtquick2drenderer-limitations.qdoc
@@ -1,19 +1,19 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of Qt Quick 2d Renderer.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
+** $QT_BEGIN_LICENSE$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://qt.digia.com/
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,4 +54,8 @@
The quality is similar to choosing \l {QtQuick::Text::renderType}
{Text.NativeRendering} with \l {QtQuick::}{Text} items.
+ \section1 Render Control
+ QQuickRenderControl depends on OpenGL to function and will not function
+ with \RENDERER. Using QQuickRenderControl can lead to unexpected behavior
+ and crashes.
*/
diff --git a/src/doc/src/qtquick2drenderer-performance.qdoc b/src/doc/src/qtquick2drenderer-performance.qdoc
index e648388..8fc57b9 100644
--- a/src/doc/src/qtquick2drenderer-performance.qdoc
+++ b/src/doc/src/qtquick2drenderer-performance.qdoc
@@ -1,19 +1,19 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use the contact form at
-** http://qt.digia.com/
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of Qt Quick 2d Renderer.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
-** Licensees holding valid Qt Enterprise licenses may use this file in
-** accordance with the Qt Enterprise License Agreement provided with the
+** $QT_BEGIN_LICENSE$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** the contact form at http://qt.digia.com/
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/plugins/scenegraph/softwarecontext/context.cpp b/src/plugins/scenegraph/softwarecontext/context.cpp
index f107290..b3b97a7 100644
--- a/src/plugins/scenegraph/softwarecontext/context.cpp
+++ b/src/plugins/scenegraph/softwarecontext/context.cpp
@@ -1,19 +1,18 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -223,13 +222,9 @@ void RenderContext::invalidate()
QSGRenderContext::invalidate();
}
-QSGTexture *RenderContext::createTexture(const QImage &image) const
-{
- return new PixmapTexture(image);
-}
-
-QSGTexture *RenderContext::createTextureNoAtlas(const QImage &image) const
+QSGTexture *RenderContext::createTexture(const QImage &image, uint flags) const
{
+ Q_UNUSED(flags)
return new PixmapTexture(image);
}
diff --git a/src/plugins/scenegraph/softwarecontext/context.h b/src/plugins/scenegraph/softwarecontext/context.h
index 92a0f31..0d734df 100644
--- a/src/plugins/scenegraph/softwarecontext/context.h
+++ b/src/plugins/scenegraph/softwarecontext/context.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef CONTEXT_H
#define CONTEXT_H
@@ -78,8 +78,7 @@ public:
void initializeIfNeeded();
void invalidate();
void renderNextFrame(QSGRenderer *renderer, GLuint fbo);
- QSGTexture *createTexture(const QImage &image) const;
- QSGTexture *createTextureNoAtlas(const QImage &image) const;
+ QSGTexture *createTexture(const QImage &image, uint flags = CreateTexture_Alpha) const;
QSGRenderer *createRenderer();
QWindow *currentWindow;
diff --git a/src/plugins/scenegraph/softwarecontext/glyphnode.cpp b/src/plugins/scenegraph/softwarecontext/glyphnode.cpp
index eae8b62..36d83b3 100644
--- a/src/plugins/scenegraph/softwarecontext/glyphnode.cpp
+++ b/src/plugins/scenegraph/softwarecontext/glyphnode.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "glyphnode.h"
GlyphNode::GlyphNode()
diff --git a/src/plugins/scenegraph/softwarecontext/glyphnode.h b/src/plugins/scenegraph/softwarecontext/glyphnode.h
index d34013b..e7b5e47 100644
--- a/src/plugins/scenegraph/softwarecontext/glyphnode.h
+++ b/src/plugins/scenegraph/softwarecontext/glyphnode.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef GLYPHNODE_H
#define GLYPHNODE_H
diff --git a/src/plugins/scenegraph/softwarecontext/imagenode.cpp b/src/plugins/scenegraph/softwarecontext/imagenode.cpp
index 0ca579d..b5b0dbc 100644
--- a/src/plugins/scenegraph/softwarecontext/imagenode.cpp
+++ b/src/plugins/scenegraph/softwarecontext/imagenode.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "imagenode.h"
#include "pixmaptexture.h"
diff --git a/src/plugins/scenegraph/softwarecontext/imagenode.h b/src/plugins/scenegraph/softwarecontext/imagenode.h
index 05d4077..4a62350 100644
--- a/src/plugins/scenegraph/softwarecontext/imagenode.h
+++ b/src/plugins/scenegraph/softwarecontext/imagenode.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef IMAGENODE_H
#define IMAGENODE_H
diff --git a/src/plugins/scenegraph/softwarecontext/ninepatchnode.cpp b/src/plugins/scenegraph/softwarecontext/ninepatchnode.cpp
index ec77729..052e7b8 100644
--- a/src/plugins/scenegraph/softwarecontext/ninepatchnode.cpp
+++ b/src/plugins/scenegraph/softwarecontext/ninepatchnode.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "ninepatchnode.h"
#include "pixmaptexture.h"
#include "imagenode.h"
diff --git a/src/plugins/scenegraph/softwarecontext/ninepatchnode.h b/src/plugins/scenegraph/softwarecontext/ninepatchnode.h
index 2bcd121..34fdc44 100644
--- a/src/plugins/scenegraph/softwarecontext/ninepatchnode.h
+++ b/src/plugins/scenegraph/softwarecontext/ninepatchnode.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef NINEPATCHNODE_H
#define NINEPATCHNODE_H
diff --git a/src/plugins/scenegraph/softwarecontext/painternode.cpp b/src/plugins/scenegraph/softwarecontext/painternode.cpp
index bf5ec5f..7e61cfa 100644
--- a/src/plugins/scenegraph/softwarecontext/painternode.cpp
+++ b/src/plugins/scenegraph/softwarecontext/painternode.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "painternode.h"
#include "pixmaptexture.h"
#include <qmath.h>
@@ -136,7 +136,7 @@ QImage PainterNode::toImage() const
void PainterNode::update()
{
if (m_dirtyGeometry) {
- m_pixmap = QPixmap(m_size);
+ m_pixmap = QPixmap(m_textureSize);
if (!m_opaquePainting)
m_pixmap.fill(Qt::transparent);
@@ -168,18 +168,29 @@ void PainterNode::paint()
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
}
- painter.scale(m_contentsScale, m_contentsScale);
+ QRect clipRect;
+
+ if (m_contentsScale == 1) {
+ qreal scaleX = m_textureSize.width() / (qreal) m_size.width();
+ qreal scaleY = m_textureSize.height() / (qreal) m_size.height();
+ painter.scale(scaleX, scaleY);
+ clipRect = dirtyRect;
+ } else {
+ painter.scale(m_contentsScale, m_contentsScale);
- QRect sclip(qFloor(dirtyRect.x()/m_contentsScale),
- qFloor(dirtyRect.y()/m_contentsScale),
- qCeil(dirtyRect.width()/m_contentsScale+dirtyRect.x()/m_contentsScale-qFloor(dirtyRect.x()/m_contentsScale)),
- qCeil(dirtyRect.height()/m_contentsScale+dirtyRect.y()/m_contentsScale-qFloor(dirtyRect.y()/m_contentsScale)));
+ QRect sclip(qFloor(dirtyRect.x()/m_contentsScale),
+ qFloor(dirtyRect.y()/m_contentsScale),
+ qCeil(dirtyRect.width()/m_contentsScale+dirtyRect.x()/m_contentsScale-qFloor(dirtyRect.x()/m_contentsScale)),
+ qCeil(dirtyRect.height()/m_contentsScale+dirtyRect.y()/m_contentsScale-qFloor(dirtyRect.y()/m_contentsScale)));
+
+ clipRect = sclip;
+ }
if (!m_dirtyRect.isNull())
- painter.setClipRect(sclip);
+ painter.setClipRect(clipRect);
painter.setCompositionMode(QPainter::CompositionMode_Source);
- painter.fillRect(sclip, m_fillColor);
+ painter.fillRect(clipRect, m_fillColor);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
m_item->paint(&painter);
@@ -187,3 +198,13 @@ void PainterNode::paint()
m_dirtyRect = QRect();
}
+
+
+void PainterNode::setTextureSize(const QSize &size)
+{
+ if (size == m_textureSize)
+ return;
+
+ m_textureSize = size;
+ m_dirtyGeometry = true;
+}
diff --git a/src/plugins/scenegraph/softwarecontext/painternode.h b/src/plugins/scenegraph/softwarecontext/painternode.h
index db0d03e..6a2891d 100644
--- a/src/plugins/scenegraph/softwarecontext/painternode.h
+++ b/src/plugins/scenegraph/softwarecontext/painternode.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PAINTERNODE_H
#define PAINTERNODE_H
@@ -67,6 +67,9 @@ public:
void paint();
+ void setTextureSize(const QSize &size);
+ QSize textureSize() const { return m_textureSize; }
+
private:
QQuickPaintedItem::RenderTarget m_preferredRenderTarget;
@@ -89,6 +92,7 @@ private:
bool m_fastFBOResizing;
QColor m_fillColor;
qreal m_contentsScale;
+ QSize m_textureSize;
bool m_dirtyGeometry;
};
diff --git a/src/plugins/scenegraph/softwarecontext/pixmaptexture.cpp b/src/plugins/scenegraph/softwarecontext/pixmaptexture.cpp
index 283a90e..1a4c70e 100644
--- a/src/plugins/scenegraph/softwarecontext/pixmaptexture.cpp
+++ b/src/plugins/scenegraph/softwarecontext/pixmaptexture.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "pixmaptexture.h"
PixmapTexture::PixmapTexture(const QImage &image)
diff --git a/src/plugins/scenegraph/softwarecontext/pixmaptexture.h b/src/plugins/scenegraph/softwarecontext/pixmaptexture.h
index c3ee09d..842ee3b 100644
--- a/src/plugins/scenegraph/softwarecontext/pixmaptexture.h
+++ b/src/plugins/scenegraph/softwarecontext/pixmaptexture.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PIXMAPTEXTURE_H
#define PIXMAPTEXTURE_H
diff --git a/src/plugins/scenegraph/softwarecontext/pluginmain.cpp b/src/plugins/scenegraph/softwarecontext/pluginmain.cpp
index a928cb6..5b35859 100644
--- a/src/plugins/scenegraph/softwarecontext/pluginmain.cpp
+++ b/src/plugins/scenegraph/softwarecontext/pluginmain.cpp
@@ -1,24 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
-
#include "pluginmain.h"
#include "context.h"
#include "renderloop.h"
diff --git a/src/plugins/scenegraph/softwarecontext/pluginmain.h b/src/plugins/scenegraph/softwarecontext/pluginmain.h
index fd90823..f0c6890 100644
--- a/src/plugins/scenegraph/softwarecontext/pluginmain.h
+++ b/src/plugins/scenegraph/softwarecontext/pluginmain.h
@@ -1,19 +1,18 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/plugins/scenegraph/softwarecontext/rectanglenode.cpp b/src/plugins/scenegraph/softwarecontext/rectanglenode.cpp
index 20be418..3b612e1 100644
--- a/src/plugins/scenegraph/softwarecontext/rectanglenode.cpp
+++ b/src/plugins/scenegraph/softwarecontext/rectanglenode.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "rectanglenode.h"
#include <qmath.h>
diff --git a/src/plugins/scenegraph/softwarecontext/rectanglenode.h b/src/plugins/scenegraph/softwarecontext/rectanglenode.h
index 5dfbf3b..091920a 100644
--- a/src/plugins/scenegraph/softwarecontext/rectanglenode.h
+++ b/src/plugins/scenegraph/softwarecontext/rectanglenode.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef RECTANGLENODE_H
#define RECTANGLENODE_H
diff --git a/src/plugins/scenegraph/softwarecontext/renderingvisitor.cpp b/src/plugins/scenegraph/softwarecontext/renderingvisitor.cpp
index 4574fcb..6122434 100644
--- a/src/plugins/scenegraph/softwarecontext/renderingvisitor.cpp
+++ b/src/plugins/scenegraph/softwarecontext/renderingvisitor.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "renderingvisitor.h"
#include "imagenode.h"
diff --git a/src/plugins/scenegraph/softwarecontext/renderingvisitor.h b/src/plugins/scenegraph/softwarecontext/renderingvisitor.h
index e405fe8..416c56a 100644
--- a/src/plugins/scenegraph/softwarecontext/renderingvisitor.h
+++ b/src/plugins/scenegraph/softwarecontext/renderingvisitor.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef RENDERINGVISITOR_H
#define RENDERINGVISITOR_H
diff --git a/src/plugins/scenegraph/softwarecontext/renderloop.cpp b/src/plugins/scenegraph/softwarecontext/renderloop.cpp
index f765e15..6cb6550 100644
--- a/src/plugins/scenegraph/softwarecontext/renderloop.cpp
+++ b/src/plugins/scenegraph/softwarecontext/renderloop.cpp
@@ -1,25 +1,28 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "renderloop.h"
#include "context.h"
+
+#include <QtCore/QCoreApplication>
+
#include <private/qquickwindow_p.h>
#include <QElapsedTimer>
#include <private/qquickprofiler_p.h>
@@ -49,25 +52,18 @@ void RenderLoop::show(QQuickWindow *window)
void RenderLoop::hide(QQuickWindow *window)
{
- if (!m_windows.contains(window))
- return;
-
- m_windows.remove(window);
QQuickWindowPrivate *cd = QQuickWindowPrivate::get(window);
cd->fireAboutToStop();
- cd->cleanupNodesOnShutdown();
-
- if (m_windows.size() == 0) {
- if (!cd->persistentSceneGraph) {
- rc->invalidate();
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
- }
- }
}
void RenderLoop::windowDestroyed(QQuickWindow *window)
{
+ m_windows.remove(window);
hide(window);
+
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
+ d->cleanupNodesOnShutdown();
+
if (m_windows.size() == 0) {
rc->invalidate();
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
@@ -98,15 +94,17 @@ void RenderLoop::renderWindow(QQuickWindow *window)
}
QElapsedTimer renderTimer;
qint64 renderTime = 0, syncTime = 0, polishTime = 0;
- bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled() || QQuickProfiler::featuresEnabled;
+ bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames)
renderTimer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishFrame);
cd->polishItems();
- if (profileFrames) {
+ if (profileFrames)
polishTime = renderTimer.nsecsElapsed();
- }
+ Q_QUICK_SG_PROFILE_SWITCH(QQuickProfiler::SceneGraphPolishFrame,
+ QQuickProfiler::SceneGraphRenderLoopFrame);
emit window->afterAnimating();
@@ -114,14 +112,16 @@ void RenderLoop::renderWindow(QQuickWindow *window)
if (profileFrames)
syncTime = renderTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
cd->renderSceneGraph(window->size());
if (profileFrames)
renderTime = renderTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
if (data.grabOnly) {
- // #### grabContent = qt_gl_read_framebuffer(window->size() * window->devicePixelRatio(), false, false);
+ // #### grabContent = qt_gl_read_framebuffer(window->size() * window->effectiveDevicePixelRatio(), false, false);
data.grabOnly = false;
}
@@ -133,6 +133,7 @@ void RenderLoop::renderWindow(QQuickWindow *window)
qint64 swapTime = 0;
if (profileFrames)
swapTime = renderTimer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
if (QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled()) {
static QTime lastFrameTime = QTime::currentTime();
diff --git a/src/plugins/scenegraph/softwarecontext/renderloop.h b/src/plugins/scenegraph/softwarecontext/renderloop.h
index b6993a8..4f17e85 100644
--- a/src/plugins/scenegraph/softwarecontext/renderloop.h
+++ b/src/plugins/scenegraph/softwarecontext/renderloop.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef RENDERLOOP_H
#define RENDERLOOP_H
diff --git a/src/plugins/scenegraph/softwarecontext/softwarecontext.pro b/src/plugins/scenegraph/softwarecontext/softwarecontext.pro
index 502a0eb..cc0acfe 100644
--- a/src/plugins/scenegraph/softwarecontext/softwarecontext.pro
+++ b/src/plugins/scenegraph/softwarecontext/softwarecontext.pro
@@ -6,6 +6,9 @@ PLUGIN_TYPE = scenegraph
PLUGIN_CLASS_NAME = ContextPlugin
load(qt_plugin)
+QMAKE_TARGET_PRODUCT = "Qt Quick 2D Renderer (Qt $$QT_VERSION)"
+QMAKE_TARGET_DESCRIPTION = "Quick 2D Renderer for Qt."
+
SOURCES += \
context.cpp \
pluginmain.cpp \
diff --git a/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp b/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp
index 059278c..8fcf3ab 100644
--- a/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp
+++ b/src/plugins/scenegraph/softwarecontext/softwarelayer.cpp
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "softwarelayer.h"
#include "context.h"
@@ -26,6 +26,8 @@ SoftwareLayer::SoftwareLayer(QSGRenderContext *renderContext)
, m_context(renderContext)
, m_renderer(0)
, m_device_pixel_ratio(1)
+ , m_mirrorHorizontal(false)
+ , m_mirrorVertical(false)
, m_live(true)
, m_grab(true)
, m_recursive(false)
@@ -151,6 +153,22 @@ void SoftwareLayer::setDevicePixelRatio(qreal ratio)
m_device_pixel_ratio = ratio;
}
+void SoftwareLayer::setMirrorHorizontal(bool mirror)
+{
+ if (m_mirrorHorizontal == mirror)
+ return;
+ m_mirrorHorizontal = mirror;
+ markDirtyTexture();
+}
+
+void SoftwareLayer::setMirrorVertical(bool mirror)
+{
+ if (m_mirrorVertical == mirror)
+ return;
+ m_mirrorVertical = mirror;
+ markDirtyTexture();
+}
+
void SoftwareLayer::markDirtyTexture()
{
m_dirtyTexture = true;
@@ -198,10 +216,11 @@ void SoftwareLayer::grab()
m_renderer->setDeviceRect(m_size);
m_renderer->setViewportRect(m_size);
- m_renderer->m_projectionRect = QRect(m_rect.x() * m_device_pixel_ratio,
- m_rect.y() * m_device_pixel_ratio,
- m_rect.width() * m_device_pixel_ratio,
- m_rect.height() * m_device_pixel_ratio);
+ QRect mirrored(m_mirrorHorizontal ? m_rect.right() * m_device_pixel_ratio : m_rect.left() * m_device_pixel_ratio,
+ m_mirrorVertical ? m_rect.top() * m_device_pixel_ratio : m_rect.bottom() * m_device_pixel_ratio,
+ m_mirrorHorizontal ? -m_rect.width() * m_device_pixel_ratio : m_rect.width() * m_device_pixel_ratio,
+ m_mirrorVertical ? m_rect.height() * m_device_pixel_ratio : -m_rect.height() * m_device_pixel_ratio);
+ m_renderer->m_projectionRect = mirrored;
m_renderer->setClearColor(Qt::transparent);
m_renderer->renderScene();
diff --git a/src/plugins/scenegraph/softwarecontext/softwarelayer.h b/src/plugins/scenegraph/softwarecontext/softwarelayer.h
index f1529eb..c4375b1 100644
--- a/src/plugins/scenegraph/softwarecontext/softwarelayer.h
+++ b/src/plugins/scenegraph/softwarecontext/softwarelayer.h
@@ -1,22 +1,22 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef SOFTWARELAYER_H
#define SOFTWARELAYER_H
@@ -60,6 +60,8 @@ public:
virtual void setFormat(GLenum);
virtual void setHasMipmaps(bool);
virtual void setDevicePixelRatio(qreal ratio);
+ virtual void setMirrorHorizontal(bool mirror);
+ virtual void setMirrorVertical(bool mirror);
public slots:
virtual void markDirtyTexture();
@@ -75,6 +77,8 @@ private:
QSize m_size;
QPixmap m_pixmap;
qreal m_device_pixel_ratio;
+ bool m_mirrorHorizontal;
+ bool m_mirrorVertical;
bool m_live;
bool m_grab;
bool m_recursive;
diff --git a/src/plugins/scenegraph/softwarecontext/threadedrenderloop.cpp b/src/plugins/scenegraph/softwarecontext/threadedrenderloop.cpp
index 8ed5a84..9f255c2 100644
--- a/src/plugins/scenegraph/softwarecontext/threadedrenderloop.cpp
+++ b/src/plugins/scenegraph/softwarecontext/threadedrenderloop.cpp
@@ -1,25 +1,26 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of H.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "threadedrenderloop.h"
+#include <QtCore/QCoreApplication>
#include <QtCore/QMutex>
#include <QtCore/QWaitCondition>
#include <QtCore/QAnimationDriver>
@@ -41,7 +42,8 @@
#include <private/qquickanimatorcontroller_p.h>
#include <private/qquickprofiler_p.h>
-#include <private/qqmldebugservice_p.h>
+#include <private/qqmldebugserviceinterfaces_p.h>
+#include <private/qqmldebugconnector_p.h>
#include "context.h"
/*
@@ -93,16 +95,6 @@ QT_BEGIN_NAMESPACE
#define QSG_RT_PAD " (RT)"
-static int get_env_int(const char *name, int defaultValue)
-{
- QByteArray content = qgetenv(name);
-
- bool ok = false;
- int value = content.toInt(&ok);
- return ok ? value : defaultValue;
-}
-
-
static inline int qsgrl_animation_interval() {
qreal refreshRate = QGuiApplication::primaryScreen()->refreshRate();
// To work around that some platforms wrongfully return 0 or something
@@ -143,7 +135,10 @@ const QEvent::Type WM_TryRelease = QEvent::Type(QEvent::User + 4);
// called.
const QEvent::Type WM_Grab = QEvent::Type(QEvent::User + 5);
-template <typename T> T *windowFor(const QList<T> list, QQuickWindow *window)
+// Passed by the window when there is a render job to run
+const QEvent::Type WM_PostJob = QEvent::Type(QEvent::User + 6);
+
+template <typename T> T *windowFor(const QList<T> &list, QQuickWindow *window)
{
for (int i=0; i<list.size(); ++i) {
const T &t = list.at(i);
@@ -177,9 +172,15 @@ public:
class WMSyncEvent : public WMWindowEvent
{
public:
- WMSyncEvent(QQuickWindow *c, bool inExpose) : WMWindowEvent(c, WM_RequestSync), size(c->size()), syncInExpose(inExpose) { }
+ WMSyncEvent(QQuickWindow *c, bool inExpose, bool force)
+ : WMWindowEvent(c, WM_RequestSync)
+ , size(c->size())
+ , syncInExpose(inExpose)
+ , forceRenderPass(force)
+ {}
QSize size;
bool syncInExpose;
+ bool forceRenderPass;
};
@@ -190,6 +191,14 @@ public:
QImage *image;
};
+class WMJobEvent : public WMWindowEvent
+{
+public:
+ WMJobEvent(QQuickWindow *c, QRunnable *postedJob)
+ : WMWindowEvent(c, WM_PostJob), job(postedJob) {}
+ ~WMJobEvent() { delete job; }
+ QRunnable *job;
+};
class RenderThreadEventQueue : public QQueue<QEvent *>
{
@@ -350,6 +359,10 @@ bool RenderThread::event(QEvent *e)
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- triggered from expose";
pendingUpdate |= ExposeRequest;
}
+ if (se->forceRenderPass) {
+ qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- repaint regardless";
+ pendingUpdate |= RepaintRequest;
+ }
return true; }
case WM_TryRelease: {
@@ -375,7 +388,8 @@ bool RenderThread::event(QEvent *e)
case WM_Grab: {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "WM_Grab";
WMGrabEvent *ce = static_cast<WMGrabEvent *>(e);
- Q_ASSERT(ce->window == window);
+ Q_ASSERT(ce->window);
+ Q_ASSERT(ce->window == window || !window);
mutex.lock();
if (window) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- sync scene graph";
@@ -395,6 +409,19 @@ bool RenderThread::event(QEvent *e)
return true;
}
+ case WM_PostJob: {
+ qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "WM_PostJob";
+ WMJobEvent *ce = static_cast<WMJobEvent *>(e);
+ Q_ASSERT(ce->window == window);
+ if (window) {
+ ce->job->run();
+ delete ce->job;
+ ce->job = 0;
+ qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- job done";
+ }
+ return true;
+ }
+
case WM_RequestRepaint:
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "WM_RequestPaint";
// When GUI posts this event, it is followed by a polishAndSync, so we mustn't
@@ -454,11 +481,12 @@ void RenderThread::sync(bool inExpose)
void RenderThread::syncAndRender()
{
- bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled() || QQuickProfiler::featuresEnabled;
+ bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames) {
sinceLastTime = threadTimer.nsecsElapsed();
threadTimer.start();
}
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphRenderLoopFrame);
QElapsedTimer waitTimer;
waitTimer.start();
@@ -466,16 +494,24 @@ void RenderThread::syncAndRender()
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "syncAndRender()";
syncResultedInChanges = false;
+ QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
- uint pending = pendingUpdate;
+ bool repaintRequested = (pendingUpdate & RepaintRequest) || d->customRenderStage;
+ bool syncRequested = pendingUpdate & SyncRequest;
+ bool exposeRequested = (pendingUpdate & ExposeRequest) == ExposeRequest;
pendingUpdate = 0;
- if (pending & SyncRequest) {
+ if (syncRequested) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- updatePending, doing sync";
- sync(pending == ExposeRequest);
+ sync(exposeRequested);
}
+#ifndef QSG_NO_RENDER_TIMING
+ if (profileFrames)
+ syncTime = threadTimer.nsecsElapsed();
+#endif
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphRenderLoopFrame);
- if (!syncResultedInChanges && ((pending & RepaintRequest) == 0)) {
+ if (!syncResultedInChanges && !repaintRequested) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- no changes, render aborted";
int waitTime = vsyncDelta - (int) waitTimer.elapsed();
if (waitTime > 0)
@@ -483,12 +519,8 @@ void RenderThread::syncAndRender()
return;
}
- if (profileFrames)
- syncTime = threadTimer.nsecsElapsed();
-
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- rendering started";
- QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
if (animatorDriver->isRunning()) {
d->animationController->lock();
@@ -507,6 +539,7 @@ void RenderThread::syncAndRender()
// ### used to be swappBuffers here
d->fireFrameSwapped();
} else {
+ Q_QUICK_SG_PROFILE_SKIP(QQuickProfiler::SceneGraphRenderLoopFrame, 1);
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- window not ready, skipping render";
}
@@ -517,7 +550,7 @@ void RenderThread::syncAndRender()
// that to avoid blocking the GUI thread in the case where it
// has started rendering with a bad window, causing makeCurrent to
// fail or if the window has a bad size.
- if (pending == ExposeRequest) {
+ if (exposeRequested) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "- wake Gui after initial expose";
waitCondition.wakeOne();
mutex.unlock();
@@ -530,6 +563,8 @@ void RenderThread::syncAndRender()
int((renderTime - syncTime) / 1000000),
int(threadTimer.elapsed() - renderTime / 1000000));
+
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphRenderLoopFrame);
}
@@ -569,7 +604,7 @@ void RenderThread::run()
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << QSG_RT_PAD << "run()";
animatorDriver = sgrc->sceneGraphContext()->createAnimationDriver(0);
animatorDriver->install();
- if (QQmlDebugService::isDebuggingEnabled())
+ if (QQmlDebugConnector::service<QQmlProfilerService>())
QQuickProfiler::registerAnimationCallback();
while (active) {
@@ -609,8 +644,6 @@ ThreadedRenderLoop::ThreadedRenderLoop()
m_animation_driver = sg->createAnimationDriver(this);
- m_exhaust_delay = get_env_int("QML_EXHAUST_DELAY", 5);
-
connect(m_animation_driver, SIGNAL(started()), this, SLOT(animationStarted()));
connect(m_animation_driver, SIGNAL(stopped()), this, SLOT(animationStopped()));
@@ -624,10 +657,7 @@ QSGRenderContext *ThreadedRenderLoop::createRenderContext(QSGContext *sg) const
void ThreadedRenderLoop::maybePostPolishRequest(Window *w)
{
- if (w->timerId == 0) {
- qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- posting update";
- w->timerId = startTimer(m_exhaust_delay, Qt::PreciseTimer);
- }
+ w->window->requestUpdate();
}
QAnimationDriver *ThreadedRenderLoop::animationDriver() const
@@ -674,9 +704,9 @@ void ThreadedRenderLoop::animationStopped()
void ThreadedRenderLoop::startOrStopAnimationTimer()
{
int exposedWindows = 0;
- Window *theOne = 0;
+ const Window *theOne = 0;
for (int i=0; i<m_windows.size(); ++i) {
- Window &w = m_windows[i];
+ const Window &w = m_windows.at(i);
if (w.window->isVisible() && w.window->isExposed()) {
++exposedWindows;
theOne = &w;
@@ -688,7 +718,7 @@ void ThreadedRenderLoop::startOrStopAnimationTimer()
m_animation_timer = 0;
// If animations are running, make sure we keep on animating
if (m_animation_driver->isRunning())
- maybePostPolishRequest(theOne);
+ maybePostPolishRequest(const_cast<Window *>(theOne));
} else if (m_animation_timer == 0 && exposedWindows != 1 && m_animation_driver->isRunning()) {
m_animation_timer = startTimer(qsgrl_animation_interval());
@@ -777,8 +807,8 @@ void ThreadedRenderLoop::handleExposure(QQuickWindow *window)
win.window = window;
win.actualWindowFormat = window->format();
win.thread = new RenderThread(this, QQuickWindowPrivate::get(window)->context);
- win.timerId = 0;
win.updateDuringSync = false;
+ win.forceRenderPass = true; // also covered by polishAndSync(inExpose=true), but doesn't hurt
m_windows << win;
w = &m_windows.last();
}
@@ -788,9 +818,11 @@ void ThreadedRenderLoop::handleExposure(QQuickWindow *window)
w->thread->window = window;
if (w->window->width() <= 0 || w->window->height() <= 0
- || !w->window->geometry().intersects(w->window->screen()->availableGeometry())) {
+ || (w->window->isTopLevel() && !w->window->geometry().intersects(w->window->screen()->availableGeometry()))) {
#ifndef QT_NO_DEBUG
- qWarning("ThreadedRenderLoop: expose event received for window with invalid geometry.");
+ qWarning().noquote().nospace() << "ThreadedRenderLoop: expose event received for window "
+ << w->window << " with invalid geometry: " << w->window->geometry()
+ << " on " << w->window->screen();
#endif
}
@@ -814,6 +846,8 @@ void ThreadedRenderLoop::handleExposure(QQuickWindow *window)
w->thread->moveToThread(w->thread);
}
w->thread->start();
+ if (!w->thread->isRunning())
+ qFatal("Render thread failed to start, aborting application.");
} else {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- render thread already running";
@@ -845,6 +879,14 @@ void ThreadedRenderLoop::handleObscurity(Window *w)
}
+void ThreadedRenderLoop::handleUpdateRequest(QQuickWindow *window)
+{
+ qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- polish and sync update request";
+ Window *w = windowFor(m_windows, window);
+ if (w)
+ polishAndSync(w);
+}
+
void ThreadedRenderLoop::maybeUpdate(QQuickWindow *window)
{
Window *w = windowFor(m_windows, window);
@@ -861,6 +903,9 @@ void ThreadedRenderLoop::maybeUpdate(Window *w)
if (!QCoreApplication::instance())
return;
+ if (!w || !w->thread->isRunning())
+ return;
+
QThread *current = QThread::currentThread();
if (current != QCoreApplication::instance()->thread() && (current != w->thread || !m_lockedForSync)) {
qWarning() << "Updates can only be scheduled from GUI thread or from QQuickItem::updatePaintNode()";
@@ -874,7 +919,7 @@ void ThreadedRenderLoop::maybeUpdate(Window *w)
// Call this function from the Gui thread later as startTimer cannot be
// called from the render thread.
- if (QThread::currentThread() == w->thread) {
+ if (current == w->thread) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- on render thread";
w->updateDuringSync = true;
return;
@@ -901,7 +946,9 @@ void ThreadedRenderLoop::update(QQuickWindow *window)
}
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "update on window" << w->window;
- w->thread->postEvent(new QEvent(WM_RequestRepaint));
+ // We set forceRenderPass because we want to make sure the QQuickWindow
+ // actually does a full render pass after the next sync.
+ w->forceRenderPass = true;
maybeUpdate(w);
}
@@ -943,6 +990,18 @@ void ThreadedRenderLoop::releaseResources(Window *w, bool inDestructor)
w->thread->postEvent(new WMTryReleaseEvent(window, inDestructor, fallback));
w->thread->waitCondition.wait(&w->thread->mutex);
delete fallback;
+
+ // Avoid a shutdown race condition.
+ // If SG is invalidated and 'active' becomes false, the thread's run()
+ // method will exit. handleExposure() relies on QThread::isRunning() (because it
+ // potentially needs to start the thread again) and our mutex cannot be used to
+ // track the thread stopping, so we wait a few nanoseconds extra so the thread
+ // can exit properly.
+ if (!w->thread->active) {
+ qCDebug(QSG_RASTER_LOG_RENDERLOOP) << " - waiting for render thread to exit" << w->window;
+ w->thread->wait();
+ qCDebug(QSG_RASTER_LOG_RENDERLOOP) << " - render thread finished" << w->window;
+ }
}
w->thread->mutex.unlock();
}
@@ -958,8 +1017,6 @@ void ThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
QQuickWindow *window = w->window;
if (!w->thread || !w->thread->window) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- not exposed, abort";
- killTimer(w->timerId);
- w->timerId = 0;
return;
}
@@ -969,8 +1026,6 @@ void ThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
w = windowFor(m_windows, window);
if (!w || !w->thread || !w->thread->window) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- removed after event flushing, abort";
- killTimer(w->timerId);
- w->timerId = 0;
return;
}
@@ -979,15 +1034,17 @@ void ThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qint64 polishTime = 0;
qint64 waitTime = 0;
qint64 syncTime = 0;
- bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled() || QQuickProfiler::featuresEnabled;
+ bool profileFrames = QSG_RASTER_LOG_TIME_RENDERLOOP().isDebugEnabled();
if (profileFrames)
timer.start();
+ Q_QUICK_SG_PROFILE_START(QQuickProfiler::SceneGraphPolishAndSync);
QQuickWindowPrivate *d = QQuickWindowPrivate::get(window);
d->polishItems();
if (profileFrames)
polishTime = timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
w->updateDuringSync = false;
@@ -996,11 +1053,13 @@ void ThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- lock for sync";
w->thread->mutex.lock();
m_lockedForSync = true;
- w->thread->postEvent(new WMSyncEvent(window, inExpose));
+ w->thread->postEvent(new WMSyncEvent(window, inExpose, w->forceRenderPass));
+ w->forceRenderPass = false;
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- wait for sync";
if (profileFrames)
waitTime = timer.nsecsElapsed();
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
w->thread->waitCondition.wait(&w->thread->mutex);
m_lockedForSync = false;
w->thread->mutex.unlock();
@@ -1008,9 +1067,7 @@ void ThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
if (profileFrames)
syncTime = timer.nsecsElapsed();
-
- killTimer(w->timerId);
- w->timerId = 0;
+ Q_QUICK_SG_PROFILE_RECORD(QQuickProfiler::SceneGraphPolishAndSync);
if (m_animation_timer == 0 && m_animation_driver->isRunning()) {
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- advancing animations";
@@ -1030,17 +1087,8 @@ void ThreadedRenderLoop::polishAndSync(Window *w, bool inExpose)
<< ", blockedForSync=" << (syncTime - waitTime) / 1000000
<< ", animations=" << (timer.nsecsElapsed() - syncTime) / 1000000
<< " - (on Gui thread) " << window;
-}
-ThreadedRenderLoop::Window *ThreadedRenderLoop::windowForTimer(int timerId) const
-{
- for (int i=0; i<m_windows.size(); ++i) {
- if (m_windows.at(i).timerId == timerId) {
- return const_cast<Window *>(&m_windows.at(i));
- break;
- }
- }
- return 0;
+ Q_QUICK_SG_PROFILE_END(QQuickProfiler::SceneGraphPolishAndSync);
}
bool ThreadedRenderLoop::event(QEvent *e)
@@ -1053,15 +1101,8 @@ bool ThreadedRenderLoop::event(QEvent *e)
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- ticking non-visual timer";
m_animation_driver->advance();
emit timeToIncubate();
- } else {
- qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- polish and sync timer";
- Window *w = windowForTimer(te->timerId());
- if (w)
- polishAndSync(w);
- else
- killTimer(te->timerId());
+ return true;
}
- return true;
}
default:
@@ -1108,12 +1149,24 @@ QImage ThreadedRenderLoop::grab(QQuickWindow *window)
w->thread->waitCondition.wait(&w->thread->mutex);
m_lockedForSync = false;
w->thread->mutex.unlock();
-
qCDebug(QSG_RASTER_LOG_RENDERLOOP) << "- grab complete";
return result;
}
-QT_END_NAMESPACE
+/*!
+ * Posts a new job event to the render thread.
+ * Returns true if posting succeeded.
+ */
+void ThreadedRenderLoop::postJob(QQuickWindow *window, QRunnable *job)
+{
+ Window *w = windowFor(m_windows, window);
+ if (w && w->thread && w->thread->window)
+ w->thread->postEvent(new WMJobEvent(window, job));
+ else
+ delete job;
+}
#include "threadedrenderloop.moc"
+
+QT_END_NAMESPACE
diff --git a/src/plugins/scenegraph/softwarecontext/threadedrenderloop.h b/src/plugins/scenegraph/softwarecontext/threadedrenderloop.h
index f5c640b..844e0de 100644
--- a/src/plugins/scenegraph/softwarecontext/threadedrenderloop.h
+++ b/src/plugins/scenegraph/softwarecontext/threadedrenderloop.h
@@ -1,23 +1,23 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc
** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.com>
-** All rights reserved.
-** For any questions to Digia, please use contact form at http://qt.digia.com
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt SceneGraph Raster Add-on.
+** This file is part of Qt Quick 2d Renderer module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE$
-** Licensees holding valid Qt Commercial licenses may use this file in
-** accordance with the Qt Commercial License Agreement provided with the
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.
-**
-** If you have questions regarding the use of this file, please use
-** contact form at http://qt.digia.com
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef THREADEDRENDERLOOP_H
#define THREADEDRENDERLOOP_H
@@ -43,6 +43,8 @@ public:
void update(QQuickWindow *window);
void maybeUpdate(QQuickWindow *window);
+ void handleUpdateRequest(QQuickWindow *window);
+
QSGContext *sceneGraphContext() const;
QSGRenderContext *createRenderContext(QSGContext *) const;
@@ -51,6 +53,7 @@ public:
void releaseResources(QQuickWindow *window);
bool event(QEvent *);
+ void postJob(QQuickWindow *window, QRunnable *job);
bool interleaveIncubation() const;
@@ -63,15 +66,14 @@ private:
QQuickWindow *window;
RenderThread *thread;
QSurfaceFormat actualWindowFormat;
- int timerId;
uint updateDuringSync : 1;
+ uint forceRenderPass : 1;
};
friend class RenderThread;
void releaseResources(Window *window, bool inDestructor);
bool checkAndResetForceUpdate(QQuickWindow *window);
- Window *windowForTimer(int timerId) const;
bool anyoneShowing() const;
void initialize();
@@ -91,7 +93,6 @@ private:
QList<Window> m_windows;
int m_animation_timer;
- int m_exhaust_delay;
bool m_lockedForSync;
};
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
new file mode 100644
index 0000000..330bccf
--- /dev/null
+++ b/tests/auto/auto.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS += \
+ cmake \
diff --git a/tests/auto/cmake/CMakeLists.txt b/tests/auto/cmake/CMakeLists.txt
new file mode 100644
index 0000000..cac7528
--- /dev/null
+++ b/tests/auto/cmake/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(qmake_cmake_files)
+
+enable_testing()
+
+add_test(dummy ${CMAKE_COMMAND} -E echo)
diff --git a/tests/auto/cmake/cmake.pro b/tests/auto/cmake/cmake.pro
new file mode 100644
index 0000000..baaef7d
--- /dev/null
+++ b/tests/auto/cmake/cmake.pro
@@ -0,0 +1,6 @@
+# Cause make to do nothing.
+TEMPLATE = subdirs
+
+CMAKE_QT_MODULES_UNDER_TEST = scenegraph-raster
+
+CONFIG += ctest_testcase
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644
index 0000000..15dd97b
--- /dev/null
+++ b/tests/tests.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+CONFIG += no_docs_target
+SUBDIRS = auto