diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/Qt5GuiConfigExtras.cmake.in | 23 | ||||
-rw-r--r-- | src/gui/configure.json | 2 | ||||
-rw-r--r-- | src/gui/configure.pri | 11 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformgraphicsbuffer.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 20 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface_p.h | 1 | ||||
-rw-r--r-- | src/gui/opengl/qopengltextureuploader.cpp | 31 | ||||
-rw-r--r-- | src/gui/painting/qbezier.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qrasterizer.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 2 |
11 files changed, 70 insertions, 33 deletions
diff --git a/src/gui/Qt5GuiConfigExtras.cmake.in b/src/gui/Qt5GuiConfigExtras.cmake.in index 07869efd7d..84dbbfebd4 100644 --- a/src/gui/Qt5GuiConfigExtras.cmake.in +++ b/src/gui/Qt5GuiConfigExtras.cmake.in @@ -91,16 +91,29 @@ macro(_qt5gui_find_extra_libs Name Libs LibDir IncDirs) endforeach() !!ENDIF foreach(_lib ${Libs}) - string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_lib}) + if (IS_ABSOLUTE ${_lib}) + get_filename_component(_libFile ${_lib} NAME_WE) + if (_libFile MATCHES \"^${CMAKE_SHARED_LIBRARY_PREFIX}(.*)\") + set(_libFile ${CMAKE_MATCH_1}) + endif() + else() + set(_libFile ${_lib}) + endif() + + string(REGEX REPLACE "[^_A-Za-z0-9]" "_" _cmake_lib_name ${_libFile}) if (NOT TARGET Qt5::Gui_${_cmake_lib_name} AND NOT _Qt5Gui_${_cmake_lib_name}_LIBRARY_DONE) - find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib} + if (IS_ABSOLUTE ${_lib}) + set(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib}) + else() + find_library(Qt5Gui_${_cmake_lib_name}_LIBRARY ${_lib} !!IF !isEmpty(CROSS_COMPILE) - PATHS \"${LibDir}\" + PATHS \"${LibDir}\" !!IF !mac - NO_DEFAULT_PATH + NO_DEFAULT_PATH !!ENDIF !!ENDIF - ) + ) + endif() !!IF mac set(Qt5Gui_${_cmake_lib_name}_LIBRARY "${Qt5Gui_${_cmake_lib_name}_LIBRARY}/${_lib}") if (NOT EXISTS "${Qt5Gui_${_cmake_lib_name}_LIBRARY}") diff --git a/src/gui/configure.json b/src/gui/configure.json index 44140bc7b6..e4f25ab313 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -448,7 +448,7 @@ ], "sources": [ { "type": "pkgConfig", "args": "gl", "condition": "!config.darwin" }, - { "type": "makeSpec", "spec": "OPENGL" } + { "type": "openglMakeSpec" } ] }, "opengl_es2": { diff --git a/src/gui/configure.pri b/src/gui/configure.pri index 1b95449a10..0db106597e 100644 --- a/src/gui/configure.pri +++ b/src/gui/configure.pri @@ -15,6 +15,17 @@ defineTest(qtConfLibrary_freetype) { return(true) } +defineTest(qtConfLibrary_openglMakeSpec) { + darwin:sdk { + sysrootified = + for(val, QMAKE_INCDIR_OPENGL): sysrootified += $${QMAKE_MAC_SDK_PATH}$$val + QMAKE_INCDIR_OPENGL = $$sysrootified + } + $${1}.spec = OPENGL + !qtConfLibrary_makeSpec($$1, $$2): return(false) + return(true) +} + # Check for Direct X shader compiler 'fxc'. # Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the # DXSDK_DIR variable. Starting with Windows Kit 8, it is included in diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index be04513de6..9a6f879431 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -313,7 +313,7 @@ QOpenGLContext *qt_gl_global_share_context() \section1 Context Resource Sharing - Resources, such as framebuffer objects, textures, and vertex buffer objects + Resources such as textures and vertex buffer objects can be shared between contexts. Use setShareContext() before calling create() to specify that the contexts should share these resources. QOpenGLContext internally keeps track of a QOpenGLContextGroup object which diff --git a/src/gui/kernel/qplatformgraphicsbuffer.h b/src/gui/kernel/qplatformgraphicsbuffer.h index 0aeef946e6..11566e1201 100644 --- a/src/gui/kernel/qplatformgraphicsbuffer.h +++ b/src/gui/kernel/qplatformgraphicsbuffer.h @@ -71,12 +71,14 @@ public: TextureAccess = 0x04, HWCompositor = 0x08 }; + Q_ENUM(AccessType); Q_DECLARE_FLAGS(AccessTypes, AccessType); enum Origin { OriginBottomLeft, OriginTopLeft }; + Q_ENUM(Origin); virtual ~QPlatformGraphicsBuffer(); diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 5b32405f5e..7067ece1d8 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -695,13 +695,29 @@ QList<QTouchEvent::TouchPoint> } if (states == Qt::TouchPointReleased) { - g_nextPointId = 1; - g_pointIdMap->clear(); + // All points on deviceId have been released. + // Remove all points associated with that device from g_pointIdMap. + // (On other devices, some touchpoints might still be pressed. + // But this function is only called with points from one device at a time.) + for (auto it = g_pointIdMap->begin(); it != g_pointIdMap->end();) { + if (it.key() >> 32 == quint64(deviceId)) + it = g_pointIdMap->erase(it); + else + ++it; + } + if (g_pointIdMap->isEmpty()) + g_nextPointId = 1; } return touchPoints; } +void QWindowSystemInterfacePrivate::clearPointIdMap() +{ + g_pointIdMap->clear(); + g_nextPointId = 1; +} + QList<QWindowSystemInterface::TouchPoint> QWindowSystemInterfacePrivate::toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList, const QWindow *window) diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h index 9cb4e191cc..cea02fb8b7 100644 --- a/src/gui/kernel/qwindowsysteminterface_p.h +++ b/src/gui/kernel/qwindowsysteminterface_p.h @@ -537,6 +537,7 @@ public: static QList<QWindowSystemInterface::TouchPoint> toNativeTouchPoints(const QList<QTouchEvent::TouchPoint>& pointList, const QWindow *window); + static void clearPointIdMap(); static void installWindowSystemEventHandler(QWindowSystemEventHandler *handler); static void removeWindowSystemEventhandler(QWindowSystemEventHandler *handler); diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp index 42e309b733..03b5cb6eb5 100644 --- a/src/gui/opengl/qopengltextureuploader.cpp +++ b/src/gui/opengl/qopengltextureuploader.cpp @@ -114,6 +114,18 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag externalFormat = GL_BGRA; internalFormat = GL_RGBA; pixelType = GL_UNSIGNED_INT_8_8_8_8_REV; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + // Without GL_UNSIGNED_INT_8_8_8_8_REV, BGRA only matches ARGB on little endian: + } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat) && !sRgbBinding) { + // The GL_EXT_texture_format_BGRA8888 extension requires the internal format to match the external. + externalFormat = internalFormat = GL_BGRA; + pixelType = GL_UNSIGNED_BYTE; + } else if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_APPLE_texture_format_BGRA8888"))) { + // Is only allowed as an external format like OpenGL. + externalFormat = GL_BGRA; + internalFormat = GL_RGBA; + pixelType = GL_UNSIGNED_BYTE; +#endif } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) { #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN GLint swizzle[4] = { GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA }; @@ -125,25 +137,8 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag externalFormat = internalFormat = GL_RGBA; pixelType = GL_UNSIGNED_BYTE; } else { -#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - // Without GL_UNSIGNED_INT_8_8_8_8_REV, BGRA only matches ARGB on little endian. - if (funcs->hasOpenGLExtension(QOpenGLExtensions::BGRATextureFormat) && !sRgbBinding) { - // The GL_EXT_texture_format_BGRA8888 extension requires the internal format to match the external. - externalFormat = internalFormat = GL_BGRA; - pixelType = GL_UNSIGNED_BYTE; - } else if (context->isOpenGLES() && context->hasExtension(QByteArrayLiteral("GL_APPLE_texture_format_BGRA8888"))) { - // Is only allowed as an external format like OpenGL. - externalFormat = GL_BGRA; - internalFormat = GL_RGBA; - pixelType = GL_UNSIGNED_BYTE; - } else { - // No support for direct ARGB32 upload. - break; - } -#else - // Big endian requires GL_UNSIGNED_INT_8_8_8_8_REV for ARGB to match BGRA + // No support for direct ARGB32 upload. break; -#endif } targetFormat = image.format(); break; diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index a3dcb02e07..ddd1d997f2 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -333,7 +333,9 @@ static ShiftResult shift(const QBezier *orig, QBezier *shifted, qreal offset, qr *shifted = QBezier::fromPoints(points_shifted[map[0]], points_shifted[map[1]], points_shifted[map[2]], points_shifted[map[3]]); - return good_offset(orig, shifted, offset, threshold); + if (np > 2) + return good_offset(orig, shifted, offset, threshold); + return Ok; } // This value is used to determine the length of control point vectors @@ -432,7 +434,6 @@ redo: } else if (res == Ok) { ++o; --b; - continue; } else if (res == Circle && maxSegments - (o - curveSegments) >= 2) { // add semi circle if (addCircle(b, offset, o)) diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 52501880e4..b4014272f4 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -755,11 +755,9 @@ static inline int qSafeFloatToQ16Dot16(qreal x) void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, bool squareCap) { - if (a == b || width == 0 || d->clipRect.isEmpty()) + if (a == b || !(width > 0.0) || d->clipRect.isEmpty()) return; - Q_ASSERT(width > 0.0); - QPointF pa = a; QPointF pb = b; diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 0e07b69868..102a776ed3 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -297,7 +297,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(const QTextBlock &block) QSyntaxHighlighter::QSyntaxHighlighter(QObject *parent) : QObject(*new QSyntaxHighlighterPrivate, parent) { - if (parent->inherits("QTextEdit")) { + if (parent && parent->inherits("QTextEdit")) { QTextDocument *doc = parent->property("document").value<QTextDocument *>(); if (doc) setDocument(doc); |