summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qhighdpiscaling.cpp2
-rw-r--r--src/gui/kernel/qhighdpiscaling_p.h20
-rw-r--r--src/gui/kernel/qopenglcontext.cpp3
-rw-r--r--src/gui/kernel/qplatformintegration.cpp3
-rw-r--r--src/gui/kernel/qplatformintegration.h3
-rw-r--r--src/gui/kernel/qsurface.cpp6
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp12
7 files changed, 30 insertions, 19 deletions
diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp
index 0fea416404..64f1397771 100644
--- a/src/gui/kernel/qhighdpiscaling.cpp
+++ b/src/gui/kernel/qhighdpiscaling.cpp
@@ -456,6 +456,8 @@ QHighDpiScaling::ScaleAndOrigin QHighDpiScaling::scaleAndOrigin(const QPlatformS
{
if (!m_active)
return { qreal(1), QPoint() };
+ if (!platformScreen)
+ return { m_factor, QPoint() }; // the global factor
const QPlatformScreen *actualScreen = nativePosition ?
platformScreen->screenForPosition(*nativePosition) : platformScreen;
return { m_factor * screenSubfactor(actualScreen), actualScreen->geometry().topLeft() };
diff --git a/src/gui/kernel/qhighdpiscaling_p.h b/src/gui/kernel/qhighdpiscaling_p.h
index 50221926c6..674b737808 100644
--- a/src/gui/kernel/qhighdpiscaling_p.h
+++ b/src/gui/kernel/qhighdpiscaling_p.h
@@ -59,6 +59,7 @@
#include <QtCore/qloggingcategory.h>
#include <QtGui/qregion.h>
#include <QtGui/qscreen.h>
+#include <QtGui/qvector2d.h>
#include <QtGui/qwindow.h>
QT_BEGIN_NAMESPACE
@@ -117,13 +118,26 @@ private:
namespace QHighDpi {
-template <typename T>
-inline T scale(const T &value, qreal scaleFactor, QPoint origin = QPoint(0, 0))
+inline qreal scale(qreal value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
{
- Q_UNUSED(origin)
return value * scaleFactor;
}
+inline QSize scale(const QSize &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
+{
+ return value * scaleFactor;
+}
+
+inline QSizeF scale(const QSizeF &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
+{
+ return value * scaleFactor;
+}
+
+inline QVector2D scale(const QVector2D &value, qreal scaleFactor, QPointF /* origin */ = QPointF(0, 0))
+{
+ return value * float(scaleFactor);
+}
+
inline QPointF scale(const QPointF &pos, qreal scaleFactor, QPointF origin = QPointF(0, 0))
{
return (pos - origin) * scaleFactor + origin;
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 10adee438b..6f51fe3095 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -976,11 +976,8 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
if (!surface->surfaceHandle())
return false;
if (!surface->supportsOpenGL()) {
-#ifndef Q_OS_WASM // ### work around the WASM platform plugin using QOpenGLContext with raster surfaces.
- // see QTBUG-70076
qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface;
return false;
-#endif
}
if (!d->platformGLContext->makeCurrent(surface->surfaceHandle()))
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index 490cfc6178..b3d3db0751 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -244,6 +244,9 @@ QPlatformServices *QPlatformIntegration::services() const
\value TopStackedNativeChildWindows The platform supports native child windows via
QWindowContainer without having to punch a transparent hole in the
backingstore. (since 5.10)
+
+ \value OpenGLOnRasterSurface The platform supports making a QOpenGLContext current
+ in combination with a QWindow of type RasterSurface.
*/
/*!
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index b764bd2617..d9f349555a 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -105,7 +105,8 @@ public:
AllGLFunctionsQueryable,
ApplicationIcon,
SwitchableWidgetComposition,
- TopStackedNativeChildWindows
+ TopStackedNativeChildWindows,
+ OpenGLOnRasterSurface
};
virtual ~QPlatformIntegration() { }
diff --git a/src/gui/kernel/qsurface.cpp b/src/gui/kernel/qsurface.cpp
index 415e64b39c..709f28d431 100644
--- a/src/gui/kernel/qsurface.cpp
+++ b/src/gui/kernel/qsurface.cpp
@@ -39,6 +39,8 @@
#include "qsurface.h"
#include "qopenglcontext.h"
+#include <qpa/qplatformintegration.h>
+#include <QtGui/private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
@@ -103,6 +105,10 @@ QT_BEGIN_NAMESPACE
bool QSurface::supportsOpenGL() const
{
SurfaceType type = surfaceType();
+ if (type == RasterSurface) {
+ QPlatformIntegration *integ = QGuiApplicationPrivate::instance()->platformIntegration();
+ return integ->hasCapability(QPlatformIntegration::OpenGLOnRasterSurface);
+ }
return type == OpenGLSurface || type == RasterGLSurface;
}
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index 2e2738ec81..238886220b 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -554,10 +554,6 @@ int QSurfaceFormat::alphaBufferSize() const
/*!
Set the desired \a size in bits of the red channel of the color buffer.
-
- \note On Mac OSX, be sure to set the buffer size of all color channels,
- otherwise this setting will have no effect. If one of the buffer sizes is not set,
- the current bit-depth of the screen is used.
*/
void QSurfaceFormat::setRedBufferSize(int size)
{
@@ -569,10 +565,6 @@ void QSurfaceFormat::setRedBufferSize(int size)
/*!
Set the desired \a size in bits of the green channel of the color buffer.
-
- \note On Mac OSX, be sure to set the buffer size of all color channels,
- otherwise this setting will have no effect. If one of the buffer sizes is not set,
- the current bit-depth of the screen is used.
*/
void QSurfaceFormat::setGreenBufferSize(int size)
{
@@ -584,10 +576,6 @@ void QSurfaceFormat::setGreenBufferSize(int size)
/*!
Set the desired \a size in bits of the blue channel of the color buffer.
-
- \note On Mac OSX, be sure to set the buffer size of all color channels,
- otherwise this setting will have no effect. If one of the buffer sizes is not set,
- the current bit-depth of the screen is used.
*/
void QSurfaceFormat::setBlueBufferSize(int size)
{