From 8ecc00ff54d987ddd8cfbd45a9f2a5bfe18aad80 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Mon, 25 Nov 2019 13:15:29 +0100 Subject: Fix NativeRendering text on core profile This is a continuation of af090d8, making sure the same dpr snapping is done in the core profile shaders. Change-Id: Iccd19a377968fb7bfbd49c3ef13b72284a48bab1 Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/shaders/outlinedtext_core.vert | 2 +- src/quick/scenegraph/shaders/styledtext_core.vert | 2 +- src/quick/scenegraph/shaders/textmask_core.vert | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/scenegraph/shaders/outlinedtext_core.vert b/src/quick/scenegraph/shaders/outlinedtext_core.vert index ae945b013a..a854355460 100644 --- a/src/quick/scenegraph/shaders/outlinedtext_core.vert +++ b/src/quick/scenegraph/shaders/outlinedtext_core.vert @@ -21,6 +21,6 @@ void main() sCoordDown = (tCoord - vec2(0.0, 1.0)) * textureScale; sCoordLeft = (tCoord - vec2(-1.0, 0.0)) * textureScale; sCoordRight = (tCoord - vec2(1.0, 0.0)) * textureScale; - vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } \ No newline at end of file diff --git a/src/quick/scenegraph/shaders/styledtext_core.vert b/src/quick/scenegraph/shaders/styledtext_core.vert index 7e313eb797..04a0e88da8 100644 --- a/src/quick/scenegraph/shaders/styledtext_core.vert +++ b/src/quick/scenegraph/shaders/styledtext_core.vert @@ -15,6 +15,6 @@ void main() { sampleCoord = tCoord * textureScale; shiftedSampleCoord = (tCoord - shift) * textureScale; - vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } diff --git a/src/quick/scenegraph/shaders/textmask_core.vert b/src/quick/scenegraph/shaders/textmask_core.vert index 5c510a2d23..b0efc1e731 100644 --- a/src/quick/scenegraph/shaders/textmask_core.vert +++ b/src/quick/scenegraph/shaders/textmask_core.vert @@ -12,6 +12,6 @@ uniform float dpr; void main() { sampleCoord = tCoord * textureScale; - vec3 dprSnapPos = round(vCoord.xyz * dpr + 0.5) / dpr; + vec3 dprSnapPos = floor(vCoord.xyz * dpr + 0.5) / dpr; gl_Position = matrix * vec4(dprSnapPos, vCoord.w); } -- cgit v1.2.3 From b3de744dba87fd8d5c2bdb9ed4c56a3e5455188b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 18 Nov 2019 16:32:25 +0100 Subject: mouseDrag(): ensure that intermediate moves are done for all drags The code checking if the intermediate move distance was less than the drag threshold, but without accounting for negative distances. Since the negative distances were naturally less than the drag threshold, the intermediate distances were set to zero and the intermediate moves were never done. In practice, this means that mouseDrag() never did intermediate moves (i.e. what happens during a drag in real life) for drags that go from right to left or upwards. Task-number: QTBUG-80152 Change-Id: Ic27021f5ce5ba2937e95fb2dfb532bd2136f4205 Reviewed-by: Richard Moe Gustavsen (cherry picked from commit fad8ef3e4133538e3785d7067c35c652bc894711) Reviewed-by: Jani Heikkinen --- src/imports/testlib/TestCase.qml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index fff375b49a..20c5ce6418 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -1417,12 +1417,12 @@ Item { // Divide dx and dy to have intermediate mouseMove while dragging // Fractions of dx/dy need be superior to the dragThreshold // to make the drag works though - var ddx = Math.round(dx/3) - if (ddx < (util.dragThreshold + 1)) - ddx = 0 - var ddy = Math.round(dy/3) - if (ddy < (util.dragThreshold + 1)) - ddy = 0 + var intermediateDx = Math.round(dx/3) + if (Math.abs(intermediateDx) < (util.dragThreshold + 1)) + intermediateDx = 0 + var intermediateDy = Math.round(dy/3) + if (Math.abs(intermediateDy) < (util.dragThreshold + 1)) + intermediateDy = 0 mousePress(item, x, y, button, modifiers, delay) @@ -1431,9 +1431,9 @@ Item { var dragTriggerXDistance = dx > 0 ? (util.dragThreshold + 1) : 0 var dragTriggerYDistance = dy > 0 ? (util.dragThreshold + 1) : 0 mouseMove(item, x + dragTriggerXDistance, y + dragTriggerYDistance, moveDelay, button) - if (ddx > 0 || ddy > 0) { - mouseMove(item, x + ddx, y + ddy, moveDelay, button) - mouseMove(item, x + 2*ddx, y + 2*ddy, moveDelay, button) + if (intermediateDx !== 0 || intermediateDy !== 0) { + mouseMove(item, x + intermediateDx, y + intermediateDy, moveDelay, button) + mouseMove(item, x + 2*intermediateDx, y + 2*intermediateDy, moveDelay, button) } mouseMove(item, x + dx, y + dy, moveDelay, button) mouseRelease(item, x + dx, y + dy, button, modifiers, delay) -- cgit v1.2.3 From 75c7f093e0b8e321306ae1189b71866a9073df00 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Mon, 21 Oct 2019 09:27:57 +0200 Subject: QML: Resolve conflict in ImportSpecifier rule IdentifierReference could resolve to both ImpordBinding and IdentifierName, causing ambiguity in the grammar, and ultimately caused parse failues when parsing an import statement. This is now resolved by explicitly telling the parser to prefer shifting. This is a partial cherry-pick. Apparently the effect observed in the original change and fixed inline can also be triggered in different ways. (cherry-picked from commit 41bbf7e376d0e374dc7c4e2a5ed4157a1b880b4a) Fixes: QTBUG-80423 Change-Id: Iaec29c452b577312248a17cb48f005f4fc0bd8c4 Reviewed-by: Fabian Kosmale --- src/qml/parser/qqmljs.g | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/parser/qqmljs.g b/src/qml/parser/qqmljs.g index 8ac7633ae0..0d9507fe2f 100644 --- a/src/qml/parser/qqmljs.g +++ b/src/qml/parser/qqmljs.g @@ -122,6 +122,7 @@ --%left T_PLUS T_MINUS %nonassoc T_IDENTIFIER T_COLON T_SIGNAL T_PROPERTY T_READONLY T_ON T_SET T_GET T_OF T_STATIC T_FROM T_AS %nonassoc REDUCE_HERE +%right T_WITHOUTAS T_AS %start TopLevel @@ -4390,7 +4391,10 @@ ImportsList: ImportsList T_COMMA ImportSpecifier; } break; ./ -ImportSpecifier: ImportedBinding; +-- When enconutering an IdentifierReference it can resolve to both ImportedBinding and IdentifierName +-- Using %right and %prec, we tell qlalr that it should not reduce immediately, but rather shift +-- so that we have a chance of actually parsing the correct rule if there is an "as" identifier +ImportSpecifier: ImportedBinding %prec T_WITHOUTAS; /. case $rule_number: { auto importSpecifier = new (pool) AST::ImportSpecifier(stringRef(1)); -- cgit v1.2.3 From 290251541e615358dcc7a289ff2adb30f309c132 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Tue, 3 Dec 2019 16:23:24 +0100 Subject: QQuickPixmapCache: Don't dereference nullptr Consistently check that job->data is not null before derefencing it. Fixes: QTBUG-80510 Fixes: QTBUG-79937 Change-Id: I894503ddd2254814463073cc12f8365641efc689 Reviewed-by: Ulf Hermann Reviewed-by: Shawn Rutledge --- src/quick/util/qquickpixmapcache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 56ad8ebf0b..e1b30f2b2c 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -567,9 +567,10 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) QBuffer buff(&all); buff.open(QIODevice::ReadOnly); int frameCount; - if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, &frameCount, job->requestSize, job->providerOptions, nullptr, job->data->frame)) + int const frame = job->data ? job->data->frame : 0; + if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, &frameCount, job->requestSize, job->providerOptions, nullptr, frame)) error = QQuickPixmapReply::Decoding; - else + else if (job->data) job->data->frameCount = frameCount; } // send completion event to the QQuickPixmapReply @@ -882,7 +883,8 @@ void QQuickPixmapReader::processJob(QQuickPixmapReply *runningJob, const QUrl &u return; } else { int frameCount; - if (!readImage(url, &f, &image, &errorStr, &readSize, &frameCount, runningJob->requestSize, runningJob->providerOptions, nullptr, runningJob->data->frame)) { + int const frame = runningJob->data ? runningJob->data->frame : 0; + if ( !readImage(url, &f, &image, &errorStr, &readSize, &frameCount, runningJob->requestSize, runningJob->providerOptions, nullptr, frame)) { errorCode = QQuickPixmapReply::Loading; if (f.fileName() != localFile) errorStr += QString::fromLatin1(" (%1)").arg(f.fileName()); -- cgit v1.2.3 From f1bb9053896549ee74bb7301e7ae5ab28786d155 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 11 Dec 2019 11:34:26 +0100 Subject: Fix unused var in no-opengl builds Change-Id: I9c436f408562faaf74e2301ae93e25a0c4e9b22e Fixes: QTBUG-80692 Reviewed-by: Johan Helsing --- src/quick/scenegraph/qsgrhisupport.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 12c6742342..62806236b6 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -485,6 +485,8 @@ QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurf rhiParams.window = window; rhi = QRhi::create(backend, &rhiParams, flags); } +#else + Q_UNUSED(offscreenSurface); #endif #if QT_CONFIG(vulkan) if (backend == QRhi::Vulkan) { -- cgit v1.2.3 From d9fe0f3667e940f5313dbdb94f8247125106ee0d Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 6 Dec 2019 18:43:34 +0100 Subject: qv4sequenceobject.cpp: Add "here be dragons" comment No one should remove this at() before Qt6. Task-number: QTBUG-80535 Change-Id: I464c6f675dc68ad9762fcb594bb4d6ba6bdaf316 Reviewed-by: Fabian Kosmale --- src/qml/jsruntime/qv4sequenceobject.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp index 77a98247ac..5055e13223 100644 --- a/src/qml/jsruntime/qv4sequenceobject.cpp +++ b/src/qml/jsruntime/qv4sequenceobject.cpp @@ -375,6 +375,22 @@ public: ++arrayIndex; if (attrs) *attrs = QV4::Attr_Data; + + // TODO: Replace the container->at() below with operator[] in Qt6! + // TODO: But _not_ in Qt5! + // + // gcc 5.3.1 as shipped on RHEL 7.6 includes a copy of basic_string + // into QtQml, when it sees a std::vector::at(). The basic_string symbols + // are publicly visible and preferred over the ones from libstdc++ when + // building user code. Therefore, removing this at() breaks binary + // compatibility. We _do_ want to remove it in Qt6, though. + // + // The exact mechanism is that at() checks its argument and can throw an + // out_of_range exception. The construction of this exception then triggers + // some string manipulation that uses the std::basic_string symbols. Clearly, + // this is a compiler bug. And clearly, we don't want the check as we can't + // catch the exception anyway. + if (pd) pd->value = convertElementToValue(s->engine(), s->d()->container->at(index)); return PropertyKey::fromArrayIndex(index); -- cgit v1.2.3 From 20b3979c14e6437398cf56d2e6878751a5009677 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 11 Dec 2019 14:49:26 +0100 Subject: rhi: Mark window as unused when needed This is a bit more convoluted, but boils down to no-opengl + no-vulkan. Task-number: QTBUG-80692 Change-Id: I508116721ae8ea5013546f20ac89b67929305b52 Reviewed-by: Liang Qi --- src/quick/scenegraph/qsgrhisupport.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/quick/scenegraph/qsgrhisupport.cpp b/src/quick/scenegraph/qsgrhisupport.cpp index 62806236b6..e2945879b1 100644 --- a/src/quick/scenegraph/qsgrhisupport.cpp +++ b/src/quick/scenegraph/qsgrhisupport.cpp @@ -463,6 +463,10 @@ QOffscreenSurface *QSGRhiSupport::maybeCreateOffscreenSurface(QWindow *window) // must be called on the render thread QRhi *QSGRhiSupport::createRhi(QWindow *window, QOffscreenSurface *offscreenSurface) { +#if !QT_CONFIG(opengl) && !QT_CONFIG(vulkan) + Q_UNUSED(window); +#endif + QRhi *rhi = nullptr; QRhi::Flags flags = 0; -- cgit v1.2.3 From 67417e8bc9e5fc66e6c3fc83e6b9a13694a01e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 9 Dec 2019 00:09:02 +0100 Subject: Remove use of wrapper macros for feature detection Change-Id: Ic9cd7e4ff2c5d253879b0aeaa15dbc25cad82891 Reviewed-by: Thiago Macieira --- src/3rdparty/masm/stubs/wtf/Optional.h | 2 +- src/qml/jsruntime/qv4engine.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/3rdparty/masm/stubs/wtf/Optional.h b/src/3rdparty/masm/stubs/wtf/Optional.h index 602dbc1b43..e0fd4421a9 100644 --- a/src/3rdparty/masm/stubs/wtf/Optional.h +++ b/src/3rdparty/masm/stubs/wtf/Optional.h @@ -43,7 +43,7 @@ #include #include -#if __cplusplus > 201402L && QT_HAS_INCLUDE() +#if __cplusplus > 201402L && __has_include() #include #else diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 3d3f452073..db3ca97780 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -219,7 +219,7 @@ ExecutionEngine::ExecutionEngine(QJSEngine *jsEngine) ok = false; maxCallDepth = qEnvironmentVariableIntValue("QV4_MAX_CALL_DEPTH", &ok); if (!ok || maxCallDepth <= 0) { -#if defined(QT_NO_DEBUG) && !defined(__SANITIZE_ADDRESS__) && !QT_HAS_FEATURE(address_sanitizer) +#if defined(QT_NO_DEBUG) && !defined(__SANITIZE_ADDRESS__) && !__has_feature(address_sanitizer) maxCallDepth = 1234; #else // no (tail call) optimization is done, so there'll be a lot mare stack frames active -- cgit v1.2.3