diff options
Diffstat (limited to 'src/gui')
27 files changed, 136 insertions, 96 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 48c262ae7a..3998bbf3ff 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -611,7 +611,7 @@ bool QImageData::checkForAlphaPixels() const */ /*! - \fn QImage &operator=(QImage &&other) + \fn QImage &QImage::operator=(QImage &&other) Move-assigns \a other to this QImage instance. diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 09cdf41399..356bdc09e4 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -64,6 +64,8 @@ QNativeImage::~QNativeImage() QImage::Format QNativeImage::systemFormat() { + if (!QGuiApplication::primaryScreen()) + return QImage::Format_Invalid; return QGuiApplication::primaryScreen()->handle()->format(); } diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp index 465c04cdc8..d7fd4d5bc0 100644 --- a/src/gui/kernel/qdrag.cpp +++ b/src/gui/kernel/qdrag.cpp @@ -101,7 +101,7 @@ QT_BEGIN_NAMESPACE \l{QWidget::mouseMoveEvent()}{mouseMoveEvent()} to check whether a QDrag is required. - \sa {Drag and Drop}, QClipboard, QMimeData, QWindowsMime, QMacPasteboardMime, + \sa {Drag and Drop}, QClipboard, QMimeData, QMacPasteboardMime, {Draggable Icons Example}, {Draggable Text Example}, {Drop Site Example}, {Fridge Magnets Example} */ diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index 92d9871dc5..bb7000a266 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -628,7 +628,7 @@ QHoverEvent::~QHoverEvent() \a modifiers holds the keyboard modifier flags at the time of the event, and \a orient holds the wheel's orientation. - \sa pos(), pixelDelta(), angleDelta(), state() + \sa pos(), pixelDelta(), angleDelta() */ #ifndef QT_NO_WHEELEVENT QWheelEvent::QWheelEvent(const QPointF &pos, int delta, @@ -659,7 +659,7 @@ QWheelEvent::~QWheelEvent() \a orient holds the wheel's orientation. - \sa pos(), pixelDelta(), angleDelta(), state() + \sa pos(), pixelDelta(), angleDelta() */ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp index ce913a98af..1625909843 100644 --- a/src/gui/kernel/qoffscreensurface.cpp +++ b/src/gui/kernel/qoffscreensurface.cpp @@ -71,6 +71,14 @@ QT_BEGIN_NAMESPACE How the offscreen surface is implemented depends on the underlying platform, but it will typically use a pixel buffer (pbuffer). If the platform doesn't implement or support offscreen surfaces, QOffscreenSurface will use an invisible QWindow internally. + + \note In order to create an offscreen surface that is guaranteed to be compatible with + a given context and window, make sure to set the format to the context's or the + window's actual format, that is, the QSurfaceFormat returned from + QOpenGLContext::format() or QWindow::format() \e{after the context or window has been + created}. Passing the format returned from QWindow::requestedFormat() to setFormat() + may result in an incompatible offscreen surface since the underlying windowing system + interface may offer a different set of configurations for window and pbuffer surfaces. */ class Q_GUI_EXPORT QOffscreenSurfacePrivate : public QObjectPrivate { diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 5087e33b47..e258218e85 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -165,7 +165,7 @@ void QOpenGLVersionProfile::setVersion(int majorVersion, int minorVersion) /*! Returns the OpenGL profile. Only makes sense if profiles are supported by this version. - \sa setProfile(), supportsProfiles() + \sa setProfile() */ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const { @@ -176,7 +176,7 @@ QSurfaceFormat::OpenGLContextProfile QOpenGLVersionProfile::profile() const Sets the OpenGL profile \a profile. Only makes sense if profiles are supported by this version. - \sa profile(), supportsProfiles() + \sa profile() */ void QOpenGLVersionProfile::setProfile(QSurfaceFormat::OpenGLContextProfile profile) { diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 07729e0e73..23c13b2e24 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -171,6 +171,7 @@ public: template <typename T> T *value(QOpenGLContext *context) { QOpenGLContextGroup *group = context->shareGroup(); + QMutexLocker locker(&group->d_func()->m_mutex); T *resource = static_cast<T *>(group->d_func()->m_resources.value(this, 0)); if (!resource) { resource = new T(context); diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp index b9ef35854c..a428840ca8 100644 --- a/src/gui/kernel/qsessionmanager.cpp +++ b/src/gui/kernel/qsessionmanager.cpp @@ -201,7 +201,7 @@ QString QSessionManager::sessionKey() const Here's an example of how an application's QGuiApplication::commitDataRequest() might be implemented: - \snippet code/src_gui_kernel_qguiapplication.cpp 8 + \snippet code/src_gui_kernel_qguiapplication.cpp 1 If an error occurred within the application while saving its data, you may want to try allowsErrorInteraction() instead. @@ -293,7 +293,7 @@ QSessionManager::RestartHint QSessionManager::restartHint() const If the session manager is capable of restoring sessions it will execute \a command in order to restore the application. The command defaults to - \snippet code/src_gui_kernel_qguiapplication.cpp 9 + \snippet code/src_gui_kernel_qguiapplication.cpp 2 The \c -session option is mandatory; otherwise QGuiApplication cannot tell whether it has been restored or what the current session identifier @@ -321,7 +321,7 @@ void QSessionManager::setRestartCommand(const QStringList &command) To iterate over the list, you can use the \l foreach pseudo-keyword: - \snippet code/src_gui_kernel_qguiapplication.cpp 10 + \snippet code/src_gui_kernel_qguiapplication.cpp 3 \sa setRestartCommand(), restartHint() */ @@ -347,7 +347,7 @@ void QSessionManager::setDiscardCommand(const QStringList &command) To iterate over the list, you can use the \l foreach pseudo-keyword: - \snippet code/src_gui_kernel_qguiapplication.cpp 11 + \snippet code/src_gui_kernel_qguiapplication.cpp 4 \sa setDiscardCommand(), restartCommand(), setRestartCommand() */ diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp index 23c0e59779..2b8e611dff 100644 --- a/src/gui/kernel/qsurfaceformat.cpp +++ b/src/gui/kernel/qsurfaceformat.cpp @@ -387,7 +387,7 @@ void QSurfaceFormat::setOption(QSurfaceFormat::FormatOption option, bool on) Returns true if the format option \a option is set; otherwise returns false. - \sa options(), testOption() + \sa options() */ bool QSurfaceFormat::testOption(QSurfaceFormat::FormatOption option) const { diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index fd9e0ad61b..13da58e391 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -159,10 +159,6 @@ QWindow::QWindow(QScreen *targetScreen) d->screen = targetScreen; if (!d->screen) d->screen = QGuiApplication::primaryScreen(); - - //if your applications aborts here, then chances are your creating a QWindow before the - //screen list is populated. - Q_ASSERT(d->screen); d->init(); } @@ -232,6 +228,13 @@ QWindow::~QWindow() void QWindowPrivate::init() { Q_Q(QWindow); + + // If your application aborts here, you are probably creating a QWindow + // before the screen list is populated. + if (!screen) { + qFatal("Cannot create window: no screens available"); + exit(1); + } QObject::connect(screen, SIGNAL(destroyed(QObject*)), q, SLOT(screenDestroyed(QObject*))); QGuiApplicationPrivate::window_list.prepend(q); } diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index fa392d16aa..6750458f83 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE multisampling. Most hardware require significantly more memory to do multisampling and the resulting quality is not on par with the quality of the software paint engine. The OpenGL paint engine's - strenght lies in its performance, not its visual rendering + strength lies in its performance, not its visual rendering quality. \section1 State Changes diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 983496230d..078274eabd 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -2668,12 +2668,12 @@ void QOpenGLTexture::generateMipMaps() } /*! - Generates mipmaps for this texture object from mipmap level \baseLevel. If you are + Generates mipmaps for this texture object from mipmap level \a baseLevel. If you are using a texture target and filtering option that requires mipmaps and you have disabled automatic mipmap generation then you need to call this function or the overload to create the mipmap chain. - The generation of mipmaps to above \baseLevel is achieved by setting the mipmap + The generation of mipmaps to above \a baseLevel is achieved by setting the mipmap base level to \a baseLevel and then generating the mipmap chain. If \a resetBaseLevel is \c true, then the baseLevel of the texture will be reset to its previous value. @@ -3000,7 +3000,7 @@ void QOpenGLTexture::setBorderColor(QColor color) } /*! - Sets the color red to \a {r}, green to \a {g}, blue to \{b}, and \a {a} to the + Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a {a} to the alpha value. \overload */ @@ -3033,8 +3033,8 @@ void QOpenGLTexture::setBorderColor(float r, float g, float b, float a) } /*! - Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha - value to {a}. + Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha + value to \a {a}. \overload */ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) @@ -3068,8 +3068,8 @@ void QOpenGLTexture::setBorderColor(int r, int g, int b, int a) } /*! - Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and \a the alpha - value to {a}. + Sets the color red to \a {r}, green to \a {g}, blue to \a {b}, and the alpha + value to \a {a}. \overload */ void QOpenGLTexture::setBorderColor(uint r, uint g, uint b, uint a) diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index b1fd4ffdfe..22ca35a8c3 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -149,8 +149,6 @@ bool QOpenGLVertexArrayObjectPrivate::create() } Q_Q(QOpenGLVertexArrayObject); - if (context) - QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); QOpenGLContext *ctx = QOpenGLContext::currentContext(); if (!ctx) { @@ -202,6 +200,8 @@ void QOpenGLVertexArrayObjectPrivate::destroy() if (!vao) return; + Q_Q(QOpenGLVertexArrayObject); + switch (vaoFuncsType) { #ifndef QT_OPENGL_ES_2 case Core_3_2: @@ -220,6 +220,10 @@ void QOpenGLVertexArrayObjectPrivate::destroy() break; } + Q_ASSERT(context); + QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed())); + context = 0; + vao = 0; } diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 23eaa9a3e7..f22c37aecc 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -129,7 +129,7 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha { }; void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -144,17 +144,17 @@ void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl, #endif if (const_alpha == 256) { Blend_RGB16_on_RGB16_NoAlpha noAlpha; - qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, noAlpha); } else { Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha); - qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, constAlpha); } } void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -169,11 +169,11 @@ void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl, #endif if (const_alpha == 256) { Blend_ARGB32_on_RGB16_SourceAlpha noAlpha; - qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, noAlpha); } else { Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha); - qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, constAlpha); } } @@ -453,7 +453,7 @@ struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha { }; void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -468,17 +468,17 @@ void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl, #endif if (const_alpha == 256) { Blend_RGB32_on_RGB32_NoAlpha noAlpha; - qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, noAlpha); } else { Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha); - qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, constAlpha); } } void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -493,11 +493,11 @@ void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl, #endif if (const_alpha == 256) { Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha; - qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, sourceAlpha); } else { Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha); - qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, + qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, constAlpha); } } diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h index 97b89c8313..98e9e10bd8 100644 --- a/src/gui/painting/qblendfunctions_p.h +++ b/src/gui/painting/qblendfunctions_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE template <typename SRC, typename T> void qt_scale_image_16bit(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &srcRect, const QRect &clip, @@ -136,6 +136,15 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, quint16 *dst = ((quint16 *) (destPixels + ty1 * dbpl)) + tx1; + // this bounds check here is required as floating point rounding above might in some cases lead to + // w/h values that are one pixel too large, falling outside of the valid image area. + int yend = (srcy + iy * (h - 1)) >> 16; + if (yend < 0 || yend >= srch) + --h; + int xend = (basex + ix * (w - 1)) >> 16; + if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32))) + --w; + while (h--) { const SRC *src = (const SRC *) (srcPixels + (srcy >> 16) * sbpl); int srcx = basex; @@ -161,7 +170,7 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, } template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &srcRect, const QRect &clip, @@ -215,6 +224,8 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, int h = ty2 - ty1; int w = tx2 - tx1; + if (!w || !h) + return; quint32 basex; quint32 srcy; @@ -236,6 +247,15 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1; + // this bounds check here is required as floating point rounding above might in some cases lead to + // w/h values that are one pixel too large, falling outside of the valid image area. + int yend = (srcy + iy * (h - 1)) >> 16; + if (yend < 0 || yend >= srch) + --h; + int xend = (basex + ix * (w - 1)) >> 16; + if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32))) + --w; + while (h--) { const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl); int srcx = basex; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index c7472cca29..7a5c5dc660 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6522,7 +6522,7 @@ void qInitDrawhelperAsm() qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit8888_sse2; extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index a40166d5be..3ac92122bb 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -539,7 +539,7 @@ Blend_on_RGB16_SourceAndConstAlpha_Neon_create(BlendFunc blender, int const_alph } void qt_scale_image_argb32_on_rgb16_neon(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -548,19 +548,19 @@ void qt_scale_image_argb32_on_rgb16_neon(uchar *destPixels, int dbpl, if (const_alpha == 0) return; - qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip, + qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, Blend_on_RGB16_SourceAndConstAlpha_Neon_create<quint32>(blend_8_pixels_argb32_on_rgb16_neon, const_alpha)); } void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, int const_alpha); void qt_scale_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -570,11 +570,11 @@ void qt_scale_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl, return; if (const_alpha == 256) { - qt_scale_image_rgb16_on_rgb16(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip, const_alpha); + qt_scale_image_rgb16_on_rgb16(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha); return; } - qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip, + qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, Blend_on_RGB16_SourceAndConstAlpha_Neon_create<quint16>(blend_8_pixels_rgb16_on_rgb16_neon, const_alpha)); } diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index bbeb73f0af..1c05fc305a 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -138,7 +138,7 @@ typedef void (*SrcOverBlendFunc)(uchar *destPixels, int dbpl, int const_alpha); typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl, - const uchar *src, int spbl, + const uchar *src, int spbl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clipRect, diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index c37858d679..d02871c86d 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -568,7 +568,7 @@ const uint * QT_FASTCALL qt_fetch_radial_gradient_sse2(uint *buffer, const Opera } void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, @@ -577,12 +577,12 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, if (const_alpha != 256) { // from qblendfunctions.cpp extern void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, + const uchar *srcPixels, int sbpl, int srch, const QRectF &targetRect, const QRectF &sourceRect, const QRect &clip, int const_alpha); - return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, targetRect, sourceRect, clip, const_alpha); + return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha); } qreal sx = targetRect.width() / (qreal) sourceRect.width(); @@ -651,6 +651,14 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, const __m128i alphaMask = _mm_set1_epi32(0xff000000); const __m128i ixVector = _mm_set1_epi32(4*ix); + // this bounds check here is required as floating point rounding above might in some cases lead to + // w/h values that are one pixel too large, falling outside of the valid image area. + int yend = (srcy + iy * (h - 1)) >> 16; + if (yend < 0 || yend >= srch) + --h; + int xend = (basex + ix * (w - 1)) >> 16; + if (xend < 0 || xend >= (int)(sbpl/sizeof(quint32))) + --w; while (h--) { const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 67896f786d..bfcb24ae3a 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -2377,7 +2377,7 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()]; if (func && (!clip || clip->hasRectClip)) { func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), - img.bits(), img.bytesPerLine(), + img.bits(), img.bytesPerLine(), img.height(), qt_mapRect_non_normalizing(r, s->matrix), sr, !clip ? d->deviceRect : clip->clipRect, s->intOpacity); diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 56cfc0f707..bda5df3d13 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1059,7 +1059,7 @@ void QPdfEngine::drawPath (const QPainterPath &p) if (!d->hasPen && !d->hasBrush) return; - if (d->simplePen) { + if (d->simplePen && d->opacity == 1.0) { // draw strokes natively in this case for better output *d->currentPage << QPdf::generatePath(p, QTransform(), d->hasBrush ? QPdf::FillAndStrokePath : QPdf::StrokePath); } else { diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 0fffa608a4..1797905e93 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -546,6 +546,7 @@ QFontEngineData::~QFontEngineData() /*! \fn QString QFont::rawName() const + \deprecated Returns the name of the font within the underlying window system. @@ -559,6 +560,7 @@ QFontEngineData::~QFontEngineData() /*! \fn void QFont::setRawName(const QString &name) + \deprecated Sets a font by its system specific name. @@ -1106,7 +1108,7 @@ int QFont::weight() const Qt uses a weighting scale from 0 to 99 similar to, but not the same as, the scales used in Windows or CSS. A weight of 0 is - ultralight, whilst 99 will be an extremely black. + ultralight, whilst 99 will be extremely black. This enum contains the predefined font weights: @@ -1282,7 +1284,7 @@ bool QFont::kerning() const When kerning is enabled, glyph metrics do not add up anymore, even for Latin text. In other words, the assumption that width('a') + width('b') is equal to width("ab") is not - neccesairly true. + necessarily true. \sa kerning(), QFontMetrics */ @@ -2420,7 +2422,7 @@ QString QFontInfo::family() const \since 4.8 Returns the style name of the matched window system font on - system that supports it. + systems that support it. \sa QFont::styleName() */ diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index a207a1d60e..7fbaf24861 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -242,9 +242,11 @@ public: { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; } #endif +#if QT_DEPRECATED_SINCE(5, 3) // needed for X11 - void setRawName(const QString &); - QString rawName() const; + QT_DEPRECATED void setRawName(const QString &); + QT_DEPRECATED QString rawName() const; +#endif QString key() const; diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index da24c6cb67..be0402b95a 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -251,7 +251,7 @@ public: return script == other.script && screen == other.screen && multi == other.multi - && (!multi || def.fallBackFamilies.size() == other.def.fallBackFamilies.size()) + && (!multi || def.fallBackFamilies == other.def.fallBackFamilies) && def == other.def; } }; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index ae7b6c1c0d..558258c30e 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -531,7 +531,7 @@ static const int scriptForWritingSystem[] = { Q_STATIC_ASSERT(sizeof(scriptForWritingSystem) / sizeof(scriptForWritingSystem[0]) == QFontDatabase::WritingSystemsCount); -int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) +Q_GUI_EXPORT int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) { return scriptForWritingSystem[writingSystem]; } diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index 1258ea9a78..b0bade83ee 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -264,16 +264,12 @@ _hb_qt_unicode_compose(hb_unicode_funcs_t * /*ufuncs*/, // ### optimize QString s = QString::fromUcs4(&a, 1) + QString::fromUcs4(&b, 1); QString normalized = s.normalized(QString::NormalizationForm_C); - if (normalized.isEmpty()) - return false; - QVector<uint> ucs4str = normalized.toUcs4(); - if (ucs4str.size() == 1) { - *ab = ucs4str.at(0); - return true; - } + QStringIterator it(normalized); + Q_ASSERT(it.hasNext()); // size>0 + *ab = it.next(); - return false; + return !it.hasNext(); // size==1 } static hb_bool_t @@ -287,29 +283,28 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/, return false; QString normalized = QChar::decomposition(ab); - Q_ASSERT(!normalized.isEmpty()); + if (normalized.isEmpty()) + return false; - const QVector<uint> ucs4str = normalized.toUcs4(); - Q_ASSERT(ucs4str.size() <= HB_UNICODE_MAX_DECOMPOSITION_LEN); + QStringIterator it(normalized); + Q_ASSERT(it.hasNext()); // size>0 + *a = it.next(); - if (ucs4str.size() == 1) { - *a = ucs4str.at(0); + if (!it.hasNext()) { // size==1 *b = 0; return *a != ab; } - if (ucs4str.size() == 2) { - *a = ucs4str.at(0); - *b = ucs4str.at(1); - + // size>1 + *b = it.next(); + if (!it.hasNext()) { // size==2 // Here's the ugly part: if ab decomposes to a single character and // that character decomposes again, we have to detect that and undo // the second part :-( - QString recomposed = normalized.normalized(QString::NormalizationForm_C); - if (recomposed.isEmpty() || recomposed == normalized) - return false; - - hb_codepoint_t c = recomposed.toUcs4().at(0); + const QString recomposed = normalized.normalized(QString::NormalizationForm_C); + QStringIterator jt(recomposed); + Q_ASSERT(jt.hasNext()); // size>0 + const hb_codepoint_t c = jt.next(); if (c != *a && c != ab) { *a = c; *b = 0; @@ -317,17 +312,18 @@ _hb_qt_unicode_decompose(hb_unicode_funcs_t * /*ufuncs*/, return true; } + // size>2 // If decomposed to more than two characters, take the last one, // and recompose the rest to get the first component - *b = ucs4str.last(); - normalized.chop(1); - QString recomposed = normalized.normalized(QString::NormalizationForm_C); - if (recomposed.isEmpty() || recomposed == normalized) - return false; - + do { + *b = it.next(); + } while (it.hasNext()); + normalized.chop(QChar::requiresSurrogates(*b) ? 2 : 1); + const QString recomposed = normalized.normalized(QString::NormalizationForm_C); + QStringIterator jt(recomposed); + Q_ASSERT(jt.hasNext()); // size>0 // We expect that recomposed has exactly one character now - *a = recomposed.toUcs4().at(0); - + *a = jt.next(); return true; } @@ -337,9 +333,6 @@ _hb_qt_unicode_decompose_compatibility(hb_unicode_funcs_t * /*ufuncs*/, hb_codepoint_t *decomposed, void * /*user_data*/) { - if (QChar::decompositionTag(u) == QChar::NoDecomposition) // !NFKD - return 0; - const QString normalized = QChar::decomposition(u); uint outlen = 0; diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 2ba350fb67..f789ec596b 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -700,10 +700,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ if (fe != 0 && fe->type() == QFontEngine::Multi) { QFontEngineMulti *multiEngine = static_cast<QFontEngineMulti *>(fe); fe = multiEngine->engine(0); - if (fe == 0) { - multiEngine->loadEngine(0); - fe = multiEngine->engine(0); - } + Q_ASSERT(fe); } if (fe != 0) { |