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 /src | |
parent | fb0fcd7fe3f94a227dd66a110f5a3353008e37e5 (diff) | |
parent | f4d791b330d02777fcaf02938732892eb3167e9b (diff) |
Merge integration refs/builds/qtci/dev/1618401544
Diffstat (limited to 'src')
-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 |
3 files changed, 43 insertions, 17 deletions
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; |