From 059b10f295d8d04c4144984daf1464115bcb69c9 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Thu, 28 Jun 2018 14:55:06 +0200 Subject: [PATCH 01/12] Doc: Check before including the \snippet from a .pro file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icc7552b46a2657c81958e40f33596ddeee045172 Reviewed-by: Friedemann Kleint Reviewed-by: Topi Reiniö --- src/dbus/doc/src/qtdbus-module.qdoc | 2 ++ src/gui/doc/src/qtgui.qdoc | 5 ++++- src/network/doc/src/qtnetwork.qdoc | 3 +++ src/opengl/doc/src/qtopengl-index.qdoc | 2 ++ src/opengl/doc/src/qtopengl-module.qdoc | 2 ++ src/printsupport/doc/src/qtprintsupport-module.qdoc | 2 ++ src/sql/doc/src/qtsql.qdoc | 2 ++ src/testlib/doc/src/qttest-index.qdoc | 2 ++ src/testlib/doc/src/qttest.qdoc | 2 ++ src/testlib/doc/src/qttestlib-manual.qdoc | 2 ++ src/widgets/doc/src/qtwidgets.qdoc | 2 ++ src/xml/doc/src/qtxml-index.qdoc | 2 ++ src/xml/doc/src/qtxml.qdoc | 2 ++ 13 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/dbus/doc/src/qtdbus-module.qdoc b/src/dbus/doc/src/qtdbus-module.qdoc index 965475ab8d9..0ef5999b113 100644 --- a/src/dbus/doc/src/qtdbus-module.qdoc +++ b/src/dbus/doc/src/qtdbus-module.qdoc @@ -51,6 +51,7 @@ \snippet code/doc_src_qtdbus.cpp 0 + \if !defined(qtforpython) If you're using qmake to build your application, you can add this line to your .pro file to make it link against the Qt D-Bus libraries: @@ -60,6 +61,7 @@ \note The source code for this module is located in the \c{src/qdbus} directory. When installing Qt from source, this module is built when Qt's tools are built. + \endif See the \l {Qt D-Bus}{D-Bus} page for detailed information on how to use this module. diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index a425c8a84dd..53fd55bd394 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -46,11 +46,12 @@ \snippet code/doc_src_qtgui.pro 0 + \if !defined(qtforpython) If you use \l qmake to build your projects, \l{Qt GUI} is included by default. To disable Qt GUI, add the following line to your \c .pro file: \snippet code/doc_src_qtgui.pro 1 - + \endif */ /*! @@ -75,10 +76,12 @@ \snippet code/doc_src_qtgui.pro 0 + \if !defined(qtforpython) If you use \l qmake to build your projects, Qt GUI is included by default. To disable Qt GUI, add the following line to your \c .pro file: \snippet code/doc_src_qtgui.pro 1 + \endif \section1 Application Windows diff --git a/src/network/doc/src/qtnetwork.qdoc b/src/network/doc/src/qtnetwork.qdoc index 517e0a72cb3..c931a1c19f5 100644 --- a/src/network/doc/src/qtnetwork.qdoc +++ b/src/network/doc/src/qtnetwork.qdoc @@ -40,10 +40,13 @@ \code #include \endcode + + \if !defined(qtforpython) To link against the Qt Network module, add this line to the project file: \code QT += network \endcode + \endif \section1 Articles and Guides diff --git a/src/opengl/doc/src/qtopengl-index.qdoc b/src/opengl/doc/src/qtopengl-index.qdoc index 30b657f6db2..4694f68a93c 100644 --- a/src/opengl/doc/src/qtopengl-index.qdoc +++ b/src/opengl/doc/src/qtopengl-index.qdoc @@ -51,10 +51,12 @@ \snippet code/doc_src_qtopengl.cpp 0 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtopengl.pro 1 + \endif The Qt OpenGL module is implemented as a platform-independent Qt/C++ wrapper around the platform-dependent GLX (version 1.3 or later), diff --git a/src/opengl/doc/src/qtopengl-module.qdoc b/src/opengl/doc/src/qtopengl-module.qdoc index e9b1258266f..336d37c73fc 100644 --- a/src/opengl/doc/src/qtopengl-module.qdoc +++ b/src/opengl/doc/src/qtopengl-module.qdoc @@ -57,10 +57,12 @@ \snippet code/doc_src_qtopengl.cpp 0 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtopengl.pro 1 + \endif The Qt OpenGL module is implemented as a platform-independent Qt/C++ wrapper around the platform-dependent GLX (version 1.3 or later), diff --git a/src/printsupport/doc/src/qtprintsupport-module.qdoc b/src/printsupport/doc/src/qtprintsupport-module.qdoc index 686d16f38a5..0e851e593c4 100644 --- a/src/printsupport/doc/src/qtprintsupport-module.qdoc +++ b/src/printsupport/doc/src/qtprintsupport-module.qdoc @@ -38,8 +38,10 @@ \snippet code/doc_src_qtprintsupport.cpp 1 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtprintsupport.pro 0 + \endif */ diff --git a/src/sql/doc/src/qtsql.qdoc b/src/sql/doc/src/qtsql.qdoc index f0d74739b01..39c0e441871 100644 --- a/src/sql/doc/src/qtsql.qdoc +++ b/src/sql/doc/src/qtsql.qdoc @@ -87,10 +87,12 @@ \snippet code/doc_src_qtsql.cpp 0 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtsql.pro 1 + \endif See the \l{SQL Programming} guide for information about using this module in your applications. diff --git a/src/testlib/doc/src/qttest-index.qdoc b/src/testlib/doc/src/qttest-index.qdoc index b3c2be7375e..8c817b36531 100644 --- a/src/testlib/doc/src/qttest-index.qdoc +++ b/src/testlib/doc/src/qttest-index.qdoc @@ -41,9 +41,11 @@ \snippet code/doc_src_qttest.cpp 0 + \if !define(qtforpython) To link against Qt Test, add this line to the project file: \snippet code/doc_src_qttest.pro 1 + \endif \section1 Articles and Guides diff --git a/src/testlib/doc/src/qttest.qdoc b/src/testlib/doc/src/qttest.qdoc index 696111f2f3e..e61fd71e691 100644 --- a/src/testlib/doc/src/qttest.qdoc +++ b/src/testlib/doc/src/qttest.qdoc @@ -42,10 +42,12 @@ \snippet code/doc_src_qttest.cpp 0 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qttest.pro 1 + \endif See \l{Qt Test Overview} for an introduction on how to use Qt's unit testing features with your applications. diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 9bd210d71f3..363ec17c6c5 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -109,6 +109,7 @@ For more examples, refer to the \l{Qt Test Tutorial}. + \if !defined(qtforpython) \section1 Building a Test If you are using \c qmake as your build tool, just add the @@ -132,6 +133,7 @@ See \l {Chapter 1: Writing a Unit Test}{Writing a Unit Test} for a step by step explanation. + \endif \section1 Qt Test Command Line Arguments diff --git a/src/widgets/doc/src/qtwidgets.qdoc b/src/widgets/doc/src/qtwidgets.qdoc index e0a5b094cd2..72ba22681c0 100644 --- a/src/widgets/doc/src/qtwidgets.qdoc +++ b/src/widgets/doc/src/qtwidgets.qdoc @@ -38,9 +38,11 @@ \snippet code/doc_src_qtwidgets.cpp 1 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtwidgets.pro 0 + \endif */ diff --git a/src/xml/doc/src/qtxml-index.qdoc b/src/xml/doc/src/qtxml-index.qdoc index 91f2515d606..dfb9b45fa7c 100644 --- a/src/xml/doc/src/qtxml-index.qdoc +++ b/src/xml/doc/src/qtxml-index.qdoc @@ -38,10 +38,12 @@ \snippet code/doc_src_qtxml.cpp 0 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtxml.pro 1 + \endif The \l{Qt XML C++ Classes} page gives an overview over the available classes in this module. diff --git a/src/xml/doc/src/qtxml.qdoc b/src/xml/doc/src/qtxml.qdoc index dbad66a5071..ad9b08b623b 100644 --- a/src/xml/doc/src/qtxml.qdoc +++ b/src/xml/doc/src/qtxml.qdoc @@ -41,8 +41,10 @@ \snippet code/doc_src_qtxml.cpp 0 + \if !defined(qtforpython) To link against the module, add this line to your \l qmake \c .pro file: \snippet code/doc_src_qtxml.pro 1 + \endif */ From 7f0cc35d9c33802742aaa640472f3d9d2390ffa4 Mon Sep 17 00:00:00 2001 From: Paul Wicking Date: Fri, 20 Jul 2018 06:52:31 +0200 Subject: [PATCH 02/12] Examples: Fix minor bug in Tree Model Completer Example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor bug that caused highlighter to not work properly. Task-number: QTBUG-66084 Change-Id: I7860d7a13c402e3236f4c844020e35e11f6e53e5 Reviewed-by: Topi Reiniö --- examples/widgets/tools/treemodelcompleter/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp index 4aabb040235..a8b51c7aa09 100644 --- a/examples/widgets/tools/treemodelcompleter/mainwindow.cpp +++ b/examples/widgets/tools/treemodelcompleter/mainwindow.cpp @@ -232,7 +232,7 @@ void MainWindow::highlight(const QModelIndex &index) return; QModelIndex sourceIndex = proxy->mapToSource(index); treeView->selectionModel()->select(sourceIndex, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); - treeView->scrollTo(index); + treeView->scrollTo(sourceIndex); } //! [6] From 244c7bd193ab5e15e28108937cae4acf3d574350 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 28 Aug 2018 12:45:20 +0200 Subject: [PATCH 03/12] Avoid conversion over RGBA64 for RGB32 LCD text blending Short-cuts the case where there is no gamma correction to avoid a conversion over RGBA64 and back. Change-Id: I100697a9f7a4b94283557b2c0eaa45e0eff81785 Reviewed-by: Lars Knoll --- src/gui/painting/qdrawhelper.cpp | 58 +++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 9bb1498ff0c..b277278fe0d 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5801,6 +5801,46 @@ static inline int qRgbAvg(QRgb rgb) return (qRed(rgb) * 5 + qGreen(rgb) * 6 + qBlue(rgb) * 5) / 16; } +static inline QRgb rgbBlend(QRgb d, QRgb s, uint rgbAlpha) +{ +#if defined(__SSE2__) + __m128i vd = _mm_cvtsi32_si128(d); + __m128i vs = _mm_cvtsi32_si128(s); + __m128i va = _mm_cvtsi32_si128(rgbAlpha); + const __m128i vz = _mm_setzero_si128(); + vd = _mm_unpacklo_epi8(vd, vz); + vs = _mm_unpacklo_epi8(vs, vz); + va = _mm_unpacklo_epi8(va, vz); + __m128i vb = _mm_xor_si128(_mm_set1_epi16(255), va); + vs = _mm_mullo_epi16(vs, va); + vd = _mm_mullo_epi16(vd, vb); + vd = _mm_add_epi16(vd, vs); + vd = _mm_add_epi16(vd, _mm_srli_epi16(vd, 8)); + vd = _mm_add_epi16(vd, _mm_set1_epi16(0x80)); + vd = _mm_srli_epi16(vd, 8); + vd = _mm_packus_epi16(vd, vd); + return _mm_cvtsi128_si32(vd); +#else + const int dr = qRed(d); + const int dg = qGreen(d); + const int db = qBlue(d); + + const int sr = qRed(s); + const int sg = qGreen(s); + const int sb = qBlue(s); + + const int mr = qRed(rgbAlpha); + const int mg = qGreen(rgbAlpha); + const int mb = qBlue(rgbAlpha); + + const int nr = qt_div_255(sr * mr + dr * (255 - mr)); + const int ng = qt_div_255(sg * mg + dg * (255 - mg)); + const int nb = qt_div_255(sb * mb + db * (255 - mb)); + + return 0xff000000 | (nr << 16) | (ng << 8) | nb; +#endif +} + static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, const QRgba64 &srcLinear, const QRgba64 &src, const QColorProfile *colorProfile) { if (coverage == 0xff000000) { @@ -5823,20 +5863,20 @@ static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, co } } -static inline void alphargbblend_argb32(quint32 *dst, uint coverage, QRgba64 srcLinear, quint32 src, const QColorProfile *colorProfile) +static inline void alphargbblend_argb32(quint32 *dst, uint coverage, const QRgba64 &srcLinear, quint32 src, const QColorProfile *colorProfile) { if (coverage == 0xff000000) { // nothing } else if (coverage == 0xffffffff) { *dst = src; - } else { - if (*dst >= 0xff000000) { - rgbBlendPixel(dst, coverage, srcLinear, colorProfile); - } else { - // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571 - const int a = qRgbAvg(coverage); - *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a); - } + } else if (*dst < 0xff000000) { + // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571 + const int a = qRgbAvg(coverage); + *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a); + } else if (!colorProfile) { + *dst = rgbBlend(*dst, src, coverage); + } else { + rgbBlendPixel(dst, coverage, srcLinear, colorProfile); } } From a381ba4220097bd7a982a86f32c7e65da5591c8c Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 19 Jul 2018 17:43:19 +0200 Subject: [PATCH 04/12] Document version number of pixman The files match the ones in pixman 0.17.12 Task-number: QTBUG-69276 Change-Id: Idd03c6979456ad2cf4dcc2aee6986ebc95140937 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/pixman/qt_attribution.json | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/pixman/qt_attribution.json b/src/3rdparty/pixman/qt_attribution.json index 607bda754db..1268b2e22f4 100644 --- a/src/3rdparty/pixman/qt_attribution.json +++ b/src/3rdparty/pixman/qt_attribution.json @@ -6,6 +6,7 @@ "Description": "pixman is a library that provides low-level pixel manipulation features such as image compositing and trapezoid rasterization.", "Homepage": "http://www.pixman.org/", + "Version": "0.17.12", "License": "MIT License", "LicenseFile": "LICENSE", "LicenseId": "MIT", From ff2a71e310b18a43a41daf2d197f5715f7c26d29 Mon Sep 17 00:00:00 2001 From: Venugopal Shivashankar Date: Tue, 24 Jul 2018 15:29:16 +0200 Subject: [PATCH 05/12] Doc: Move the literal code blocks to a separate file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's easier to override the code blocks this way. Change-Id: I98d40626a94fdb70a95c50332c2da141e9277070 Reviewed-by: Friedemann Kleint Reviewed-by: Topi Reiniö --- .../code/src_corelib_tools_qeasingcurve.cpp | 15 +++++++++++++-- src/corelib/tools/qeasingcurve.cpp | 17 ++++------------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp index 0485bd290aa..97453e2b06c 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qeasingcurve.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -49,6 +49,17 @@ ****************************************************************************/ //! [0] -qreal myEasingFunction(qreal progress); + QEasingCurve easing(QEasingCurve::InOutQuad); + + for (qreal t = 0.0; t < 1.0; t+=0.1) + qWarning() << "Effective progress" << t << " is + << easing.valueForProgress(t); //! [0] +//! [1] + QPropertyAnimation animation; + animation.setStartValue(0); + animation.setEndValue(1000); + animation.setDuration(1000); + animation.setEasingCurve(QEasingCurve::InOutQuad); +//! [1] diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index e66db58ed76..235ca625c18 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -72,24 +72,15 @@ curve is a linear curve. This is the default behaviour. For example, - \code - QEasingCurve easing(QEasingCurve::InOutQuad); - for(qreal t = 0.0; t < 1.0; t+=0.1) - qWarning() << "Effective progress" << t << " is - << easing.valueForProgress(t); - \endcode + \snippet code/src_corelib_tools_qeasingcurve.cpp 0 + will print the effective progress of the interpolation between 0 and 1. When using a QPropertyAnimation, the associated easing curve will be used to control the progress of the interpolation between startValue and endValue: - \code - QPropertyAnimation animation; - animation.setStartValue(0); - animation.setEndValue(1000); - animation.setDuration(1000); - animation.setEasingCurve(QEasingCurve::InOutQuad); - \endcode + + \snippet code/src_corelib_tools_qeasingcurve.cpp 1 The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access is available to curves From 20ac20bcea8954a980d1acdbc4e9fa55011fe088 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Thu, 30 Aug 2018 18:11:31 +0200 Subject: [PATCH 06/12] Windows QPA: Fix missing accessibility info with WebEngineView It seems when a WebEngineView is parented by a window its accessible interface will not know its parent, which prevented the root of an UI Automation fragment from being found, causing missing accessibility info. This change adds a workaround to avoid this issue. Task-number: QTBUG-70199 Change-Id: Ia7cfc9f410c4f0ef3b5f9d1700748a9a3e29b7c2 Reviewed-by: Friedemann Kleint Reviewed-by: Qt CI Bot --- .../windows/uiautomation/qwindowsuiautils.cpp | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp index 294eed77019..89e5aad6a64 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp @@ -57,11 +57,25 @@ QWindow *windowForAccessible(const QAccessibleInterface *accessible) { QWindow *window = accessible->window(); if (!window) { - QAccessibleInterface *acc = accessible->parent(); - while (acc && acc->isValid() && !window) { - window = acc->window(); - QAccessibleInterface *par = acc->parent(); + const QAccessibleInterface *acc = accessible; + const QAccessibleInterface *par = accessible->parent(); + while (par && par->isValid() && !window) { + window = par->window(); acc = par; + par = par->parent(); + } + if (!window) { + // Workaround for WebEngineView not knowing its parent. + const auto appWindows = QGuiApplication::topLevelWindows(); + for (QWindow *w : appWindows) { + if (QAccessibleInterface *root = w->accessibleRoot()) { + int count = root->childCount(); + for (int i = 0; i < count; ++i) { + if (root->child(i) == acc) + return w; + } + } + } } } return window; From 689a1e186b76853144802d9c29f0346856bd5fde Mon Sep 17 00:00:00 2001 From: Andre Hartmann Date: Wed, 5 Sep 2018 20:52:17 +0200 Subject: [PATCH 07/12] QString: Fix snippet explaining "non-spaced numbered place markers" The snippet tries to explain the advantage of str.arg("Hello", QString::number(20), QString::number(50)); over str.arg("Hello").arg(20).arg(50); which only makes sense, if str contains the same formating sequence, namely "%1%3%2". That also matches the belonging comment. Amends 8481500f639e3d5e2259db57847a2e7068e30650 Task-number: QTBUG-44044 Change-Id: Ic2595107bc599c6d244ebf88184a5cc5569ed4f1 Reviewed-by: Samuel Gaist Reviewed-by: Thiago Macieira --- src/corelib/doc/snippets/qstring/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index b936f0c057e..c8842eec003 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -291,7 +291,7 @@ void Widget::argFunction() //! [97] //! [98] - str = "%1%2%3"; + str = "%1%3%2"; str.arg("Hello", QString::number(20), QString::number(50)); // returns "Hello5020" //! [98] From 85f127cb045200fa5fa3608b859e59bb4a9c27b2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sat, 1 Sep 2018 19:51:43 +0200 Subject: [PATCH 08/12] Revise an incorrect QVulkanWindow doc note Applying the transformation in question has no effect on the winding order. Rewrite that section. While all the examples are correct, clarify the rules for the geometry they use since the winding order varies. Fix up the triangle example code to use front=CCW for clarity (even though it does not matter much since culling is off there). Change-Id: Icb968c76cc9fa918a5608d3c66b4fccd5668175e Reviewed-by: Christian Stromme --- examples/vulkan/hellovulkancubes/renderer.cpp | 2 +- .../hellovulkantexture/hellovulkantexture.cpp | 2 +- examples/vulkan/shared/trianglerenderer.cpp | 4 ++-- src/gui/vulkan/qvulkanwindow.cpp | 14 +++++--------- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/vulkan/hellovulkancubes/renderer.cpp b/examples/vulkan/hellovulkancubes/renderer.cpp index 2e913bcae82..5ada79ce79e 100644 --- a/examples/vulkan/hellovulkancubes/renderer.cpp +++ b/examples/vulkan/hellovulkancubes/renderer.cpp @@ -53,7 +53,7 @@ #include #include -static float quadVert[] = { +static float quadVert[] = { // Y up, front = CW -1, -1, 0, -1, 1, 0, 1, -1, 0, diff --git a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp index ffe1a314425..67ae0ca5dcf 100644 --- a/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp +++ b/examples/vulkan/hellovulkantexture/hellovulkantexture.cpp @@ -59,7 +59,7 @@ // Vulkan Y is negated in clip space and the near/far plane is at 0/1 instead // of -1/1. These will be corrected for by an extra transformation when // calculating the modelview-projection matrix. -static float vertexData[] = { +static float vertexData[] = { // Y up, front = CW // x, y, z, u, v -1, -1, 0, 0, 1, -1, 1, 0, 0, 0, diff --git a/examples/vulkan/shared/trianglerenderer.cpp b/examples/vulkan/shared/trianglerenderer.cpp index 6ed7e65ff91..b48f5640036 100644 --- a/examples/vulkan/shared/trianglerenderer.cpp +++ b/examples/vulkan/shared/trianglerenderer.cpp @@ -56,7 +56,7 @@ // Vulkan Y is negated in clip space and the near/far plane is at 0/1 instead // of -1/1. These will be corrected for by an extra transformation when // calculating the modelview-projection matrix. -static float vertexData[] = { +static float vertexData[] = { // Y up, front = CCW 0.0f, 0.5f, 1.0f, 0.0f, 0.0f, -0.5f, -0.5f, 0.0f, 1.0f, 0.0f, 0.5f, -0.5f, 0.0f, 0.0f, 1.0f @@ -337,7 +337,7 @@ void TriangleRenderer::initResources() rs.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO; rs.polygonMode = VK_POLYGON_MODE_FILL; rs.cullMode = VK_CULL_MODE_NONE; // we want the back face as well - rs.frontFace = VK_FRONT_FACE_CLOCKWISE; + rs.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; rs.lineWidth = 1.0f; pipelineInfo.pRasterizationState = &rs; diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index 7dea743ea8e..e45a16170eb 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -2694,15 +2694,11 @@ QImage QVulkanWindow::grab() system differences between OpenGL and Vulkan. By pre-multiplying the projection matrix with this matrix, applications can - continue to assume OpenGL-style Y coordinates in clip space (i.e. Y pointing - upwards), and can set minDepth and maxDepth to 0 and 1, respectively, - without any further corrections to the vertex Z positions, while using the - projection matrices retrieved from the QMatrix4x4 functions, such as - QMatrix4x4::perspective(), as-is. - - \note With vertex data following the default OpenGL rules (that is, the - front face being CCW), the correct winding order in the rasterization state - after applying this matrix is clockwise (\c{VK_FRONT_FACE_CLOCKWISE}). + continue to assume that Y is pointing upwards, and can set minDepth and + maxDepth in the viewport to 0 and 1, respectively, without having to do any + further corrections to the vertex Z positions. Geometry from OpenGL + applications can then be used as-is, assuming a rasterization state matching + the OpenGL culling and front face settings. */ QMatrix4x4 QVulkanWindow::clipCorrectionMatrix() { From 3bac18da8ef9f5750207ddf47192b5db3137c4ac Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 5 Sep 2018 14:06:20 +0200 Subject: [PATCH 09/12] Document SLJIT part of pcre2 src/sljit features the BSD-2-Clause license, not the BSD-3-Clause one. [ChangeLog][Third-Party Components] Added documentation for the SLJIT part of pcre2, which is available under the BSD-2-Clause license. Change-Id: Ie1e981ef6eab2c8d2960919b66ac85b29450f919 Reviewed-by: Thiago Macieira --- src/3rdparty/pcre2/LICENCE-SLJIT | 22 ++++++++++++++++++++++ src/3rdparty/pcre2/qt_attribution.json | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/3rdparty/pcre2/LICENCE-SLJIT diff --git a/src/3rdparty/pcre2/LICENCE-SLJIT b/src/3rdparty/pcre2/LICENCE-SLJIT new file mode 100644 index 00000000000..74db9581834 --- /dev/null +++ b/src/3rdparty/pcre2/LICENCE-SLJIT @@ -0,0 +1,22 @@ + Copyright 2013-2013 Tilera Corporation(jiwang@tilera.com). All rights reserved. + Copyright Zoltan Herczeg (hzmester@freemail.hu). All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of + conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/3rdparty/pcre2/qt_attribution.json b/src/3rdparty/pcre2/qt_attribution.json index d09c1cc2c91..4b635cafee8 100644 --- a/src/3rdparty/pcre2/qt_attribution.json +++ b/src/3rdparty/pcre2/qt_attribution.json @@ -1,3 +1,4 @@ +[ { "Id": "pcre2", "Name": "PCRE2", @@ -15,4 +16,22 @@ Copyright (c) 2009-2018 Zoltan Herczeg Copyright (c) 2007-2012 Google Inc. Copyright (c) 2013-2013 Tilera Corporation (jiwang@tilera.com)" +}, +{ + "Id": "pcre2-sljit", + "Name": "PCRE2 - Stack-less Just-In-Time Compiler", + "QDocModule": "qtcore", + "QtUsage": "Optionally used in Qt Core (QRegularExpression). Configure with -system-pcre or -no-pcre to avoid.", + + "Path": "src/sljit", + "Description": "The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.", + "Homepage": "http://www.pcre.org/", + "Version": "10.31", + "DownloadLocation": "https://ftp.pcre.org/pub/pcre/pcre2-10.31.tar.bz2", + "License": "BSD 2-clause \"Simplified\" License", + "LicenseId": "BSD-2-Clause", + "LicenseFile": "LICENCE-SLJIT", + "Copyright": "Copyright (c) Zoltan Herczeg +Copyright 2013-2013 Tilera Corporation(jiwang@tilera.com)" } +] \ No newline at end of file From 3baa9aa3cd100d868313ce2920c35908abd172c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 5 Sep 2018 11:51:50 +0200 Subject: [PATCH 10/12] macOS: Clear NSOpenGLContex's drawable when using offscreen surfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise the user might accidentally render to the previously active window, if not explicitly using an FBO. This will have an performance impact if doing makeCurrent on a real window and an offscreen window back and forth with the same context, but that's not really a common or recommended use of QOffscreenSurface, as you can create FBOs with a normal window current as well. The use case of QOffscreenSurface is when a real window is not available. Change-Id: If93d04f82564523e15d5970429afea34c5cd31fe Reviewed-by: Morten Johan Sørvig --- .../platforms/cocoa/qcocoaglcontext.mm | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 2c8885e4191..cf4ecd335c3 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -331,34 +331,32 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) Q_ASSERT(surface->surface()->supportsOpenGL()); - if (surface->surface()->surfaceClass() == QSurface::Offscreen) { - [m_context makeCurrentContext]; - return true; - } - if (!setDrawable(surface)) return false; [m_context makeCurrentContext]; - // Disable high-resolution surfaces when using the software renderer, which has the - // problem that the system silently falls back to a to using a low-resolution buffer - // when a high-resolution buffer is requested. This is not detectable using the NSWindow - // convertSizeToBacking and backingScaleFactor APIs. A typical result of this is that Qt - // will display a quarter of the window content when running in a virtual machine. - if (!m_didCheckForSoftwareContext) { - // FIXME: This ensures we check only once per context, - // but the context may be used for multiple surfaces. - m_didCheckForSoftwareContext = true; + if (surface->surface()->surfaceClass() == QSurface::Window) { + // Disable high-resolution surfaces when using the software renderer, which has the + // problem that the system silently falls back to a to using a low-resolution buffer + // when a high-resolution buffer is requested. This is not detectable using the NSWindow + // convertSizeToBacking and backingScaleFactor APIs. A typical result of this is that Qt + // will display a quarter of the window content when running in a virtual machine. + if (!m_didCheckForSoftwareContext) { + // FIXME: This ensures we check only once per context, + // but the context may be used for multiple surfaces. + m_didCheckForSoftwareContext = true; - const GLubyte* renderer = glGetString(GL_RENDERER); - if (qstrcmp((const char *)renderer, "Apple Software Renderer") == 0) { - NSView *view = static_cast(surface)->m_view; - [view setWantsBestResolutionOpenGLSurface:NO]; + const GLubyte* renderer = glGetString(GL_RENDERER); + if (qstrcmp((const char *)renderer, "Apple Software Renderer") == 0) { + NSView *view = static_cast(surface)->m_view; + [view setWantsBestResolutionOpenGLSurface:NO]; + } } + + update(); } - update(); return true; } @@ -368,7 +366,17 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) */ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface) { - Q_ASSERT(surface && surface->surface()->surfaceClass() == QSurface::Window); + if (!surface || surface->surface()->surfaceClass() == QSurface::Offscreen) { + // Clear the current drawable and reset the active window, so that GL + // commands that don't target a specific FBO will not end up stomping + // on the previously set drawable. + qCDebug(lcQpaOpenGLContext) << "Clearing current drawable" << m_context.view << "for" << m_context; + [m_context clearDrawable]; + m_currentWindow.clear(); + return true; + } + + Q_ASSERT(surface->surface()->surfaceClass() == QSurface::Window); QWindow *window = static_cast(surface)->window(); if (window == m_currentWindow.data()) From be60b541adb039bd7fed09bf8b2a2848f50d218e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Thu, 16 Aug 2018 11:45:45 +0200 Subject: [PATCH 11/12] Make QOpenGLContext::makeCurrent use early exit for all its flow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The case of the platform context failing makeCurrent is the exception. Change-Id: I606e6fb379f84e886bff9e27355dda9b31ff9ebe Reviewed-by: Morten Johan Sørvig Reviewed-by: Laszlo Agocs --- src/gui/kernel/qopenglcontext.cpp | 104 +++++++++++++++--------------- 1 file changed, 51 insertions(+), 53 deletions(-) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index cd50294a6c3..d64d31a9e84 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -985,62 +985,60 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) } QOpenGLContext *previous = QOpenGLContextPrivate::setCurrentContext(this); - - if (d->platformGLContext->makeCurrent(surface->surfaceHandle())) { - static bool needsWorkaroundSet = false; - static bool needsWorkaround = false; - - if (!needsWorkaroundSet) { - QByteArray env; -#ifdef Q_OS_ANDROID - env = qgetenv(QByteArrayLiteral("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND")); - needsWorkaround = env.isEmpty() || env == QByteArrayLiteral("0") || env == QByteArrayLiteral("false"); -#endif - env = qgetenv(QByteArrayLiteral("QT_ENABLE_GLYPH_CACHE_WORKAROUND")); - if (env == QByteArrayLiteral("1") || env == QByteArrayLiteral("true")) - needsWorkaround = true; - - if (!needsWorkaround) { - const char *rendererString = reinterpret_cast(functions()->glGetString(GL_RENDERER)); - if (rendererString) - needsWorkaround = - qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 - || qstrcmp(rendererString, "Mali-T880") == 0 - || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 - || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' - || qstrncmp(rendererString, "Adreno (TM) 3xx", 13) == 0 // Adreno 302, 305, 320, 330 - || qstrncmp(rendererString, "Adreno 3xx", 8) == 0 // Same as above but without the '(TM)' - || qstrncmp(rendererString, "Adreno (TM) 4xx", 13) == 0 // Adreno 405, 418, 420, 430 - || qstrncmp(rendererString, "Adreno 4xx", 8) == 0 // Same as above but without the '(TM)' - || qstrncmp(rendererString, "Adreno (TM) 5xx", 13) == 0 // Adreno 505, 506, 510, 530, 540 - || qstrncmp(rendererString, "Adreno 5xx", 8) == 0 // Same as above but without the '(TM)' - || qstrncmp(rendererString, "Adreno (TM) 6xx", 13) == 0 // Adreno 610, 620, 630 - || qstrncmp(rendererString, "Adreno 6xx", 8) == 0 // Same as above but without the '(TM)' - || qstrcmp(rendererString, "GC800 core") == 0 - || qstrcmp(rendererString, "GC1000 core") == 0 - || strstr(rendererString, "GC2000") != 0 - || qstrcmp(rendererString, "Immersion.16") == 0; - } - needsWorkaroundSet = true; - } - - if (needsWorkaround) - d->workaround_brokenFBOReadBack = true; - - d->surface = surface; - - d->shareGroup->d_func()->deletePendingResources(this); - -#ifndef QT_NO_DEBUG - QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true); -#endif - - return true; + if (!d->platformGLContext->makeCurrent(surface->surfaceHandle())) { + QOpenGLContextPrivate::setCurrentContext(previous); + return false; } - QOpenGLContextPrivate::setCurrentContext(previous); + static bool needsWorkaroundSet = false; + static bool needsWorkaround = false; - return false; + if (!needsWorkaroundSet) { + QByteArray env; +#ifdef Q_OS_ANDROID + env = qgetenv(QByteArrayLiteral("QT_ANDROID_DISABLE_GLYPH_CACHE_WORKAROUND")); + needsWorkaround = env.isEmpty() || env == QByteArrayLiteral("0") || env == QByteArrayLiteral("false"); +#endif + env = qgetenv(QByteArrayLiteral("QT_ENABLE_GLYPH_CACHE_WORKAROUND")); + if (env == QByteArrayLiteral("1") || env == QByteArrayLiteral("true")) + needsWorkaround = true; + + if (!needsWorkaround) { + const char *rendererString = reinterpret_cast(functions()->glGetString(GL_RENDERER)); + if (rendererString) + needsWorkaround = + qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 + || qstrcmp(rendererString, "Mali-T880") == 0 + || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 + || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 3xx", 13) == 0 // Adreno 302, 305, 320, 330 + || qstrncmp(rendererString, "Adreno 3xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 4xx", 13) == 0 // Adreno 405, 418, 420, 430 + || qstrncmp(rendererString, "Adreno 4xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 5xx", 13) == 0 // Adreno 505, 506, 510, 530, 540 + || qstrncmp(rendererString, "Adreno 5xx", 8) == 0 // Same as above but without the '(TM)' + || qstrncmp(rendererString, "Adreno (TM) 6xx", 13) == 0 // Adreno 610, 620, 630 + || qstrncmp(rendererString, "Adreno 6xx", 8) == 0 // Same as above but without the '(TM)' + || qstrcmp(rendererString, "GC800 core") == 0 + || qstrcmp(rendererString, "GC1000 core") == 0 + || strstr(rendererString, "GC2000") != 0 + || qstrcmp(rendererString, "Immersion.16") == 0; + } + needsWorkaroundSet = true; + } + + if (needsWorkaround) + d->workaround_brokenFBOReadBack = true; + + d->surface = surface; + + d->shareGroup->d_func()->deletePendingResources(this); + +#ifndef QT_NO_DEBUG + QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true); +#endif + + return true; } /*! From 5474f28c42ce0c853ddd08a8fd2f31948fcd968b Mon Sep 17 00:00:00 2001 From: Juan Jose Casafranca Date: Mon, 3 Sep 2018 08:50:14 +0200 Subject: [PATCH 12/12] Graph loader can load prototypes stored in the graph Change-Id: Ib0bbfe5b0257bf355e83cc5287fa52b1e0cc3ed6 Reviewed-by: Mike Krus Reviewed-by: Sean Harmer --- src/gui/util/qshadergraphloader.cpp | 15 +++++++++++++++ src/gui/util/qshadernodesloader.cpp | 8 ++++++-- src/gui/util/qshadernodesloader_p.h | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/gui/util/qshadergraphloader.cpp b/src/gui/util/qshadergraphloader.cpp index 8d92c73a5a9..99a9f7869e8 100644 --- a/src/gui/util/qshadergraphloader.cpp +++ b/src/gui/util/qshadergraphloader.cpp @@ -39,6 +39,8 @@ #include "qshadergraphloader_p.h" +#include "qshadernodesloader_p.h" + #include #include #include @@ -129,6 +131,19 @@ void QShaderGraphLoader::load() bool hasError = false; + const auto prototypesValue = root.value(QStringLiteral("prototypes")); + if (!prototypesValue.isUndefined()) { + if (prototypesValue.isObject()) { + QShaderNodesLoader loader; + loader.load(prototypesValue.toObject()); + m_prototypes.unite(loader.nodes()); + } else { + qWarning() << "Invalid prototypes property, should be an object"; + m_status = Error; + return; + } + } + const auto nodes = nodesValue.toArray(); for (const auto &nodeValue : nodes) { if (!nodeValue.isObject()) { diff --git a/src/gui/util/qshadernodesloader.cpp b/src/gui/util/qshadernodesloader.cpp index db34b6d44d4..692653ee446 100644 --- a/src/gui/util/qshadernodesloader.cpp +++ b/src/gui/util/qshadernodesloader.cpp @@ -99,11 +99,15 @@ void QShaderNodesLoader::load() } const auto root = document.object(); + load(root); +} +void QShaderNodesLoader::load(const QJsonObject &prototypesObject) +{ bool hasError = false; - for (const auto &property : root.keys()) { - const auto nodeValue = root.value(property); + for (const auto &property : prototypesObject.keys()) { + const auto nodeValue = prototypesObject.value(property); if (!nodeValue.isObject()) { qWarning() << "Invalid node found"; hasError = true; diff --git a/src/gui/util/qshadernodesloader_p.h b/src/gui/util/qshadernodesloader_p.h index 2696e958b6a..0bec871857b 100644 --- a/src/gui/util/qshadernodesloader_p.h +++ b/src/gui/util/qshadernodesloader_p.h @@ -78,6 +78,7 @@ public: Q_GUI_EXPORT void setDevice(QIODevice *device) Q_DECL_NOTHROW; Q_GUI_EXPORT void load(); + Q_GUI_EXPORT void load(const QJsonObject &prototypesObject); private: Status m_status;