summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qglcustomshaderstage.cpp1
-rw-r--r--src/opengl/qgl.cpp7
-rw-r--r--src/opengl/qgl.h24
-rw-r--r--src/opengl/qgl_p.h2
-rw-r--r--src/opengl/qglbuffer.h2
-rw-r--r--src/opengl/qglcolormap.h2
-rw-r--r--src/opengl/qglframebufferobject.cpp3
-rw-r--r--src/opengl/qglfunctions.h6
-rw-r--r--src/opengl/qglpaintdevice.cpp2
-rw-r--r--src/opengl/qglpixelbuffer.cpp3
-rw-r--r--src/opengl/qglpixelbuffer.h4
-rw-r--r--src/opengl/qglshaderprogram.cpp2
-rw-r--r--src/opengl/qglshaderprogram.h12
13 files changed, 39 insertions, 31 deletions
diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
index 1551d1c7cb..6bf152b83d 100644
--- a/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
+++ b/src/opengl/gl2paintengineex/qglcustomshaderstage.cpp
@@ -63,6 +63,7 @@ QGLCustomShaderStage::~QGLCustomShaderStage()
d->m_manager->removeCustomStage();
d->m_manager->sharedShaders->cleanupCustomStage(this);
}
+ delete d_ptr;
}
void QGLCustomShaderStage::setUniformsDirty()
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index eae9a4c228..d84b59efff 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -4357,8 +4357,7 @@ void QGLWidget::resizeOverlayGL(int, int)
{
}
-/*!
- Handles the event \a e passed as a parameter.
+/*!\reimp
*/
bool QGLWidget::event(QEvent *e)
{
@@ -4500,7 +4499,7 @@ QImage QGLWidget::grabFrameBuffer(bool withAlpha)
{
makeCurrent();
QImage res;
- qreal pixelRatio = devicePixelRatio();
+ qreal pixelRatio = devicePixelRatioF();
int w = pixelRatio * width();
int h = pixelRatio * height();
if (format().rgba())
@@ -4913,7 +4912,7 @@ void QGLWidget::renderText(double x, double y, double z, const QString &str, con
GLdouble win_x = 0, win_y = 0, win_z = 0;
qgluProject(x, y, z, &model[0], &proj[0], &view[0],
&win_x, &win_y, &win_z);
- const int dpr = d->glcx->device()->devicePixelRatio();
+ const int dpr = d->glcx->device()->devicePixelRatioF();
win_x /= dpr;
win_y /= dpr;
win_y = height - win_y; // y is inverted
diff --git a/src/opengl/qgl.h b/src/opengl/qgl.h
index 8c55cffbb3..99abdd2ad6 100644
--- a/src/opengl/qgl.h
+++ b/src/opengl/qgl.h
@@ -235,7 +235,7 @@ public:
QGLContext(const QGLFormat& format);
virtual ~QGLContext();
- virtual bool create(const QGLContext* shareContext = 0);
+ virtual bool create(const QGLContext* shareContext = Q_NULLPTR);
bool isValid() const;
bool isSharing() const;
void reset();
@@ -303,7 +303,7 @@ public:
QOpenGLContext *contextHandle() const;
protected:
- virtual bool chooseContext(const QGLContext* shareContext = 0);
+ virtual bool chooseContext(const QGLContext* shareContext = Q_NULLPTR);
bool deviceIsPixmap() const;
bool windowCreated() const;
@@ -356,12 +356,12 @@ class Q_OPENGL_EXPORT QGLWidget : public QWidget
Q_OBJECT
Q_DECLARE_PRIVATE(QGLWidget)
public:
- explicit QGLWidget(QWidget* parent=0,
- const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
- explicit QGLWidget(QGLContext *context, QWidget* parent=0,
- const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
- explicit QGLWidget(const QGLFormat& format, QWidget* parent=0,
- const QGLWidget* shareWidget = 0, Qt::WindowFlags f=0);
+ explicit QGLWidget(QWidget* parent=Q_NULLPTR,
+ const QGLWidget* shareWidget = Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QGLWidget(QGLContext *context, QWidget* parent=Q_NULLPTR,
+ const QGLWidget* shareWidget = Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
+ explicit QGLWidget(const QGLFormat& format, QWidget* parent=Q_NULLPTR,
+ const QGLWidget* shareWidget = Q_NULLPTR, Qt::WindowFlags f=Qt::WindowFlags());
~QGLWidget();
void qglColor(const QColor& c) const;
@@ -380,7 +380,7 @@ public:
void setFormat(const QGLFormat& format);
QGLContext* context() const;
- void setContext(QGLContext* context, const QGLContext* shareContext = 0,
+ void setContext(QGLContext* context, const QGLContext* shareContext = Q_NULLPTR,
bool deleteOldContext = true);
QPixmap renderPixmap(int w = 0, int h = 0, bool useContext = false);
@@ -442,9 +442,9 @@ protected:
QGLWidget(QGLWidgetPrivate &dd,
const QGLFormat &format = QGLFormat(),
- QWidget *parent = 0,
- const QGLWidget* shareWidget = 0,
- Qt::WindowFlags f = 0);
+ QWidget *parent = Q_NULLPTR,
+ const QGLWidget* shareWidget = Q_NULLPTR,
+ Qt::WindowFlags f = Qt::WindowFlags());
private:
Q_DISABLE_COPY(QGLWidget)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index fd7f2b328c..ad5386d8bc 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -50,7 +50,7 @@
#include "QtCore/qmap.h"
#include "QtCore/qthread.h"
#include "QtCore/qthreadstorage.h"
-#include "QtCore/qhash.h"
+#include "QtCore/qhashfunctions.h"
#include "QtCore/qatomic.h"
#include "QtWidgets/private/qwidget_p.h"
#include "QtGui/private/qopenglcontext_p.h"
diff --git a/src/opengl/qglbuffer.h b/src/opengl/qglbuffer.h
index e424ff2b5c..67b1a68072 100644
--- a/src/opengl/qglbuffer.h
+++ b/src/opengl/qglbuffer.h
@@ -103,7 +103,7 @@ public:
void write(int offset, const void *data, int count);
void allocate(const void *data, int count);
- inline void allocate(int count) { allocate(0, count); }
+ inline void allocate(int count) { allocate(Q_NULLPTR, count); }
void *map(QGLBuffer::Access access);
bool unmap();
diff --git a/src/opengl/qglcolormap.h b/src/opengl/qglcolormap.h
index f16f94c7f5..53031fd98f 100644
--- a/src/opengl/qglcolormap.h
+++ b/src/opengl/qglcolormap.h
@@ -63,7 +63,7 @@ public:
int findNearest(QRgb color) const;
protected:
- Qt::HANDLE handle() { return d ? d->cmapHandle : 0; }
+ Qt::HANDLE handle() { return d ? d->cmapHandle : Q_NULLPTR; }
void setHandle(Qt::HANDLE ahandle) { d->cmapHandle = ahandle; }
private:
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 3479fccf58..b636f90918 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -1285,6 +1285,9 @@ int QGLFramebufferObject::metric(PaintDeviceMetric metric) const
case QPaintDevice::PdmDevicePixelRatio:
return 1;
+ case QPaintDevice::PdmDevicePixelRatioScaled:
+ return 1 * QPaintDevice::devicePixelRatioFScale();
+
default:
qWarning("QGLFramebufferObject::metric(), Unhandled metric type: %d.\n", metric);
break;
diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h
index 80b8596a20..ddb7b89d98 100644
--- a/src/opengl/qglfunctions.h
+++ b/src/opengl/qglfunctions.h
@@ -70,7 +70,7 @@ public:
QGLFunctions::OpenGLFeatures openGLFeatures() const;
bool hasOpenGLFeature(QGLFunctions::OpenGLFeature feature) const;
- void initializeGLFunctions(const QGLContext *context = 0);
+ void initializeGLFunctions(const QGLContext *context = Q_NULLPTR);
void glActiveTexture(GLenum texture);
void glAttachShader(GLuint program, GLuint shader);
@@ -172,14 +172,14 @@ public:
private:
QGLFunctionsPrivate *d_ptr;
- static bool isInitialized(const QGLFunctionsPrivate *d) { return d != 0; }
+ static bool isInitialized(const QGLFunctionsPrivate *d) { return d != Q_NULLPTR; }
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGLFunctions::OpenGLFeatures)
struct QGLFunctionsPrivate
{
- QGLFunctionsPrivate(const QGLContext *context = 0);
+ QGLFunctionsPrivate(const QGLContext *context = Q_NULLPTR);
QOpenGLFunctions *funcs;
};
diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp
index 89cf01d8ec..b5df45bcc8 100644
--- a/src/opengl/qglpaintdevice.cpp
+++ b/src/opengl/qglpaintdevice.cpp
@@ -62,6 +62,8 @@ int QGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
}
case PdmDevicePixelRatio:
return 1;
+ case PdmDevicePixelRatioScaled:
+ return 1 * QPaintDevice::devicePixelRatioFScale();
default:
qWarning("QGLPaintDevice::metric() - metric %d not known", metric);
return 0;
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 42fa3415ef..943ec7ad30 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -458,6 +458,9 @@ int QGLPixelBuffer::metric(PaintDeviceMetric metric) const
case QPaintDevice::PdmDevicePixelRatio:
return 1;
+ case QPaintDevice::PdmDevicePixelRatioScaled:
+ return QPaintDevice::devicePixelRatioFScale();
+
default:
qWarning("QGLPixelBuffer::metric(), Unhandled metric type: %d\n", metric);
break;
diff --git a/src/opengl/qglpixelbuffer.h b/src/opengl/qglpixelbuffer.h
index 0f0110da96..2aad76b002 100644
--- a/src/opengl/qglpixelbuffer.h
+++ b/src/opengl/qglpixelbuffer.h
@@ -47,9 +47,9 @@ class Q_OPENGL_EXPORT QGLPixelBuffer : public QPaintDevice
Q_DECLARE_PRIVATE(QGLPixelBuffer)
public:
QGLPixelBuffer(const QSize &size, const QGLFormat &format = QGLFormat::defaultFormat(),
- QGLWidget *shareWidget = 0);
+ QGLWidget *shareWidget = Q_NULLPTR);
QGLPixelBuffer(int width, int height, const QGLFormat &format = QGLFormat::defaultFormat(),
- QGLWidget *shareWidget = 0);
+ QGLWidget *shareWidget = Q_NULLPTR);
virtual ~QGLPixelBuffer();
bool isValid() const;
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index c0122eb59f..abd4a59fb8 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -1706,7 +1706,7 @@ void QGLShaderProgram::setAttributeBuffer
Q_UNUSED(d);
if (location != -1) {
d->glfuncs->glVertexAttribPointer(location, tupleSize, type, GL_TRUE, stride,
- reinterpret_cast<const void *>(offset));
+ reinterpret_cast<const void *>(qintptr(offset)));
}
}
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index 5d9fe22b0b..8f2c74fae7 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -58,8 +58,8 @@ public:
};
Q_DECLARE_FLAGS(ShaderType, ShaderTypeBit)
- explicit QGLShader(QGLShader::ShaderType type, QObject *parent = 0);
- QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = 0);
+ explicit QGLShader(QGLShader::ShaderType type, QObject *parent = Q_NULLPTR);
+ QGLShader(QGLShader::ShaderType type, const QGLContext *context, QObject *parent = Q_NULLPTR);
virtual ~QGLShader();
QGLShader::ShaderType shaderType() const;
@@ -76,7 +76,7 @@ public:
GLuint shaderId() const;
- static bool hasOpenGLShaders(ShaderType type, const QGLContext *context = 0);
+ static bool hasOpenGLShaders(ShaderType type, const QGLContext *context = Q_NULLPTR);
private:
friend class QGLShaderProgram;
@@ -94,8 +94,8 @@ class Q_OPENGL_EXPORT QGLShaderProgram : public QObject
{
Q_OBJECT
public:
- explicit QGLShaderProgram(QObject *parent = 0);
- explicit QGLShaderProgram(const QGLContext *context, QObject *parent = 0);
+ explicit QGLShaderProgram(QObject *parent = Q_NULLPTR);
+ explicit QGLShaderProgram(const QGLContext *context, QObject *parent = Q_NULLPTR);
virtual ~QGLShaderProgram();
bool addShader(QGLShader *shader);
@@ -280,7 +280,7 @@ public:
void setUniformValueArray(const char *name, const QMatrix4x3 *values, int count);
void setUniformValueArray(const char *name, const QMatrix4x4 *values, int count);
- static bool hasOpenGLShaderPrograms(const QGLContext *context = 0);
+ static bool hasOpenGLShaderPrograms(const QGLContext *context = Q_NULLPTR);
private Q_SLOTS:
void shaderDestroyed();