diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-18 10:29:10 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-08-18 10:29:47 +0200 |
commit | eb30e3d7ee81c48cea720e7ecd2ed45647bc70ee (patch) | |
tree | 810e8ad0642434eeb4043c3a06c82217314300e1 /src/quick/scenegraph | |
parent | 9c9fca5e27bd91da1ea07bebd7569049493c5ccf (diff) | |
parent | 521ace713d8e5230d47f3da8cd941699ca085af2 (diff) |
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
src/qml/debugger/qv4debugservice.cpp
src/qml/jsruntime/qv4value_inl_p.h
src/qml/jsruntime/qv4value_p.h
src/qml/memory/qv4mm.cpp
src/qml/memory/qv4mm_p.h
src/qml/qml/qqmlnotifier_p.h
src/qml/qml/qqmlproperty.cpp
src/quick/items/qquickflickable.cpp
src/quick/items/qquicktextedit.cpp
tests/auto/quick/qquickwindow/BLACKLIST
The extra changes in qqmlbinding.cpp are ported from changes to
qqmlproperty.cpp that occurred in parallel with writeBinding() being
moved to qqmlbinding.cpp.
Change-Id: I16d1920abf448c29a01822256f52153651a56356
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 43 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 1 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsggeometry.cpp | 10 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgnode.cpp | 2 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgrenderloop.cpp | 3 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgthreadedrenderloop.cpp | 5 | ||||
-rw-r--r-- | src/quick/scenegraph/qsgwindowsrenderloop.cpp | 6 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgsimpletexturenode.cpp | 4 |
8 files changed, 49 insertions, 25 deletions
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 6d0ed4ce9f..8632ea0b52 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -1523,6 +1523,7 @@ void Renderer::prepareOpaqueBatches() if (gni->clipList() == gnj->clipList() && gni->geometry()->drawingMode() == gnj->geometry()->drawingMode() + && (gni->geometry()->drawingMode() != GL_LINES || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth()) && gni->geometry()->attributes() == gnj->geometry()->attributes() && gni->inheritedOpacity() == gnj->inheritedOpacity() && gni->activeMaterial()->type() == gnj->activeMaterial()->type() @@ -1621,6 +1622,7 @@ void Renderer::prepareAlphaBatches() if (gni->clipList() == gnj->clipList() && gni->geometry()->drawingMode() == gnj->geometry()->drawingMode() + && (gni->geometry()->drawingMode() != GL_LINES || gni->geometry()->lineWidth() == gnj->geometry()->lineWidth()) && gni->geometry()->attributes() == gnj->geometry()->attributes() && gni->inheritedOpacity() == gnj->inheritedOpacity() && gni->activeMaterial()->type() == gnj->activeMaterial()->type() @@ -2283,6 +2285,7 @@ void Renderer::renderMergedBatch(const Batch *batch) m_currentMaterial = material; QSGGeometry* g = gn->geometry(); + updateLineWidth(g); char const *const *attrNames = program->attributeNames(); for (int i=0; i<batch->drawSets.size(); ++i) { const DrawSet &draw = batch->drawSets.at(i); @@ -2413,24 +2416,7 @@ void Renderer::renderUnmergedBatch(const Batch *batch) offset += a.tupleSize * size_of_type(a.type); } - if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) - glLineWidth(g->lineWidth()); -#if !defined(QT_OPENGL_ES_2) - else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) { - QOpenGLFunctions_1_0 *gl1funcs = 0; - QOpenGLFunctions_3_2_Core *gl3funcs = 0; - if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) - gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>(); - else - gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>(); - Q_ASSERT(gl1funcs || gl3funcs); - if (gl1funcs) - gl1funcs->glPointSize(g->lineWidth()); - else - gl3funcs->glPointSize(g->lineWidth()); - } -#endif - + updateLineWidth(g); if (g->indexCount()) glDrawElements(g->drawingMode(), g->indexCount(), g->indexType(), iOffset); else @@ -2446,6 +2432,27 @@ void Renderer::renderUnmergedBatch(const Batch *batch) } } +void Renderer::updateLineWidth(QSGGeometry *g) +{ + if (g->drawingMode() == GL_LINE_STRIP || g->drawingMode() == GL_LINE_LOOP || g->drawingMode() == GL_LINES) + glLineWidth(g->lineWidth()); +#if !defined(QT_OPENGL_ES_2) + else if (!QOpenGLContext::currentContext()->isOpenGLES() && g->drawingMode() == GL_POINTS) { + QOpenGLFunctions_1_0 *gl1funcs = 0; + QOpenGLFunctions_3_2_Core *gl3funcs = 0; + if (QOpenGLContext::currentContext()->format().profile() == QSurfaceFormat::CoreProfile) + gl3funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>(); + else + gl1funcs = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_1_0>(); + Q_ASSERT(gl1funcs || gl3funcs); + if (gl1funcs) + gl1funcs->glPointSize(g->lineWidth()); + else + gl3funcs->glPointSize(g->lineWidth()); + } +#endif +} + void Renderer::renderBatches() { if (Q_UNLIKELY(debug_render())) { diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index c7b5f73688..d19fa0e17d 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -603,6 +603,7 @@ private: void nodeWasRemoved(Node *node); void nodeWasAdded(QSGNode *node, Node *shadowParent); BatchRootInfo *batchRootInfo(Node *node); + void updateLineWidth(QSGGeometry *g); inline Batch *newBatch(); void invalidateAndRecycleBatch(Batch *b); diff --git a/src/quick/scenegraph/coreapi/qsggeometry.cpp b/src/quick/scenegraph/coreapi/qsggeometry.cpp index 3f54e13c52..1fd37be84a 100644 --- a/src/quick/scenegraph/coreapi/qsggeometry.cpp +++ b/src/quick/scenegraph/coreapi/qsggeometry.cpp @@ -522,7 +522,8 @@ void QSGGeometry::setDrawingMode(GLenum mode) /*! Gets the current line or point width or to be used for this geometry. This property only applies to line width when the drawingMode is \c GL_LINES, \c GL_LINE_STRIP, or - \c GL_LINE_LOOP, and only applies to point size when the drawingMode is \c GL_POINTS. + \c GL_LINE_LOOP. For desktop OpenGL, it also applies to point size when the drawingMode + is \c GL_POINTS. The default value is \c 1.0 @@ -536,7 +537,12 @@ float QSGGeometry::lineWidth() const /*! Sets the line or point width to be used for this geometry to \a width. This property only applies to line width when the drawingMode is \c GL_LINES, \c GL_LINE_STRIP, or - \c GL_LINE_LOOP, and only applies to point size when the drawingMode is \c GL_POINTS. + \c GL_LINE_LOOP. For Desktop OpenGL, it also applies to point size when the drawingMode + is \c GL_POINTS. + + \note How line width and point size are treated is implementation dependent: The application + should not rely on these, but rather create triangles or similar to draw areas. On OpenGL ES, + line width support is limited and point size is unsupported. \sa lineWidth(), drawingMode() */ diff --git a/src/quick/scenegraph/coreapi/qsgnode.cpp b/src/quick/scenegraph/coreapi/qsgnode.cpp index 71f4f62db9..51f3976ed9 100644 --- a/src/quick/scenegraph/coreapi/qsgnode.cpp +++ b/src/quick/scenegraph/coreapi/qsgnode.cpp @@ -806,7 +806,7 @@ void QSGBasicGeometryNode::setGeometry(QSGGeometry *geometry) the vertices and their structure, to be drawn. The Material defines how the shape is filled. - The following is a code snipped illustrating how to create a red + The following is a code snippet illustrating how to create a red line using a QSGGeometryNode: \code QSGGeometry *geometry = new QSGGeometry(QSGGeometry::defaultAttributes_Point2D(), 2); diff --git a/src/quick/scenegraph/qsgrenderloop.cpp b/src/quick/scenegraph/qsgrenderloop.cpp index 6c7fb89b6f..3059b750f2 100644 --- a/src/quick/scenegraph/qsgrenderloop.cpp +++ b/src/quick/scenegraph/qsgrenderloop.cpp @@ -34,6 +34,7 @@ #include "qsgrenderloop_p.h" #include "qsgthreadedrenderloop_p.h" #include "qsgwindowsrenderloop_p.h" +#include <private/qquickanimatorcontroller_p.h> #include <QtCore/QCoreApplication> #include <QtCore/QTime> @@ -321,6 +322,8 @@ void QSGGuiThreadRenderLoop::windowDestroyed(QQuickWindow *window) } else if (gl && window == gl->surface() && current) { gl->doneCurrent(); } + + delete d->animationController; } void QSGGuiThreadRenderLoop::renderWindow(QQuickWindow *window) diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index 9a7407b421..4b78fefa99 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -477,11 +477,12 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- cleanup without an OpenGL context"; } + QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window); + QQuickShaderEffectMaterial::cleanupMaterialCache(); // The canvas nodes must be cleaned up regardless if we are in the destructor.. if (wipeSG) { - QQuickWindowPrivate *dd = QQuickWindowPrivate::get(window); dd->cleanupNodesOnShutdown(); } else { qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- persistent SG, avoiding cleanup"; @@ -493,6 +494,8 @@ void QSGRenderThread::invalidateOpenGL(QQuickWindow *window, bool inDestructor, sgrc->invalidate(); QCoreApplication::processEvents(); QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + if (inDestructor) + delete dd->animationController; if (current) gl->doneCurrent(); qCDebug(QSG_LOG_RENDERLOOP) << QSG_RT_PAD << "- invalidating scene graph"; diff --git a/src/quick/scenegraph/qsgwindowsrenderloop.cpp b/src/quick/scenegraph/qsgwindowsrenderloop.cpp index c571e60018..7fd9651618 100644 --- a/src/quick/scenegraph/qsgwindowsrenderloop.cpp +++ b/src/quick/scenegraph/qsgwindowsrenderloop.cpp @@ -32,7 +32,6 @@ ****************************************************************************/ #include "qsgwindowsrenderloop_p.h" - #include <QtCore/QCoreApplication> #include <QtCore/QLibraryInfo> #include <QtCore/QThread> @@ -47,8 +46,8 @@ #include <QtQuick/QQuickWindow> #include <private/qquickprofiler_p.h> - #include <private/qquickshadereffectnode_p.h> +#include <private/qquickanimatorcontroller_p.h> QT_BEGIN_NAMESPACE @@ -219,6 +218,7 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) hide(window); QQuickWindowPrivate *d = QQuickWindowPrivate::get(window); + bool current = false; QScopedPointer<QOffscreenSurface> offscreenSurface; if (m_gl) { @@ -245,6 +245,8 @@ void QSGWindowsRenderLoop::windowDestroyed(QQuickWindow *window) } else if (m_gl && current) { m_gl->doneCurrent(); } + + delete d->animationController; } bool QSGWindowsRenderLoop::anyoneShowing() const diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp index 8d38e83029..d9f3c44374 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp @@ -223,9 +223,11 @@ QRectF QSGSimpleTextureNode::sourceRect() const void QSGSimpleTextureNode::setTexture(QSGTexture *texture) { Q_ASSERT(texture); + Q_D(QSGSimpleTextureNode); + if (d->ownsTexture) + delete m_material.texture(); m_material.setTexture(texture); m_opaque_material.setTexture(texture); - Q_D(QSGSimpleTextureNode); qsgsimpletexturenode_update(&m_geometry, texture, m_rect, d->sourceRect, d->texCoordMode); DirtyState dirty = DirtyMaterial; |