diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/accessible/qaccessible.cpp | 16 | ||||
-rw-r--r-- | src/gui/image/qbmphandler.cpp | 13 | ||||
-rw-r--r-- | src/gui/image/qgifhandler.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qevent.cpp | 124 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/opengl/qopengldebug.cpp | 20 | ||||
-rw-r--r-- | src/gui/painting/qcosmeticstroker.cpp | 20 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 131 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.cpp | 12 |
13 files changed, 222 insertions, 163 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index fb30b5f8ee..cc9d789c6a 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1713,6 +1713,7 @@ bool operator==(const QAccessible::State &first, const QAccessible::State &secon /*! \internal */ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) { + QDebugStateSaver saver(d); if (!iface) { d << "QAccessibleInterface(null)"; return d; @@ -1720,10 +1721,10 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) d.nospace(); d << "QAccessibleInterface(" << hex << (const void *) iface << dec; if (iface->isValid()) { - d << " name=" << iface->text(QAccessible::Name) << " "; - d << "role=" << qAccessibleRoleString(iface->role()) << " "; + d << " name=" << iface->text(QAccessible::Name) << ' '; + d << "role=" << qAccessibleRoleString(iface->role()) << ' '; if (iface->childCount()) - d << "childc=" << iface->childCount() << " "; + d << "childc=" << iface->childCount() << ' '; if (iface->object()) { d << "obj=" << iface->object(); } @@ -1747,13 +1748,14 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface) } else { d << " invalid"; } - d << ")"; - return d.space(); + d << ')'; + return d; } /*! \internal */ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) { + QDebugStateSaver saver(d); d.nospace() << "QAccessibleEvent("; if (ev.object()) { d.nospace() << "object=" << hex << ev.object() << dec; @@ -1806,8 +1808,8 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev) if (changed.supportsAutoCompletion) d << "supportsAutoCompletion"; } - d.nospace() << ")"; - return d.space(); + d << ')'; + return d; } #endif // QT_NO_DEBUGSTREAM diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 7a491d8736..f124cede36 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -484,12 +484,6 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int p = data + (h-y-1)*bpl; break; case 2: // delta (jump) - // Protection - if ((uint)x >= (uint)w) - x = w-1; - if ((uint)y >= (uint)h) - y = h-1; - { quint8 tmp; d->getChar((char *)&tmp); @@ -497,6 +491,13 @@ static bool read_dib_body(QDataStream &s, const BMP_INFOHDR &bi, int offset, int d->getChar((char *)&tmp); y += tmp; } + + // Protection + if ((uint)x >= (uint)w) + x = w-1; + if ((uint)y >= (uint)h) + y = h-1; + p = data + (h-y-1)*bpl + x; break; default: // absolute mode diff --git a/src/gui/image/qgifhandler.cpp b/src/gui/image/qgifhandler.cpp index 0a451e5ea3..7ba6b123e8 100644 --- a/src/gui/image/qgifhandler.cpp +++ b/src/gui/image/qgifhandler.cpp @@ -936,6 +936,8 @@ void QGIFFormat::fillRect(QImage *image, int col, int row, int w, int h, QRgb co void QGIFFormat::nextY(unsigned char *bits, int bpl) { + if (out_of_bounds) + return; int my; switch (interlace) { case 0: // Non-interlaced diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 417c185c78..28e3a48689 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -681,6 +681,8 @@ static bool convert_BGR30_to_RGB30_inplace(QImageData *data, Qt::ImageConversion static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); + if (!data->own_data) + return false; const int depth = 32; const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; @@ -733,6 +735,8 @@ static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConve static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); + if (!data->own_data) + return false; const int depth = 32; const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; @@ -782,6 +786,8 @@ static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversio static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); + if (!data->own_data) + return false; const int depth = 16; const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; @@ -837,6 +843,8 @@ static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConvers static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_RGB32); + if (!data->own_data) + return false; const int depth = 16; const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ccd7c37486..11f7f13552 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -37,13 +37,13 @@ #include "qpa/qplatformintegration.h" #include "qpa/qplatformdrag.h" #include "private/qevent_p.h" -#include "qdebug.h" #include "qmetaobject.h" #include "qmimedata.h" #include "private/qdnd_p.h" #include "qevent_p.h" #include "qmath.h" +#include <private/qdebug_p.h> QT_BEGIN_NAMESPACE @@ -3463,7 +3463,10 @@ QShortcutEvent::~QShortcutEvent() static inline void formatTouchEvent(QDebug d, const QTouchEvent &t) { - d << "QTouchEvent(" << t.type() << " states: " << t.touchPointStates(); + d << "QTouchEvent("; + QtDebugUtils::formatQEnum(d, t.type()); + d << " states: "; + QtDebugUtils::formatQFlags(d, t.touchPointStates()); d << ", " << t.touchPoints().size() << " points: " << t.touchPoints() << ')'; } @@ -3644,15 +3647,20 @@ static const char *eventClassName(QEvent::Type t) static void formatDropEvent(QDebug d, const QDropEvent *e) { const QEvent::Type type = e->type(); - d << eventClassName(type) << "(dropAction=" << e->dropAction() << ", proposedAction=" - << e->proposedAction() << ", possibleActions=" << e->possibleActions() - << ", posF=" << e->posF(); + d << eventClassName(type) << "(dropAction="; + QtDebugUtils::formatQEnum(d, e->dropAction()); + d << ", proposedAction="; + QtDebugUtils::formatQEnum(d, e->proposedAction()); + d << ", possibleActions="; + QtDebugUtils::formatQFlags(d, e->possibleActions()); + d << ", posF="; + QtDebugUtils::formatQPoint(d, e->posF()); if (type == QEvent::DragMove || type == QEvent::DragEnter) d << ", answerRect=" << static_cast<const QDragMoveEvent *>(e)->answerRect(); d << ", formats=" << e->mimeData()->formats(); - if (const Qt::KeyboardModifiers mods = e->keyboardModifiers()) - d << ", keyboardModifiers=" << mods; - d << ", " << e->mouseButtons(); + QtDebugUtils::formatNonNullQFlags(d, ", keyboardModifiers=", e->keyboardModifiers()); + d << ", "; + QtDebugUtils::formatQFlags(d, e->mouseButtons()); } # endif // !QT_NO_DRAGANDDROP @@ -3663,15 +3671,19 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e) { const QEvent::Type type = e->type(); - d << eventClassName(type) << '(' << type - << ", device=" << e->device() - << ", pointerType=" << e->pointerType() - << ", uniqueId=" << e->uniqueId() + d << eventClassName(type) << '('; + QtDebugUtils::formatQEnum(d, type); + d << ", device="; + QtDebugUtils::formatQEnum(d, e->device()); + d << ", pointerType="; + QtDebugUtils::formatQEnum(d, e->pointerType()); + d << ", uniqueId=" << e->uniqueId() << ", pos=" << e->posF() << ", z=" << e->z() << ", xTilt=" << e->xTilt() << ", yTilt=" << e->yTilt() - << ", " << e->buttons(); + << ", "; + QtDebugUtils::formatQFlags(d, e->buttons()); if (type == QEvent::TabletPress || type == QEvent::TabletMove) d << ", pressure=" << e->pressure(); if (e->device() == QTabletEvent::RotationStylus || e->device() == QTabletEvent::FourDMouse) @@ -3685,8 +3697,19 @@ static void formatTabletEvent(QDebug d, const QTabletEvent *e) QDebug operator<<(QDebug dbg, const QTouchEvent::TouchPoint &tp) { QDebugStateSaver saver(dbg); - dbg.nospace() << "TouchPoint(" << tp.id() << ' ' << tp.rect() << ' ' << tp.state() << " press " << tp.pressure() - << " vel " << tp.velocity() << " start " << tp.startPos() << " last " << tp.lastPos() << " delta " << tp.pos() - tp.lastPos() << ')'; + dbg.nospace(); + dbg << "TouchPoint(" << tp.id() << " ("; + QtDebugUtils::formatQRect(dbg, tp.rect()); + dbg << ") "; + QtDebugUtils::formatQEnum(dbg, tp.state()); + dbg << " press " << tp.pressure() << " vel " << tp.velocity() + << " start ("; + QtDebugUtils::formatQPoint(dbg, tp.startPos()); + dbg << ") last ("; + QtDebugUtils::formatQPoint(dbg, tp.lastPos()); + dbg << ") delta ("; + QtDebugUtils::formatQPoint(dbg, tp.pos() - tp.lastPos()); + dbg << ')'; return dbg; } @@ -3716,18 +3739,23 @@ QDebug operator<<(QDebug dbg, const QEvent *e) const QMouseEvent *me = static_cast<const QMouseEvent*>(e); const Qt::MouseButton button = me->button(); const Qt::MouseButtons buttons = me->buttons(); - dbg << "QMouseEvent(" << type; - if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) - dbg << ", " << button; - if (buttons && button != buttons) - dbg << ", buttons=" << buttons; - if (me->modifiers()) - dbg << ", " << me->modifiers(); - dbg << ", localPos=" << me->localPos() << ", screenPos=" << me->screenPos(); - if (me->source()) - dbg << ", " << me->source(); - if (const Qt::MouseEventFlags flags = me->flags()) - dbg << ", flags = " << hex << int(flags) << dec; + dbg << "QMouseEvent("; + QtDebugUtils::formatQEnum(dbg, type); + if (type != QEvent::MouseMove && type != QEvent::NonClientAreaMouseMove) { + dbg << ", "; + QtDebugUtils::formatQEnum(dbg, button); + } + if (buttons && button != buttons) { + dbg << ", buttons="; + QtDebugUtils::formatQFlags(dbg, buttons); + } + QtDebugUtils::formatNonNullQFlags(dbg, ", ", me->modifiers()); + dbg << ", localPos="; + QtDebugUtils::formatQPoint(dbg, me->localPos()); + dbg << ", screenPos="; + QtDebugUtils::formatQPoint(dbg, me->screenPos()); + QtDebugUtils::formatNonNullQEnum(dbg, ", ", me->source()); + QtDebugUtils::formatNonNullQFlags(dbg, ", flags=", me->flags()); dbg << ')'; } break; @@ -3743,10 +3771,11 @@ QDebug operator<<(QDebug dbg, const QEvent *e) case QEvent::ShortcutOverride: { const QKeyEvent *ke = static_cast<const QKeyEvent *>(e); - dbg << "QKeyEvent(" << type - << ", " << static_cast<Qt::Key>(ke->key()); - if (ke->modifiers()) - dbg << ", " << ke->modifiers(); + dbg << "QKeyEvent("; + QtDebugUtils::formatQEnum(dbg, type); + dbg << ", "; + QtDebugUtils::formatQEnum(dbg, static_cast<Qt::Key>(ke->key())); + QtDebugUtils::formatNonNullQFlags(dbg, ", ", ke->modifiers()); if (!ke->text().isEmpty()) dbg << ", text=" << ke->text(); if (ke->isAutoRepeat()) @@ -3765,11 +3794,16 @@ QDebug operator<<(QDebug dbg, const QEvent *e) case QEvent::FocusAboutToChange: case QEvent::FocusIn: case QEvent::FocusOut: - dbg << "QFocusEvent(" << type << ", " << static_cast<const QFocusEvent *>(e)->reason() << ')'; + dbg << "QFocusEvent("; + QtDebugUtils::formatQEnum(dbg, type); + dbg << ", "; + QtDebugUtils::formatQEnum(dbg, static_cast<const QFocusEvent *>(e)->reason()); + dbg << ')'; break; case QEvent::Move: { const QMoveEvent *me = static_cast<const QMoveEvent *>(e); - dbg << "QMoveEvent(" << me->pos(); + dbg << "QMoveEvent("; + QtDebugUtils::formatQPoint(dbg, me->pos()); if (!me->spontaneous()) dbg << ", non-spontaneous"; dbg << ')'; @@ -3777,7 +3811,8 @@ QDebug operator<<(QDebug dbg, const QEvent *e) break; case QEvent::Resize: { const QResizeEvent *re = static_cast<const QResizeEvent *>(e); - dbg << "QResizeEvent(" << re->size(); + dbg << "QResizeEvent("; + QtDebugUtils::formatQSize(dbg, re->size()); if (!re->spontaneous()) dbg << ", non-spontaneous"; dbg << ')'; @@ -3804,19 +3839,25 @@ QDebug operator<<(QDebug dbg, const QEvent *e) case QEvent::ChildAdded: case QEvent::ChildPolished: case QEvent::ChildRemoved: - dbg << "QChildEvent(" << type << ", " << (static_cast<const QChildEvent*>(e))->child() << ')'; + dbg << "QChildEvent("; + QtDebugUtils::formatQEnum(dbg, type); + dbg << ", " << (static_cast<const QChildEvent*>(e))->child() << ')'; break; # ifndef QT_NO_GESTURES case QEvent::NativeGesture: { const QNativeGestureEvent *ne = static_cast<const QNativeGestureEvent *>(e); - dbg << "QNativeGestureEvent(" << ne->gestureType() - << "localPos=" << ne->localPos() << ", value=" << ne->value() << ')'; + dbg << "QNativeGestureEvent("; + QtDebugUtils::formatQEnum(dbg, ne->gestureType()); + dbg << "localPos="; + QtDebugUtils::formatQPoint(dbg, ne->localPos()); + dbg << ", value=" << ne->value() << ')'; } break; # endif // !QT_NO_GESTURES case QEvent::ApplicationStateChange: - dbg << "QApplicationStateChangeEvent(" - << static_cast<const QApplicationStateChangeEvent *>(e)->applicationState() << ')'; + dbg << "QApplicationStateChangeEvent("; + QtDebugUtils::formatQEnum(dbg, static_cast<const QApplicationStateChangeEvent *>(e)->applicationState()); + dbg << ')'; break; case QEvent::ContextMenu: dbg << "QContextMenuEvent(" << static_cast<const QContextMenuEvent *>(e)->pos() << ')'; @@ -3849,8 +3890,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e) dbg << ')'; break; default: - dbg << eventClassName(type) << '(' << type << ", " - << (const void *)e << ", type = " << e->type() << ')'; + dbg << eventClassName(type) << '('; + QtDebugUtils::formatQEnum(dbg, type); + dbg << ", " << (const void *)e << ')'; break; } return dbg; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 3d21b4affc..9f73f019a3 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -236,9 +236,7 @@ struct QWindowGeometrySpecification { QWindowGeometrySpecification() : corner(Qt::TopLeftCorner), xOffset(-1), yOffset(-1), width(-1), height(-1) {} static QWindowGeometrySpecification fromArgument(const QByteArray &a); - QRect apply(const QRect &windowGeometry, const QSize &windowMinimumSize, const QSize &windowMaximumSize, const QRect &availableGeometry) const; - inline QRect apply(const QRect &windowGeometry, const QWindow *window) const - { return apply(windowGeometry, window->minimumSize(), window->maximumSize(), window->screen()->virtualGeometry()); } + void applyTo(QWindow *window) const; Qt::Corner corner; int xOffset; @@ -300,32 +298,34 @@ QWindowGeometrySpecification QWindowGeometrySpecification::fromArgument(const QB return result; } -QRect QWindowGeometrySpecification::apply(const QRect &windowGeometry, const QSize &windowMinimumSize, const QSize &windowMaximumSize, const QRect &availableGeometry) const +void QWindowGeometrySpecification::applyTo(QWindow *window) const { - QRect result = windowGeometry; + QRect windowGeometry = window->frameGeometry(); + QSize size = windowGeometry.size(); if (width >= 0 || height >= 0) { - QSize size = windowGeometry.size(); + const QSize windowMinimumSize = window->minimumSize(); + const QSize windowMaximumSize = window->maximumSize(); if (width >= 0) size.setWidth(qBound(windowMinimumSize.width(), width, windowMaximumSize.width())); if (height >= 0) size.setHeight(qBound(windowMinimumSize.height(), height, windowMaximumSize.height())); - result.setSize(size); + window->resize(size); } if (xOffset >= 0 || yOffset >= 0) { + const QRect availableGeometry = window->screen()->virtualGeometry(); QPoint topLeft = windowGeometry.topLeft(); if (xOffset >= 0) { topLeft.setX(corner == Qt::TopLeftCorner || corner == Qt::BottomLeftCorner ? xOffset : - qMax(availableGeometry.right() - result.width() - xOffset, availableGeometry.left())); + qMax(availableGeometry.right() - size.width() - xOffset, availableGeometry.left())); } if (yOffset >= 0) { topLeft.setY(corner == Qt::TopLeftCorner || corner == Qt::TopRightCorner ? yOffset : - qMax(availableGeometry.bottom() - result.height() - yOffset, availableGeometry.top())); + qMax(availableGeometry.bottom() - size.height() - yOffset, availableGeometry.top())); } - result.moveTopLeft(topLeft); + window->setFramePosition(topLeft); } - return result; } static QWindowGeometrySpecification windowGeometrySpecification; @@ -2757,9 +2757,9 @@ void QGuiApplication::setPalette(const QPalette &pal) emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal); } -QRect QGuiApplicationPrivate::applyWindowGeometrySpecification(const QRect &windowGeometry, const QWindow *window) +void QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(QWindow *window) { - return windowGeometrySpecification.apply(windowGeometry, window); + windowGeometrySpecification.applyTo(window); } /*! diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 7ae6e64b26..0559442049 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -279,7 +279,7 @@ public: virtual void notifyWindowIconChanged(); - static QRect applyWindowGeometrySpecification(const QRect &windowGeometry, const QWindow *window); + static void applyWindowGeometrySpecificationTo(QWindow *window); static void setApplicationState(Qt::ApplicationState state, bool forcePropagate = false); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index fd4c769049..19f7cafbcb 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -489,6 +489,13 @@ void QWindow::setVisible(bool visible) } if (!app_priv->forcedWindowIcon.isNull()) setIcon(app_priv->forcedWindowIcon); + + // Handling of the -qwindowgeometry, -geometry command line arguments + static bool geometryApplied = false; + if (!geometryApplied) { + geometryApplied = true; + QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(this); + } } QShowEvent showEvent; @@ -1502,10 +1509,10 @@ void QWindow::setFramePosition(const QPoint &point) { Q_D(QWindow); d->positionPolicy = QWindowPrivate::WindowFrameInclusive; + d->positionAutomatic = false; if (d->platformWindow) { d->platformWindow->setGeometry(QRect(point, size())); } else { - d->positionAutomatic = false; d->geometry.moveTopLeft(point); } } diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp index 114f118989..e747372df9 100644 --- a/src/gui/opengl/qopengldebug.cpp +++ b/src/gui/opengl/qopengldebug.cpp @@ -1039,10 +1039,11 @@ bool QOpenGLDebugMessage::operator==(const QOpenGLDebugMessage &debugMessage) co */ QDebug operator<<(QDebug debug, QOpenGLDebugMessage::Source source) { + QDebugStateSaver saver(debug); debug.nospace() << "QOpenGLDebugMessage::Source(" << qt_messageSourceToString(source) - << ")"; - return debug.space(); + << ')'; + return debug; } /*! @@ -1053,10 +1054,11 @@ QDebug operator<<(QDebug debug, QOpenGLDebugMessage::Source source) */ QDebug operator<<(QDebug debug, QOpenGLDebugMessage::Type type) { + QDebugStateSaver saver(debug); debug.nospace() << "QOpenGLDebugMessage::Type(" << qt_messageTypeToString(type) - << ")"; - return debug.space(); + << ')'; + return debug; } /*! @@ -1067,10 +1069,11 @@ QDebug operator<<(QDebug debug, QOpenGLDebugMessage::Type type) */ QDebug operator<<(QDebug debug, QOpenGLDebugMessage::Severity severity) { + QDebugStateSaver saver(debug); debug.nospace() << "QOpenGLDebugMessage::Severity(" << qt_messageSeverityToString(severity) - << ")"; - return debug.space(); + << ')'; + return debug; } /*! @@ -1081,13 +1084,14 @@ QDebug operator<<(QDebug debug, QOpenGLDebugMessage::Severity severity) */ QDebug operator<<(QDebug debug, const QOpenGLDebugMessage &message) { + QDebugStateSaver saver(debug); debug.nospace() << "QOpenGLDebugMessage(" << qt_messageSourceToString(message.source()) << ", " << message.id() << ", " << message.message() << ", " << qt_messageSeverityToString(message.severity()) << ", " - << qt_messageTypeToString(message.type()) << ")"; - return debug.space(); + << qt_messageTypeToString(message.type()) << ')'; + return debug; } #endif // QT_NO_DEBUG_STREAM diff --git a/src/gui/painting/qcosmeticstroker.cpp b/src/gui/painting/qcosmeticstroker.cpp index f82b098012..8fb5f4fd3f 100644 --- a/src/gui/painting/qcosmeticstroker.cpp +++ b/src/gui/painting/qcosmeticstroker.cpp @@ -602,8 +602,7 @@ void QCosmeticStroker::drawPath(const QVectorPath &path) if (!closed && drawCaps && points == end - 2) caps |= CapEnd; - QCosmeticStroker::Point last = this->lastPixel; - bool unclipped = stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); + bool moveNextStart = stroke(this, p.x(), p.y(), p2.x(), p2.y(), caps); /* fix for gaps in polylines with fastpen and aliased in a sequence of points with small distances: if current point p2 has been dropped @@ -613,14 +612,8 @@ void QCosmeticStroker::drawPath(const QVectorPath &path) still need to update p to avoid drawing the line after this one from a bad starting position. */ - if (fastPenAliased && unclipped) { - if (last.x != lastPixel.x || last.y != lastPixel.y - || points == begin + 2 || points == end - 2) { - p = p2; - } - } else { + if (!fastPenAliased || moveNextStart || points == begin + 2 || points == end - 2) p = p2; - } points += 2; caps = NoCaps; } @@ -727,8 +720,9 @@ template<DrawPixel drawPixel, class Dasher> static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) { if (stroker->clipLine(rx1, ry1, rx2, ry2)) - return false; + return true; + bool didDraw = false; const int half = stroker->legacyRounding ? 31 : 0; int x1 = toF26Dot6(rx1) + half; int y1 = toF26Dot6(ry1) + half; @@ -814,6 +808,7 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, dasher.adjust(); x += xinc; } while (++y < ys); + didDraw = true; } } else { // horizontal @@ -889,10 +884,11 @@ static bool drawLine(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, dasher.adjust(); y += yinc; } while (++x < xs); + didDraw = true; } } stroker->lastPixel = last; - return true; + return didDraw; } @@ -900,7 +896,7 @@ template<DrawPixel drawPixel, class Dasher> static bool drawLineAA(QCosmeticStroker *stroker, qreal rx1, qreal ry1, qreal rx2, qreal ry2, int caps) { if (stroker->clipLine(rx1, ry1, rx2, ry2)) - return false; + return true; int x1 = toF26Dot6(rx1); int y1 = toF26Dot6(ry1); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 538389f15f..57bb111538 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1539,40 +1539,29 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); const __m128i v_256 = _mm_set1_epi16(256); const __m128i v_disty = _mm_set1_epi16(disty); - __m128i v_fdx = _mm_set1_epi32(fdx*4); - - ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1); - - union Vect_buffer { __m128i vect; quint32 i[4]; }; - Vect_buffer v_fx; - - for (int i = 0; i < 4; i++) { - v_fx.i[i] = fx; - fx += fdx; - } + const __m128i v_fdx = _mm_set1_epi32(fdx*4); + __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); while (b < boundedEnd) { - - Vect_buffer tl, tr, bl, br; - - for (int i = 0; i < 4; i++) { - int x1 = v_fx.i[i] >> 16; - const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1; - const uint *addr_tr = addr_tl + 1; - tl.i[i] = *addr_tl; - tr.i[i] = *addr_tr; - bl.i[i] = *(addr_tl+secondLine); - br.i[i] = *(addr_tr+secondLine); - } - __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12); + __m128i offset = _mm_srli_epi32(v_fx, 16); + const int offset0 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); + const int offset1 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); + const int offset2 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); + const int offset3 = _mm_cvtsi128_si32(offset); + const __m128i tl = _mm_setr_epi32(s1[offset0], s1[offset1], s1[offset2], s1[offset3]); + const __m128i tr = _mm_setr_epi32(s1[offset0 + 1], s1[offset1 + 1], s1[offset2 + 1], s1[offset3 + 1]); + const __m128i bl = _mm_setr_epi32(s2[offset0], s2[offset1], s2[offset2], s2[offset3]); + const __m128i br = _mm_setr_epi32(s2[offset0 + 1], s2[offset1 + 1], s2[offset2 + 1], s2[offset3 + 1]); + + __m128i v_distx = _mm_srli_epi16(v_fx, 12); v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); - interpolate_4_pixels_16_sse2(tl.vect, tr.vect, bl.vect, br.vect, v_distx, v_disty, colorMask, v_256, b); - b+=4; - v_fx.vect = _mm_add_epi32(v_fx.vect, v_fdx); + interpolate_4_pixels_16_sse2(tl, tr, bl, br, v_distx, v_disty, colorMask, v_256, b); + b += 4; + v_fx = _mm_add_epi32(v_fx, v_fdx); } - fx = v_fx.i[0]; + fx = _mm_cvtsi128_si32(v_fx); #elif defined(__ARM_NEON__) BILINEAR_DOWNSCALE_BOUNDS_PROLOG @@ -1687,9 +1676,9 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c uint tr = s1[x2]; \ uint bl = s2[x1]; \ uint br = s2[x2]; \ - int distx = (fx & 0x0000ffff) >> 12; \ - int disty = (fy & 0x0000ffff) >> 12; \ - *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \ + int distx = (fx & 0x0000ffff) >> 8; \ + int disty = (fy & 0x0000ffff) >> 8; \ + *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); \ fx += fdx; \ fy += fdy; \ ++b; \ @@ -1702,62 +1691,54 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); const __m128i v_256 = _mm_set1_epi16(256); - __m128i v_fdx = _mm_set1_epi32(fdx*4); - __m128i v_fdy = _mm_set1_epi32(fdy*4); + const __m128i v_fdx = _mm_set1_epi32(fdx*4); + const __m128i v_fdy = _mm_set1_epi32(fdy*4); + __m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx); + __m128i v_fy = _mm_setr_epi32(fy, fy + fdy, fy + fdy + fdy, fy + fdy + fdy + fdy); const uchar *textureData = data->texture.imageData; const int bytesPerLine = data->texture.bytesPerLine; - - union Vect_buffer { __m128i vect; qint32 i[4]; }; - Vect_buffer v_fx, v_fy; - - for (int i = 0; i < 4; i++) { - v_fx.i[i] = fx; - v_fy.i[i] = fy; - fx += fdx; - fy += fdy; - } + const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0)); while (b < boundedEnd) { - if (fdx > 0 && (v_fx.i[3] >> 16) >= image_x2) + if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2) break; - if (fdx < 0 && (v_fx.i[3] >> 16) < image_x1) + if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1) break; - if (fdy > 0 && (v_fy.i[3] >> 16) >= image_y2) + if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2) break; - if (fdy < 0 && (v_fy.i[3] >> 16) < image_y1) + if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1) break; - Vect_buffer tl, tr, bl, br; - Vect_buffer v_fx_shifted, v_fy_shifted; - v_fx_shifted.vect = _mm_srli_epi32(v_fx.vect, 16); - v_fy_shifted.vect = _mm_srli_epi32(v_fy.vect, 16); - - for (int i = 0; i < 4; i++) { - const int x1 = v_fx_shifted.i[i]; - const int y1 = v_fy_shifted.i[i]; - const uchar *sl = textureData + bytesPerLine * y1; - const uint *s1 = (const uint *)sl; - const uint *s2 = (const uint *)(sl + bytesPerLine); - tl.i[i] = s1[x1]; - tr.i[i] = s1[x1+1]; - bl.i[i] = s2[x1]; - br.i[i] = s2[x1+1]; - } - __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12); - __m128i v_disty = _mm_srli_epi16(v_fy.vect, 12); + const __m128i vy = _mm_packs_epi32(_mm_srli_epi32(v_fy, 16), _mm_setzero_si128()); + // 4x16bit * 4x16bit -> 4x32bit + __m128i offset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epi16(vy, vbpl)); + offset = _mm_add_epi32(offset, _mm_srli_epi32(v_fx, 16)); + const int offset0 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); + const int offset1 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); + const int offset2 = _mm_cvtsi128_si32(offset); offset = _mm_srli_si128(offset, 4); + const int offset3 = _mm_cvtsi128_si32(offset); + const uint *topData = (const uint *)(textureData); + const __m128i tl = _mm_setr_epi32(topData[offset0], topData[offset1], topData[offset2], topData[offset3]); + const __m128i tr = _mm_setr_epi32(topData[offset0 + 1], topData[offset1 + 1], topData[offset2 + 1], topData[offset3 + 1]); + const uint *bottomData = (const uint *)(textureData + bytesPerLine); + const __m128i bl = _mm_setr_epi32(bottomData[offset0], bottomData[offset1], bottomData[offset2], bottomData[offset3]); + const __m128i br = _mm_setr_epi32(bottomData[offset0 + 1], bottomData[offset1 + 1], bottomData[offset2 + 1], bottomData[offset3 + 1]); + + __m128i v_distx = _mm_srli_epi16(v_fx, 12); + __m128i v_disty = _mm_srli_epi16(v_fy, 12); v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0)); v_disty = _mm_shufflehi_epi16(v_disty, _MM_SHUFFLE(2,2,0,0)); v_disty = _mm_shufflelo_epi16(v_disty, _MM_SHUFFLE(2,2,0,0)); - interpolate_4_pixels_16_sse2(tl.vect, tr.vect, bl.vect, br.vect, v_distx, v_disty, colorMask, v_256, b); - b+=4; - v_fx.vect = _mm_add_epi32(v_fx.vect, v_fdx); - v_fy.vect = _mm_add_epi32(v_fy.vect, v_fdy); + interpolate_4_pixels_16_sse2(tl, tr, bl, br, v_distx, v_disty, colorMask, v_256, b); + b += 4; + v_fx = _mm_add_epi32(v_fx, v_fdx); + v_fy = _mm_add_epi32(v_fy, v_fdy); } - fx = v_fx.i[0]; - fy = v_fy.i[0]; + fx = _mm_cvtsi128_si32(v_fx); + fy = _mm_cvtsi128_si32(v_fy); #endif } @@ -1778,10 +1759,16 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c uint bl = s2[x1]; uint br = s2[x2]; +#if defined(__SSE2__) + // The SSE2 optimized interpolate_4_pixels is faster than interpolate_4_pixels_16. + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + *b = interpolate_4_pixels(tl, tr, bl, br, distx, disty); +#else int distx = (fx & 0x0000ffff) >> 12; int disty = (fy & 0x0000ffff) >> 12; - *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); +#endif fx += fdx; fy += fdy; diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 3a86a454ac..db8a792be7 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -2432,7 +2432,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout ++it; } else { QTextFrame::Iterator lastIt; - if (!previousIt.atEnd()) + if (!previousIt.atEnd() && previousIt != it) lastIt = previousIt; previousIt = it; QTextBlock block = it.currentBlock(); diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 385706f09e..4c92e5d000 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -166,6 +166,11 @@ void QOpenUrlHandlerRegistry::handlerDestroyed(QObject *handler) Unicode-aware, the user may have configured their client without these features. Also, certain e-mail clients (e.g., Lotus Notes) have problems with long URLs. + \warning A return value of \c true indicates that the application has successfully requested + the operating system to open the URL in an external application. The external application may + still fail to launch or fail to open the requested URL. This result will not be reported back + to the application. + \sa setUrlHandler() */ bool QDesktopServices::openUrl(const QUrl &url) @@ -185,7 +190,12 @@ bool QDesktopServices::openUrl(const QUrl &url) } if (!url.isValid()) return false; - QPlatformServices *platformServices = QGuiApplicationPrivate::platformIntegration()->services(); + + QPlatformIntegration *platformIntegration = QGuiApplicationPrivate::platformIntegration(); + if (!platformIntegration) + return false; + + QPlatformServices *platformServices = platformIntegration->services(); if (!platformServices) { qWarning("%s: The platform plugin does not support services.", Q_FUNC_INFO); return false; |