...
 
Commits (291)
From 9081571e58ceeaa4c623c83ecb41b04dfc7d90f9 Mon Sep 17 00:00:00 2001
From 6644f33d9c9be580f3277792e304d20c4b973cdd Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Tue, 21 Jun 2016 14:50:07 +0300
Subject: [PATCH 2/4] Don't request the MIME image every time Windows asks for
the list of supported types
Date: Wed, 19 Jun 2019 15:04:31 +0300
Subject: [PATCH 01/17] Use fast path for unsupported mime types
Change-Id: I05516d83dc4e0f192bc94f92cefc722f25dae4d4
We don't need to request the entire image every time
Windows asks for the list of supported MIME types. That
can make graphical applications very slow (because the image
might be quite big)
Change-Id: I84223417661eceffa1362f8045c89e260b68e0a7
---
src/plugins/platforms/windows/qwindowsmime.cpp | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
src/plugins/platforms/windows/qwindowsmime.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index ff0dccb0d9..a702a2a90f 100644
index 030d8d1e0f..b4f325736b 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -1082,12 +1082,15 @@ bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *p
@@ -1082,6 +1082,10 @@ bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *p
bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const
{
int cf = getCf(formatetc);
......@@ -23,15 +27,7 @@ index ff0dccb0d9..a702a2a90f 100644
+
if (!mimeData->hasImage())
return false;
+
const QImage image = qvariant_cast<QImage>(mimeData->imageData());
- if (image.isNull())
- return false;
- return cf == CF_DIBV5 || (cf == CF_DIB) || cf == int(CF_PNG);
+ return !image.isNull();
}
bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const
--
2.20.1.windows.1
From 6ce23924948d9697e07681bef44f0a47f9fd0d09 Mon Sep 17 00:00:00 2001
From 835bb62519cc53976b8341c0d83a660674f66a92 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Tue, 21 Jun 2016 14:50:47 +0300
Subject: [PATCH 3/4] Hack: always return we support DIBV5
Subject: [PATCH 02/17] Hack: always return we support DIBV5
Asking for the entire image may be too expensive
......@@ -11,7 +11,7 @@ Change-Id: I44c38fad73f1bb5859eb58b941054eeb6c3c6b66
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index a702a2a90f..03f8948a86 100644
index b4f325736b..e2ae95d577 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -1055,9 +1055,7 @@ QVector<FORMATETC> QWindowsMimeImage::formatsForMime(const QString &mimeType, co
......
From 4c1e4e693307c3169c6db488ad6bf6cff6aae864 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Mon, 11 Feb 2019 18:07:20 +0300
Subject: [PATCH 4/4] Fix debug on openGL ES
Change-Id: I08d1adf87b305c380a0f2177edf4ff9de109e4d6
---
src/gui/opengl/qopengldebug.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index 2e628a2bd5..9f1bb76869 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -1366,7 +1366,7 @@ bool QOpenGLDebugLogger::initialize()
#define GET_DEBUG_PROC_ADDRESS(procName) \
d->procName = reinterpret_cast< qt_ ## procName ## _t >( \
- d->context->getProcAddress(#procName) \
+ d->context->getProcAddress(d->context->isOpenGLES() ? (#procName "KHR") : (#procName)) \
);
GET_DEBUG_PROC_ADDRESS(glDebugMessageControl);
--
2.20.1.windows.1
From 9ef8cb9a95962864dc4bd506b9a2cdb462b0c908 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Thu, 4 Apr 2019 19:11:47 +0300
Subject: [PATCH] Fix swizzling when rendering QPainter on QOpenGLWidget with
Angle
OpenGLES specification does not support GL_TEXTURE_SWIZZLE_RGBA,
it supports only per-channel calls. And since Qt supports QpenGLES,
it should use the latter approach only.
The regression was introduced in Qt 5.12 by commit
ede3791df8330ed8daae6667d025ad40219a9f5f
Task-number: QTBUG-74968
---
src/gui/opengl/qopengltexture.cpp | 12 ++++----
src/gui/opengl/qopengltextureuploader.cpp | 36 ++++++++++-------------
2 files changed, 22 insertions(+), 26 deletions(-)
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 5b7956d3..a33d4763 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -4015,12 +4015,12 @@ void QOpenGLTexture::setSwizzleMask(SwizzleValue r, SwizzleValue g,
qWarning("QOpenGLTexture::setSwizzleMask() requires OpenGL >= 3.3");
return;
}
- GLint swizzleMask[] = {GLint(r), GLint(g), GLint(b), GLint(a)};
- d->swizzleMask[0] = r;
- d->swizzleMask[1] = g;
- d->swizzleMask[2] = b;
- d->swizzleMask[3] = a;
- d->texFuncs->glTextureParameteriv(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask);
+
+ d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_R, GLint(r));
+ d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_G, GLint(g));
+ d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_B, GLint(b));
+ d->texFuncs->glTextureParameteri(d->textureId, d->target, d->bindingTarget, GL_TEXTURE_SWIZZLE_A, GLint(a));
+
return;
}
#else
diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp
index 42e309b7..8d204ddc 100644
--- a/src/gui/opengl/qopengltextureuploader.cpp
+++ b/src/gui/opengl/qopengltextureuploader.cpp
@@ -77,10 +77,6 @@
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#endif
-#ifndef GL_TEXTURE_SWIZZLE_RGBA
-#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
-#endif
-
#ifndef GL_SRGB
#define GL_SRGB 0x8C40
#endif
@@ -114,14 +110,10 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
externalFormat = GL_BGRA;
internalFormat = GL_RGBA;
pixelType = GL_UNSIGNED_INT_8_8_8_8_REV;
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- GLint swizzle[4] = { GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA };
- funcs->glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
-#else
- GLint swizzle[4] = { GL_GREEN, GL_BLUE, GL_ALPHA, GL_RED };
- funcs->glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
-#endif
+ } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle) && (isOpenGL12orBetter || isOpenGLES3orBetter)) {
+ funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_B, GL_RED);
+ funcs->glTexParameteri(target, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
+
externalFormat = internalFormat = GL_RGBA;
pixelType = GL_UNSIGNED_BYTE;
} else {
@@ -173,8 +165,8 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
pixelType = GL_UNSIGNED_INT_2_10_10_10_REV;
externalFormat = GL_RGBA;
internalFormat = GL_RGB10_A2;
- GLint swizzle[4] = { GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA };
- funcs->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
targetFormat = image.format();
}
break;
@@ -231,9 +223,11 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
externalFormat = internalFormat = GL_ALPHA;
pixelType = GL_UNSIGNED_BYTE;
targetFormat = image.format();
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- GLint swizzle[4] = { GL_ZERO, GL_ZERO, GL_ZERO, GL_RED };
- funcs->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
+ } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle) && (isOpenGL12orBetter || isOpenGLES3orBetter)) {
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_ALPHA);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_ZERO);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_ZERO);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ZERO);
externalFormat = internalFormat = GL_RED;
pixelType = GL_UNSIGNED_BYTE;
targetFormat = image.format();
@@ -251,9 +245,11 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag
externalFormat = internalFormat = GL_LUMINANCE;
pixelType = GL_UNSIGNED_BYTE;
targetFormat = image.format();
- } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) {
- GLint swizzle[4] = { GL_RED, GL_RED, GL_RED, GL_ONE };
- funcs->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzle);
+ } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle) && (isOpenGL12orBetter || isOpenGLES3orBetter)) {
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_RED);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
+ funcs->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ONE);
externalFormat = internalFormat = GL_RED;
pixelType = GL_UNSIGNED_BYTE;
targetFormat = image.format();
--
2.20.1.windows.1
From a1131ad9ab08c86eb32ca3f294690a698470bda1 Mon Sep 17 00:00:00 2001
From: Dmitry Kazakov <dimula73@gmail.com>
Date: Tue, 4 Dec 2018 20:11:34 +0300
Subject: [PATCH 06/17] Return QScreen's HMONITOR handle via
QPlatformNativeInterface
It is needed to be able to fetch extra information about the display via
DXGI interface.
Change-Id: Id83982eb07ade157719e430d0abcc2613409a343
---
.../windows/qwindowsnativeinterface.cpp | 16 ++++++++++++++++
.../platforms/windows/qwindowsnativeinterface.h | 1 +
src/plugins/platforms/windows/qwindowsscreen.cpp | 5 +++++
src/plugins/platforms/windows/qwindowsscreen.h | 2 ++
4 files changed, 24 insertions(+)
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
index ed945ec4b1..1c5be44150 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp
@@ -40,6 +40,7 @@
#include "qwindowsnativeinterface.h"
#include "qwindowsclipboard.h"
#include "qwindowswindow.h"
+#include "qwindowsscreen.h"
#include "qwindowscontext.h"
#include "qwindowscursor.h"
#include "qwindowsopenglcontext.h"
@@ -124,6 +125,21 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc
return nullptr;
}
+void *QWindowsNativeInterface::nativeResourceForScreen(const QByteArray &resource, QScreen *screen)
+{
+ if (!screen || !screen->handle()) {
+ qWarning("%s: '%s' requested for null screen or screen without handle.", __FUNCTION__, resource.constData());
+ return 0;
+ }
+ QWindowsScreen *bs = static_cast<QWindowsScreen *>(screen->handle());
+ int type = resourceType(resource);
+ if (type == HandleType)
+ return bs->handle();
+
+ qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData());
+ return 0;
+}
+
#ifndef QT_NO_CURSOR
void *QWindowsNativeInterface::nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor)
{
diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.h b/src/plugins/platforms/windows/qwindowsnativeinterface.h
index e6f8aae8fb..ce395dc5a4 100644
--- a/src/plugins/platforms/windows/qwindowsnativeinterface.h
+++ b/src/plugins/platforms/windows/qwindowsnativeinterface.h
@@ -74,6 +74,7 @@ public:
void *nativeResourceForContext(const QByteArray &resource, QOpenGLContext *context) override;
#endif
void *nativeResourceForWindow(const QByteArray &resource, QWindow *window) override;
+ void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
#ifndef QT_NO_CURSOR
void *nativeResourceForCursor(const QByteArray &resource, const QCursor &cursor) override;
#endif
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index b28a113ce6..2f8850cbe0 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -323,6 +323,11 @@ void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
}
}
+HMONITOR QWindowsScreen::handle() const
+{
+ return m_data.hMonitor;
+}
+
QRect QWindowsScreen::virtualGeometry(const QPlatformScreen *screen) // cf QScreen::virtualGeometry()
{
QRect result;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 8ad012512e..3eb2d35b27 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -104,6 +104,8 @@ public:
inline void handleChanges(const QWindowsScreenData &newData);
+ HMONITOR handle() const;
+
#ifndef QT_NO_CURSOR
QPlatformCursor *cursor() const override { return m_cursor.data(); }
const CursorPtr &cursorPtr() const { return m_cursor; }
--
2.20.1.windows.1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.