diff options
author | Qt CI Bot <qt_ci_bot@qt-project.org> | 2021-04-14 15:08:32 +0000 |
---|---|---|
committer | Qt CI Bot <qt_ci_bot@qt-project.org> | 2021-04-14 15:08:32 +0000 |
commit | 5341569b41f0e5e2602fde0e88ceeac399a1f60f (patch) | |
tree | a6b6c477c1a57ba4d248edf5e6a41cbd95eb0940 | |
parent | fb0fcd7fe3f94a227dd66a110f5a3353008e37e5 (diff) | |
parent | f4d791b330d02777fcaf02938732892eb3167e9b (diff) |
Merge integration refs/builds/qtci/dev/1618401544
-rw-r--r-- | cmake/QtToolchainHelpers.cmake | 46 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 44 | ||||
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 12 | ||||
-rw-r--r-- | src/network/access/qnetworkcookie.h | 4 | ||||
-rw-r--r-- | tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp | 6 | ||||
-rw-r--r-- | tests/auto/other/lancelot/scripts/tinydashes.qps | 34 |
6 files changed, 121 insertions, 25 deletions
diff --git a/cmake/QtToolchainHelpers.cmake b/cmake/QtToolchainHelpers.cmake index f2ef6147e1..f4ee35be31 100644 --- a/cmake/QtToolchainHelpers.cmake +++ b/cmake/QtToolchainHelpers.cmake @@ -112,12 +112,48 @@ function(qt_internal_create_toolchain_file) "set(CMAKE_OSX_DEPLOYMENT_TARGET \"${CMAKE_OSX_DEPLOYMENT_TARGET}\" CACHE STRING \"\")") endif() - if(UIKIT OR (MACOS AND QT_IS_MACOS_UNIVERSAL)) - set(_qt_osx_architectures_escaped "${CMAKE_OSX_ARCHITECTURES}") - string(REPLACE ";" "LITERAL_SEMICOLON" - _qt_osx_architectures_escaped "${_qt_osx_architectures_escaped}") + # Save list of initial architectures Qt was configured with. + set(_qt_osx_architectures_escaped "${CMAKE_OSX_ARCHITECTURES}") + string(REPLACE ";" "LITERAL_SEMICOLON" + _qt_osx_architectures_escaped "${_qt_osx_architectures_escaped}") + set(docstring "List of architectures Qt was built with") + list(APPEND init_platform + "set(QT_OSX_ARCHITECTURES \"${_qt_osx_architectures_escaped}\" CACHE STRING \"${docstring}\")") + list(APPEND init_platform "") + + # When building another qt repo, ensure the same list of architectures is used by default. + # Detection of a qt repo is done by checking for QT_REPO_MODULE_VERSION which is set in + # the repo's .cmake.conf file. + # Standalone tests will be not be built with multiple architectures to avoid issues in the + # CI when trying to run cmake build tests on VMs that do not have a universal macOS + # SDK. + list(APPEND init_platform "# Only build multiple architectures when building Qt itself") + list(APPEND init_platform "if((QT_REPO_MODULE_VERSION AND NOT QT_BUILD_STANDALONE_TESTS) OR QT_FORCE_QT_OSX_ARCHITECTURES)") + list(APPEND init_platform " set(__qt_toolchain_building_qt_repo TRUE)") + list(APPEND init_platform " set(CMAKE_OSX_ARCHITECTURES \"\${QT_OSX_ARCHITECTURES}\" CACHE STRING \"\")") + list(APPEND init_platform "endif()") + list(APPEND init_platform "") + + # For macOS user projects, default to not specifying any architecture. This means CMake will + # not pass an -arch flag to the compiler and the compiler will choose the default + # architecture to build for. + # On Apple Silicon, CMake will introspect whether it's running under Rosetta and will + # pass the detected architecture (x86_64 under Rosetta or arm64 natively) to the compiler. + # This is line with default CMake behavior for user projects. + # + # For iOS, we provide a bit more convenience. + # When the user project is built using the Xcode generator, don't specify a default + # architecture and let Xcode and the developer handle it. + # When using the Ninja generator, specify the first architecture from QT_OSX_ARCHITECTURES + # (even with a simulator_and_device Qt build). This ensures that the default configuration + # at least tries to build something. + if(UIKIT) + qt_internal_get_first_osx_arch(osx_first_arch) + list(APPEND init_platform "if(NOT CMAKE_GENERATOR STREQUAL \"Xcode\" AND NOT __qt_toolchain_building_qt_repo)") list(APPEND init_platform - "set(CMAKE_OSX_ARCHITECTURES \"${_qt_osx_architectures_escaped}\" CACHE STRING \"\")") + " set(CMAKE_OSX_ARCHITECTURES \"${osx_first_arch}\" CACHE STRING \"\")") + list(APPEND init_platform "endif()") + list(APPEND init_platform "") endif() if(UIKIT) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 7e26928e32..d752c01f6a 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -385,7 +385,7 @@ QPainterState *QPaintEngineEx::createState(QPainterState *orig) const Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp -void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) +void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &inPen) { #ifdef QT_DEBUG_DRAW qDebug() << "QPaintEngineEx::stroke()" << pen; @@ -403,6 +403,38 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) d->stroker.setCubicToHook(qpaintengineex_cubicTo); } + QRectF clipRect; + QPen pen = inPen; + if (pen.style() > Qt::SolidLine) { + QRectF cpRect = path.controlPointRect(); + const QTransform &xf = state()->matrix; + if (pen.isCosmetic()) { + clipRect = d->exDeviceRect; + cpRect.translate(xf.dx(), xf.dy()); + } else { + clipRect = xf.inverted().mapRect(QRectF(d->exDeviceRect)); + } + // Check to avoid generating unwieldy amount of dashes that will not be visible anyway + QRectF extentRect = cpRect & clipRect; + qreal extent = qMax(extentRect.width(), extentRect.height()); + qreal patternLength = 0; + const QList<qreal> pattern = pen.dashPattern(); + const int patternSize = qMin(pattern.size(), 32); + for (int i = 0; i < patternSize; i++) + patternLength += qMax(pattern.at(i), qreal(0)); + if (pen.widthF()) + patternLength *= pen.widthF(); + if (qFuzzyIsNull(patternLength)) { + pen.setStyle(Qt::NoPen); + } else if (extent / patternLength > 10000) { + // approximate stream of tiny dashes with semi-transparent solid line + pen.setStyle(Qt::SolidLine); + QColor color(pen.color()); + color.setAlpha(color.alpha() / 2); + pen.setColor(color); + } + } + if (!qpen_fast_equals(pen, d->strokerPen)) { d->strokerPen = pen; d->stroker.setJoinStyle(pen.joinStyle()); @@ -430,14 +462,8 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen) return; } - if (pen.style() > Qt::SolidLine) { - if (pen.isCosmetic()) { - d->activeStroker->setClipRect(d->exDeviceRect); - } else { - QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect)); - d->activeStroker->setClipRect(clipRect); - } - } + if (!clipRect.isNull()) + d->activeStroker->setClipRect(clipRect); if (d->activeStroker == &d->stroker) d->stroker.setForceOpen(path.hasExplicitOpen()); diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index cfc3b14c9e..13fc147c15 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -227,9 +227,9 @@ void QNetworkCookie::setSecure(bool enable) string, \c SameSite::Default if not present. \since 6.1 - \sa setSameSite() + \sa setSameSitePolicy() */ -QNetworkCookie::SameSite QNetworkCookie::sameSite() const +QNetworkCookie::SameSite QNetworkCookie::sameSitePolicy() const { return d->sameSite; } @@ -238,9 +238,9 @@ QNetworkCookie::SameSite QNetworkCookie::sameSite() const Sets the "SameSite" option of this cookie to \a sameSite. \since 6.1 - \sa sameSite() + \sa sameSitePolicy() */ -void QNetworkCookie::setSameSite(QNetworkCookie::SameSite sameSite) +void QNetworkCookie::setSameSitePolicy(QNetworkCookie::SameSite sameSite) { d->sameSite = sameSite; } @@ -469,7 +469,7 @@ static QPair<QByteArray, QByteArray> nextField(const QByteArray &text, int &posi This is the default in modern browsers (since mid 2020). \value Strict Cookies will only be sent in a first-party context. - \sa setSameSite(), sameSite() + \sa setSameSitePolicy(), sameSitePolicy() */ namespace { @@ -1065,7 +1065,7 @@ QList<QNetworkCookie> QNetworkCookiePrivate::parseSetCookieHeaderLine(const QByt } else if (field.first == "httponly") { cookie.setHttpOnly(true); } else if (field.first == "samesite") { - cookie.setSameSite(sameSiteFromRawString(field.second)); + cookie.setSameSitePolicy(sameSiteFromRawString(field.second)); } else { // ignore unknown fields in the cookie (RFC6265 section 5.2, rule 6) } diff --git a/src/network/access/qnetworkcookie.h b/src/network/access/qnetworkcookie.h index 736a9d7149..265f3a7124 100644 --- a/src/network/access/qnetworkcookie.h +++ b/src/network/access/qnetworkcookie.h @@ -87,8 +87,8 @@ public: void setSecure(bool enable); bool isHttpOnly() const; void setHttpOnly(bool enable); - SameSite sameSite() const; - void setSameSite(SameSite sameSite); + SameSite sameSitePolicy() const; + void setSameSitePolicy(SameSite sameSite); bool isSessionCookie() const; QDateTime expirationDate() const; diff --git a/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp index b71934fc15..7f1b8e6369 100644 --- a/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/network/access/qnetworkcookie/tst_qnetworkcookie.cpp @@ -688,11 +688,11 @@ void tst_QNetworkCookie::parseMultipleCookies() void tst_QNetworkCookie::sameSite() { QList<QNetworkCookie> result = QNetworkCookie::parseCookies(QByteArrayLiteral("a=b;domain=qt-project.org")); - QCOMPARE(result.first().sameSite(), QNetworkCookie::SameSite::Default); + QCOMPARE(result.first().sameSitePolicy(), QNetworkCookie::SameSite::Default); result = QNetworkCookie::parseCookies(QByteArrayLiteral("a=b;domain=qt-project.org;samesite=strict")); - QCOMPARE(result.first().sameSite(), QNetworkCookie::SameSite::Strict); + QCOMPARE(result.first().sameSitePolicy(), QNetworkCookie::SameSite::Strict); result = QNetworkCookie::parseCookies(QByteArrayLiteral("a=b;domain=qt-project.org;samesite=none;secure")); - QCOMPARE(result.first().sameSite(), QNetworkCookie::SameSite::None); + QCOMPARE(result.first().sameSitePolicy(), QNetworkCookie::SameSite::None); QCOMPARE(result.first().toRawForm(), QByteArrayLiteral("a=b; secure; SameSite=None; domain=qt-project.org")); } diff --git a/tests/auto/other/lancelot/scripts/tinydashes.qps b/tests/auto/other/lancelot/scripts/tinydashes.qps new file mode 100644 index 0000000000..d41ced7f5f --- /dev/null +++ b/tests/auto/other/lancelot/scripts/tinydashes.qps @@ -0,0 +1,34 @@ +# Version: 1 +# CheckVsReference: 5% + +path_addEllipse mypath 20.0 20.0 200.0 200.0 + +save +setPen blue 20 SolidLine FlatCap +pen_setCosmetic true +pen_setDashPattern [ 0.0004 0.0004 ] +setBrush yellow + +drawPath mypath +translate 300 0 +setRenderHint Antialiasing true +drawPath mypath +restore + +path_addEllipse bigpath 200000.0 200000.0 2000000.0 2000000.0 + +setPen blue 20 DotLine FlatCap +setBrush yellow + +save +translate 0 300 +scale 0.0001 0.00011 +drawPath bigpath +restore + +save +translate 300 300 +setRenderHint Antialiasing true +scale 0.0001 0.00011 +drawPath bigpath +restore |