diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-24 12:49:23 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-10-24 12:49:23 +0200 |
commit | 648d4ae6a3591e916f175e32c12a2ea4f8edb6a9 (patch) | |
tree | ecd3aaedd0022bc2df0b6bbc24e10fc21a8adb6e /src/quick | |
parent | 9443e72a92a4d1d717e931ee9149c1e3652e9f53 (diff) | |
parent | aa1760f84bd711cf56159075630fb71d38a4087b (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I06835511fa131f65470bd9b177cdce75f51b385a
Diffstat (limited to 'src/quick')
23 files changed, 130 insertions, 154 deletions
diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index e3b2f4640d..fce7c05e00 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -36,7 +36,7 @@ interfaces and applications with QML. This page lists every QML type provided by this module, organized according to category and purpose. -\section1 Importing \c QtQuick +\section1 Importing Qt Quick The types provided by the \l {Qt Quick} module are only available in a QML document if that document imports the \c QtQuick namespace. @@ -1058,3 +1058,17 @@ console.log(c + " " + d); // false true \sa {QML Basic Types} */ + +/*! +\qmlmodule QtTest 1.0 +\title Qt Quick Test +\brief This module provides QML types to unit test your QML application + +You can import this module using the following statement: +\code +import QtTest 1.0 +\endcode + +For more information about how to use these types, see +\l{Qt Quick Test Reference Documentation}. +*/ diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index deb6aa164c..088e62d81a 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -47,7 +47,7 @@ create user interfaces. Please see \l{Qt Quick Controls} for more information. For those new to QML and Qt Quick, please see -\l{QML Application Developer Resources} +\l{QML Applications} for an introduction to writing QML applications. \section1 Important Concepts in Qt Quick @@ -74,7 +74,7 @@ When using the \c QtQuick module, you will need to know how to write QML applications using the QML language. In particular, you should have a grasp of the \l{qtquick-quickstart-basics.html}{QML Basics} and \l{qtquick-quickstart-essentials.html}{QML Essentials} from the -\l{qtquick-applicationdevelopers.html}{QML Application Developer Resources}. +\l{QML Applications}. To find out more about using the QML language, see the \l{Qt QML} module documentation. @@ -135,7 +135,7 @@ module Further information for writing QML applications: \list -\li \l{QML Application Developer Resources} +\li \l{QML Applications} - essential information for application development with QML and Qt Quick \li \l{Qt QML} - documentation for the Qt QML module, which provides the QML engine and language infrastructure diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp index 6f7cd77486..2fb6cb9f63 100644 --- a/src/quick/items/context2d/qquickcontext2d.cpp +++ b/src/quick/items/context2d/qquickcontext2d.cpp @@ -545,6 +545,9 @@ public: QQuickJSContext2DPrototype(QV4::ExecutionEngine *engine) : QV4::Object(engine) { + QV4::Scope scope(engine); + QV4::ScopedObject protectThis(scope, this); + defineDefaultProperty(QStringLiteral("quadraticCurveTo"), method_quadraticCurveTo, 0); defineDefaultProperty(QStringLiteral("restore"), method_restore, 0); defineDefaultProperty(QStringLiteral("moveTo"), method_moveTo, 0); @@ -868,6 +871,7 @@ struct QQuickJSContext2DPixelData : public QV4::Object : QV4::Object(engine) { vtbl = &static_vtbl; + flags &= ~SimpleArray; } static void destroy(QV4::Managed *that) { @@ -890,6 +894,10 @@ struct QQuickJSContext2DImageData : public QV4::Object : QV4::Object(engine) { vtbl = &static_vtbl; + pixelData = QV4::Primitive::undefinedValue(); + + QV4::Scope scope(engine); + QV4::ScopedObject protectThis(scope, this); defineAccessorProperty(QStringLiteral("width"), method_get_width, 0); defineAccessorProperty(QStringLiteral("height"), method_get_height, 0); diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index 3a32169447..846de15581 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -80,14 +80,14 @@ static const char vertexShaderCode[] = "}\n"; static const char fragmentShaderCode[] = - "uniform sampler2D texture;\n" + "uniform sampler2D _qt_texture;\n" "uniform lowp float qt_Opacity;\n" "\n" "varying highp vec4 fTexS;\n" "varying lowp float progress;\n" "\n" "void main() {\n" - " gl_FragColor = mix(texture2D(texture, fTexS.xy), texture2D(texture, fTexS.zw), progress) * qt_Opacity;\n" + " gl_FragColor = mix(texture2D(_qt_texture, fTexS.xy), texture2D(_qt_texture, fTexS.zw), progress) * qt_Opacity;\n" "}\n"; class QQuickAnimatedSpriteMaterial : public QSGMaterial diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 3cbcf1937f..9fc9752707 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -560,10 +560,14 @@ QSGNode *QQuickBorderImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat QSGImageNode *node = static_cast<QSGImageNode *>(oldNode); - if (!node) + bool updatePixmap = d->pixmapChanged; + if (!node) { node = d->sceneGraphContext()->createImageNode(); + updatePixmap = true; + } - node->setTexture(texture); + if (updatePixmap) + node->setTexture(texture); // Don't implicitly create the scalegrid in the rendering thread... QRectF innerSourceRect(0, 0, 1, 1); diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index b94d8dd4b0..f0a68b184a 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -948,16 +948,15 @@ void QQuickFlickable::setPixelAligned(bool align) qint64 QQuickFlickablePrivate::computeCurrentTime(QInputEvent *event) { - if (0 != event->timestamp() && QQuickItemPrivate::consistentTime == -1) + if (0 != event->timestamp()) return event->timestamp(); - - return QQuickItemPrivate::elapsed(timer); + return timer.elapsed(); } void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) { Q_Q(QQuickFlickable); - QQuickItemPrivate::start(timer); + timer.start(); if (interactive && timeline.isActive() && ((qAbs(hData.smoothVelocity.value()) > RetainGrabVelocity && !hData.fixingUp && !hData.inOvershoot) || (qAbs(vData.smoothVelocity.value()) > RetainGrabVelocity && !vData.fixingUp && !vData.inOvershoot))) { @@ -1016,8 +1015,8 @@ void QQuickFlickablePrivate::handleMousePressEvent(QMouseEvent *event) if (wasFlicking) emit q->flickingChanged(); lastPosTime = lastPressTime = computeCurrentTime(event); - QQuickItemPrivate::start(vData.velocityTime); - QQuickItemPrivate::start(hData.velocityTime); + vData.velocityTime.start(); + hData.velocityTime.start(); } void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event) @@ -1466,7 +1465,7 @@ void QQuickFlickablePrivate::viewportAxisMoved(AxisData &data, qreal minExtent, QQuickTimeLineCallback::Callback fixupCallback) { if (pressed || calcVelocity) { - int elapsed = QQuickItemPrivate::restart(data.velocityTime); + int elapsed = data.velocityTime.restart(); if (elapsed > 0) { qreal velocity = (data.lastPos - data.move.value()) * 1000 / elapsed; if (qAbs(velocity) > 0) { diff --git a/src/quick/items/qquickimage.cpp b/src/quick/items/qquickimage.cpp index 3a8fd99a66..d6be13f3c0 100644 --- a/src/quick/items/qquickimage.cpp +++ b/src/quick/items/qquickimage.cpp @@ -666,7 +666,6 @@ QSGNode *QQuickImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) if (d->pixmapChanged) { // force update the texture in the node to trigger reconstruction of // geometry and the likes when a atlas segment has changed. - node->setTexture(0); if (texture->isAtlasTexture() && (hWrap == QSGTexture::Repeat || vWrap == QSGTexture::Repeat)) node->setTexture(texture->removedFromAtlas()); else diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 73bca67a1e..c3b221b2c8 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -7030,58 +7030,6 @@ QDebug operator<<(QDebug debug, QQuickItem *item) } #endif -qint64 QQuickItemPrivate::consistentTime = -1; -void QQuickItemPrivate::setConsistentTime(qint64 t) -{ - consistentTime = t; -} - -class QElapsedTimerConsistentTimeHack -{ -public: - void start() { - t1 = QQuickItemPrivate::consistentTime; - t2 = 0; - } - qint64 elapsed() { - return QQuickItemPrivate::consistentTime - t1; - } - qint64 restart() { - qint64 val = QQuickItemPrivate::consistentTime - t1; - t1 = QQuickItemPrivate::consistentTime; - t2 = 0; - return val; - } - -private: - qint64 t1; - qint64 t2; -}; - -void QQuickItemPrivate::start(QElapsedTimer &t) -{ - if (QQuickItemPrivate::consistentTime == -1) - t.start(); - else - ((QElapsedTimerConsistentTimeHack*)&t)->start(); -} - -qint64 QQuickItemPrivate::elapsed(QElapsedTimer &t) -{ - if (QQuickItemPrivate::consistentTime == -1) - return t.elapsed(); - else - return ((QElapsedTimerConsistentTimeHack*)&t)->elapsed(); -} - -qint64 QQuickItemPrivate::restart(QElapsedTimer &t) -{ - if (QQuickItemPrivate::consistentTime == -1) - return t.restart(); - else - return ((QElapsedTimerConsistentTimeHack*)&t)->restart(); -} - /*! \fn bool QQuickItem::isTextureProvider() const diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h index b1e63e6535..f731acabbb 100644 --- a/src/quick/items/qquickitem_p.h +++ b/src/quick/items/qquickitem_p.h @@ -587,12 +587,6 @@ public: virtual void mirrorChange() {} - static qint64 consistentTime; - static void setConsistentTime(qint64 t); - static void start(QElapsedTimer &); - static qint64 elapsed(QElapsedTimer &); - static qint64 restart(QElapsedTimer &); - void incrementCursorCount(int delta); }; diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index ff31d9de4e..d8132bdd12 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -1568,11 +1568,9 @@ qreal QQuickPathViewPrivate::calcVelocity() const qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event) { - if (0 != event->timestamp() && QQuickItemPrivate::consistentTime == -1) { + if (0 != event->timestamp()) return event->timestamp(); - } - - return QQuickItemPrivate::elapsed(timer); + return timer.elapsed(); } void QQuickPathView::mousePressEvent(QMouseEvent *event) @@ -1613,7 +1611,7 @@ void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event) else stealMouse = false; - QQuickItemPrivate::start(timer); + timer.start(); lastPosTime = computeCurrentTime(event); tl.clear(); } diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index fc2b9772d7..c72c2276e0 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -1288,7 +1288,7 @@ Qt::LayoutDirection QQuickGrid::effectiveLayoutDirection() const } /*! - \qmlproperty enumeration QtQuick::Grid::horizontalItmeAlignment + \qmlproperty enumeration QtQuick::Grid::horizontalItemAlignment \qmlproperty enumeration QtQuick::Grid::verticalItemAlignment \qmlproperty enumeration QtQuick::Grid::effectiveHorizontalItemAlignment diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index 3b2b3269e2..3c1492e0b3 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -79,14 +79,14 @@ static const char vertexShaderCode[] = "}\n"; static const char fragmentShaderCode[] = - "uniform sampler2D texture;\n" + "uniform sampler2D _qt_texture;\n" "uniform lowp float qt_Opacity;\n" "\n" "varying highp vec4 fTexS;\n" "varying lowp float progress;\n" "\n" "void main() {\n" - " gl_FragColor = mix(texture2D(texture, fTexS.xy), texture2D(texture, fTexS.zw), progress) * qt_Opacity;\n" + " gl_FragColor = mix(texture2D(_qt_texture, fTexS.xy), texture2D(_qt_texture, fTexS.zw), progress) * qt_Opacity;\n" "}\n"; class QQuickSpriteSequenceMaterial : public QSGMaterial diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index e178a3ea45..5216fca355 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -172,6 +172,8 @@ void QQmlQtQuick2DebugStatesDelegate::resetBindingForInvalidProperty(QObject *ob void QQmlQtQuick2Module::defineModule() { + QQuick_initializeProviders(); + QQuickUtilModule::defineModule(); QQmlEnginePrivate::defineQtQuick2Module(); QQuickItemsModule::defineModule(); diff --git a/src/quick/qtquickglobal_p.h b/src/quick/qtquickglobal_p.h index 8cbd0b9782..f67a08c218 100644 --- a/src/quick/qtquickglobal_p.h +++ b/src/quick/qtquickglobal_p.h @@ -57,4 +57,10 @@ #define Q_QUICK_PRIVATE_EXPORT Q_QUICK_EXPORT +QT_BEGIN_NAMESPACE + +void QQuick_initializeProviders(); + +QT_END_NAMESPACE + #endif // QTQUICKGLOBAL_P_H diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index caa0d032a4..bb8e3c4b36 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -408,7 +408,11 @@ QSGDistanceFieldGlyphCache *QSGContext::distanceFieldGlyphCache(const QRawFont & QSGGlyphNode *QSGContext::createNativeGlyphNode() { #if defined(QT_OPENGL_ES) && !defined(QT_OPENGL_ES_2_ANGLE) - return createGlyphNode(); + Q_D(QSGContext); + if (d->distanceFieldDisabled) + return new QSGDefaultGlyphNode; + else + return createGlyphNode(); #else return new QSGDefaultGlyphNode; #endif diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp index 50009d7709..39d9832f58 100644 --- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp @@ -101,10 +101,10 @@ const char *QSGTextMaskShader::vertexShader() const { const char *QSGTextMaskShader::fragmentShader() const { return "varying highp vec2 sampleCoord; \n" - "uniform sampler2D texture; \n" + "uniform sampler2D _qt_texture; \n" "uniform lowp vec4 color; \n" "void main() { \n" - " lowp vec4 glyph = texture2D(texture, sampleCoord); \n" + " lowp vec4 glyph = texture2D(_qt_texture, sampleCoord); \n" " gl_FragColor = vec4(glyph.rgb * color.a, glyph.a); \n" "}"; } @@ -389,14 +389,14 @@ const char *QSGStyledTextShader::fragmentShader() const return "varying highp vec2 sampleCoord; \n" "varying highp vec2 shiftedSampleCoord; \n" - "uniform sampler2D texture; \n" + "uniform sampler2D _qt_texture; \n" "uniform lowp vec4 color; \n" "uniform lowp vec4 styleColor; \n" - "void main() { \n" - " lowp float glyph = texture2D(texture, sampleCoord).a; \n" - " lowp float style = clamp(texture2D(texture, shiftedSampleCoord).a - glyph, \n" - " 0.0, 1.0); \n" - " gl_FragColor = style * styleColor + glyph * color; \n" + "void main() { \n" + " lowp float glyph = texture2D(_qt_texture, sampleCoord).a; \n" + " lowp float style = clamp(texture2D(_qt_texture, shiftedSampleCoord).a - glyph, \n" + " 0.0, 1.0); \n" + " gl_FragColor = style * styleColor + glyph * color; \n" "}"; } @@ -444,18 +444,18 @@ const char *QSGOutlinedTextShader::fragmentShader() const "varying highp vec2 sCoordDown; \n" "varying highp vec2 sCoordLeft; \n" "varying highp vec2 sCoordRight; \n" - "uniform sampler2D texture; \n" + "uniform sampler2D _qt_texture; \n" "uniform lowp vec4 color; \n" "uniform lowp vec4 styleColor; \n" - "void main() { \n" - "lowp float glyph = texture2D(texture, sampleCoord).a; \n" - " lowp float outline = clamp(clamp(texture2D(texture, sCoordUp).a + \n" - " texture2D(texture, sCoordDown).a + \n" - " texture2D(texture, sCoordLeft).a + \n" - " texture2D(texture, sCoordRight).a, \n" - " 0.0, 1.0) - glyph, \n" - " 0.0, 1.0); \n" - " gl_FragColor = outline * styleColor + glyph * color; \n" + "void main() { \n" + "lowp float glyph = texture2D(_qt_texture, sampleCoord).a; \n" + " lowp float outline = clamp(clamp(texture2D(_qt_texture, sCoordUp).a + \n" + " texture2D(_qt_texture, sCoordDown).a + \n" + " texture2D(_qt_texture, sCoordLeft).a + \n" + " texture2D(_qt_texture, sCoordRight).a, \n" + " 0.0, 1.0) - glyph, \n" + " 0.0, 1.0); \n" + " gl_FragColor = outline * styleColor + glyph * color; \n" "}"; } diff --git a/src/quick/scenegraph/qsgdefaultimagenode.cpp b/src/quick/scenegraph/qsgdefaultimagenode.cpp index 349a92ac7f..11d0e5dbeb 100644 --- a/src/quick/scenegraph/qsgdefaultimagenode.cpp +++ b/src/quick/scenegraph/qsgdefaultimagenode.cpp @@ -298,15 +298,13 @@ void QSGDefaultImageNode::setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) void QSGDefaultImageNode::setTexture(QSGTexture *texture) { - if (texture == m_material.texture()) - return; + Q_ASSERT(texture); m_material.setTexture(texture); m_materialO.setTexture(texture); m_smoothMaterial.setTexture(texture); - // Texture cleanup - if (texture) - m_material.setFlag(QSGMaterial::Blending, texture->hasAlphaChannel()); + m_material.setFlag(QSGMaterial::Blending, texture->hasAlphaChannel()); + markDirty(DirtyMaterial); // Because the texture can be a different part of the atlas, we need to update it... diff --git a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp index 0cf7abed2e..125243847a 100644 --- a/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp +++ b/src/quick/scenegraph/qsgdistancefieldglyphnode_p.cpp @@ -96,15 +96,15 @@ const char *QSGDistanceFieldTextMaterialShader::vertexShader() const { const char *QSGDistanceFieldTextMaterialShader::fragmentShader() const { return - "varying highp vec2 sampleCoord; \n" - "uniform mediump sampler2D texture; \n" - "uniform lowp vec4 color; \n" - "uniform mediump float alphaMin; \n" - "uniform mediump float alphaMax; \n" - "void main() { \n" - " gl_FragColor = color * smoothstep(alphaMin, \n" - " alphaMax, \n" - " texture2D(texture, sampleCoord).a); \n" + "varying highp vec2 sampleCoord; \n" + "uniform mediump sampler2D _qt_texture; \n" + "uniform lowp vec4 color; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" + "void main() { \n" + " gl_FragColor = color * smoothstep(alphaMin, \n" + " alphaMax, \n" + " texture2D(_qt_texture, sampleCoord).a); \n" "}"; } @@ -366,7 +366,7 @@ protected: const char *DistanceFieldOutlineTextMaterialShader::fragmentShader() const { return "varying highp vec2 sampleCoord; \n" - "uniform sampler2D texture; \n" + "uniform sampler2D _qt_texture; \n" "uniform lowp vec4 color; \n" "uniform lowp vec4 styleColor; \n" "uniform mediump float alphaMin; \n" @@ -374,7 +374,7 @@ const char *DistanceFieldOutlineTextMaterialShader::fragmentShader() const { "uniform mediump float outlineAlphaMax0; \n" "uniform mediump float outlineAlphaMax1; \n" "void main() { \n" - " mediump float d = texture2D(texture, sampleCoord).a; \n" + " mediump float d = texture2D(_qt_texture, sampleCoord).a; \n" " gl_FragColor = mix(styleColor, color, smoothstep(alphaMin, alphaMax, d)) \n" " * smoothstep(outlineAlphaMax0, outlineAlphaMax1, d); \n" "}"; @@ -514,19 +514,19 @@ const char *DistanceFieldShiftedStyleTextMaterialShader::vertexShader() const const char *DistanceFieldShiftedStyleTextMaterialShader::fragmentShader() const { return - "varying highp vec2 sampleCoord; \n" - "varying highp vec2 shiftedSampleCoord; \n" - "uniform sampler2D texture; \n" - "uniform lowp vec4 color; \n" - "uniform lowp vec4 styleColor; \n" - "uniform mediump float alphaMin; \n" - "uniform mediump float alphaMax; \n" - "void main() { \n" - " highp float a = smoothstep(alphaMin, alphaMax, texture2D(texture, sampleCoord).a);\n" - " highp vec4 shifted = styleColor * smoothstep(alphaMin, \n" - " alphaMax, \n" - " texture2D(texture, shiftedSampleCoord).a); \n" - " gl_FragColor = mix(shifted, color, a); \n" + "varying highp vec2 sampleCoord; \n" + "varying highp vec2 shiftedSampleCoord; \n" + "uniform sampler2D _qt_texture; \n" + "uniform lowp vec4 color; \n" + "uniform lowp vec4 styleColor; \n" + "uniform mediump float alphaMin; \n" + "uniform mediump float alphaMax; \n" + "void main() { \n" + " highp float a = smoothstep(alphaMin, alphaMax, texture2D(_qt_texture, sampleCoord).a); \n" + " highp vec4 shifted = styleColor * smoothstep(alphaMin, \n" + " alphaMax, \n" + " texture2D(_qt_texture, shiftedSampleCoord).a); \n" + " gl_FragColor = mix(shifted, color, a); \n" "}"; } @@ -607,17 +607,17 @@ const char *QSGHiQSubPixelDistanceFieldTextMaterialShader::fragmentShader() cons "varying highp vec3 sampleNearLeft; \n" "varying highp vec3 sampleNearRight; \n" "varying highp vec3 sampleFarRight; \n" - "uniform sampler2D texture; \n" + "uniform sampler2D _qt_texture; \n" "uniform lowp vec4 color; \n" "uniform mediump float alphaMin; \n" "uniform mediump float alphaMax; \n" "void main() { \n" " highp vec4 n; \n" - " n.x = texture2DProj(texture, sampleFarLeft).a; \n" - " n.y = texture2DProj(texture, sampleNearLeft).a; \n" - " highp float c = texture2D(texture, sampleCoord).a; \n" - " n.z = texture2DProj(texture, sampleNearRight).a; \n" - " n.w = texture2DProj(texture, sampleFarRight).a; \n" + " n.x = texture2DProj(_qt_texture, sampleFarLeft).a; \n" + " n.y = texture2DProj(_qt_texture, sampleNearLeft).a; \n" + " highp float c = texture2D(_qt_texture, sampleCoord).a; \n" + " n.z = texture2DProj(_qt_texture, sampleNearRight).a; \n" + " n.w = texture2DProj(_qt_texture, sampleFarRight).a; \n" #if 0 // Blurrier, faster. " n = smoothstep(alphaMin, alphaMax, n); \n" @@ -638,18 +638,18 @@ const char *QSGHiQSubPixelDistanceFieldTextMaterialShader::fragmentShader() cons // return // "#extension GL_OES_standard_derivatives: enable \n" // "varying highp vec2 sampleCoord; \n" -// "uniform sampler2D texture; \n" +// "uniform sampler2D _qt_texture; \n" // "uniform lowp vec4 color; \n" // "uniform highp float alphaMin; \n" // "uniform highp float alphaMax; \n" // "void main() { \n" // " highp vec2 delta = dFdx(sampleCoord); \n" // " highp vec4 n; \n" -// " n.x = texture2D(texture, sampleCoord - 0.667 * delta).a; \n" -// " n.y = texture2D(texture, sampleCoord - 0.333 * delta).a; \n" -// " highp float c = texture2D(texture, sampleCoord).a; \n" -// " n.z = texture2D(texture, sampleCoord + 0.333 * delta).a; \n" -// " n.w = texture2D(texture, sampleCoord + 0.667 * delta).a; \n" +// " n.x = texture2D(_qt_texture, sampleCoord - 0.667 * delta).a; \n" +// " n.y = texture2D(_qt_texture, sampleCoord - 0.333 * delta).a; \n" +// " highp float c = texture2D(_qt_texture, sampleCoord).a; \n" +// " n.z = texture2D(_qt_texture, sampleCoord + 0.333 * delta).a; \n" +// " n.w = texture2D(_qt_texture, sampleCoord + 0.667 * delta).a; \n" // " n = smoothstep(alphaMin, alphaMax, n); \n" // " c = smoothstep(alphaMin, alphaMax, c); \n" // " gl_FragColor = vec4(0.333 * (n.xyz + n.yzw + c), c) * color.w; \n" @@ -746,14 +746,14 @@ const char *QSGLoQSubPixelDistanceFieldTextMaterialShader::fragmentShader() cons return "varying highp vec3 sampleNearLeft; \n" "varying highp vec3 sampleNearRight; \n" - "uniform sampler2D texture; \n" + "uniform sampler2D _qt_texture; \n" "uniform lowp vec4 color; \n" "uniform mediump float alphaMin; \n" "uniform mediump float alphaMax; \n" "void main() { \n" " highp vec2 n; \n" - " n.x = texture2DProj(texture, sampleNearLeft).a; \n" - " n.y = texture2DProj(texture, sampleNearRight).a; \n" + " n.x = texture2DProj(_qt_texture, sampleNearLeft).a; \n" + " n.y = texture2DProj(_qt_texture, sampleNearRight).a; \n" " n = smoothstep(alphaMin, alphaMax, n); \n" " highp float c = 0.5 * (n.x + n.y); \n" " gl_FragColor = vec4(n.x, c, n.y, c) * color.w; \n" diff --git a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp index fb9eebf403..34a884348d 100644 --- a/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp +++ b/src/quick/scenegraph/qsgshareddistancefieldglyphcache.cpp @@ -531,7 +531,7 @@ void QSGSharedDistanceFieldGlyphCache::saveTexture(GLuint textureId, int width, glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); - int textureUniformLocation = glGetUniformLocation(shaderProgram, "texture"); + int textureUniformLocation = glGetUniformLocation(shaderProgram, "_qt_texture"); glUniform1i(textureUniformLocation, 0); } diff --git a/src/quick/scenegraph/qsgthreadedrenderloop.cpp b/src/quick/scenegraph/qsgthreadedrenderloop.cpp index d19c047e5a..7421db1db1 100644 --- a/src/quick/scenegraph/qsgthreadedrenderloop.cpp +++ b/src/quick/scenegraph/qsgthreadedrenderloop.cpp @@ -406,22 +406,26 @@ bool QSGRenderThread::event(QEvent *e) pendingUpdate |= SyncRequest; return true; - case WM_TryRelease: + case WM_TryRelease: { RLDEBUG1(" Render: WM_TryRelease"); mutex.lock(); + WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e); if (m_windows.size() == 0) { - WMTryReleaseEvent *wme = static_cast<WMTryReleaseEvent *>(e); RLDEBUG1(" Render: - setting exit flag and invalidating GL"); invalidateOpenGL(wme->window, wme->inDestructor); shouldExit = !gl; if (sleeping) stopEventProcessing = true; + } else if (wme->window == gl->surface()) { + RLDEBUG1(" Render: - destroying the current window. Calling doneCurrent()..."); + gl->doneCurrent(); } else { RLDEBUG1(" Render: - not releasing anything because we have active windows..."); } waitCondition.wakeOne(); mutex.unlock(); return true; + } case WM_Grab: { RLDEBUG1(" Render: WM_Grab"); diff --git a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp index 5d9946a37b..fc1d6cecbc 100644 --- a/src/quick/scenegraph/util/qsgsimpletexturenode.cpp +++ b/src/quick/scenegraph/util/qsgsimpletexturenode.cpp @@ -173,8 +173,7 @@ QRectF QSGSimpleTextureNode::rect() const */ void QSGSimpleTextureNode::setTexture(QSGTexture *texture) { - if (m_material.texture() == texture) - return; + Q_ASSERT(texture); m_material.setTexture(texture); m_opaque_material.setTexture(texture); Q_D(QSGSimpleTextureNode); diff --git a/src/quick/util/qquickglobal.cpp b/src/quick/util/qquickglobal.cpp index 7d226ed0f7..152d1f34c9 100644 --- a/src/quick/util/qquickglobal.cpp +++ b/src/quick/util/qquickglobal.cpp @@ -1025,14 +1025,11 @@ static QQuickGuiProvider *getGuiProvider() return &guiProvider; } -static bool initializeProviders() +void QQuick_initializeProviders() { QQml_addValueTypeProvider(getValueTypeProvider()); QQml_setColorProvider(getColorProvider()); QQml_setGuiProvider(getGuiProvider()); - return true; } -Q_CONSTRUCTOR_FUNCTION(initializeProviders) - QT_END_NAMESPACE diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp index b8f3ecf7d6..f2b2d2af06 100644 --- a/src/quick/util/qquickstyledtext.cpp +++ b/src/quick/util/qquickstyledtext.cpp @@ -548,6 +548,8 @@ void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textI textOut += QChar(60); else if (entity == QLatin1String("amp")) textOut += QChar(38); + else if (entity == QLatin1String("quot")) + textOut += QChar(34); return; } ++entityLength; |