summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-11-02 12:56:40 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-11-02 12:57:32 (GMT)
commitd4ea57ff9022305437fb371802b41120074d3467 (patch)
tree473ed0147ccc678a6cbde8a8fe8793f734c66af0 /src/opengl
parent0e02c54e7e56ee091aeeb6342faa2df163fbbd74 (diff)
downloadQt-d4ea57ff9022305437fb371802b41120074d3467.zip
Qt-d4ea57ff9022305437fb371802b41120074d3467.tar.gz
Qt-d4ea57ff9022305437fb371802b41120074d3467.tar.bz2
Safeguard isNull() pixmaps in bindTexture and remove a compile warning
Reviewed-by: TrustMe
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h2
-rw-r--r--src/opengl/qgl.cpp39
2 files changed, 40 insertions, 1 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 59e50d0..50c1432 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -254,7 +254,7 @@ static const GLuint QT_VERTEX_COORDS_ATTR = 0;
static const GLuint QT_TEXTURE_COORDS_ATTR = 1;
static const GLuint QT_OPACITY_ATTR = 2;
-struct QGLEngineShaderProg;
+class QGLEngineShaderProg;
class QGLEngineSharedShaders : public QObject
{
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 3fec1f0..621d926 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2445,6 +2445,9 @@ int QGLContextPrivate::maxTextureSize()
*/
GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption);
return texture->id;
@@ -2477,6 +2480,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format)
*/
GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format, BindOptions options)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(image, target, format, false, options);
return texture->id;
@@ -2486,6 +2492,9 @@ GLuint QGLContext::bindTexture(const QImage &image, GLenum target, GLint format,
/*! \internal */
GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, DefaultBindOption);
return texture->id;
@@ -2495,6 +2504,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa
GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format,
BindOptions options)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(image, GLenum(target), GLint(format), false, options);
return texture->id;
@@ -2507,6 +2519,9 @@ GLuint QGLContext::bindTexture(const QImage &image, QMacCompatGLenum target, QMa
*/
GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format)
{
+ if (pixmap.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(pixmap, target, format, DefaultBindOption);
return texture->id;
@@ -2521,6 +2536,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma
*/
GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint format, BindOptions options)
{
+ if (pixmap.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(pixmap, target, format, options);
return texture->id;
@@ -2530,6 +2548,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, GLenum target, GLint forma
/*! \internal */
GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format)
{
+ if (pixmap.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), DefaultBindOption);
return texture->id;
@@ -2538,6 +2559,9 @@ GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, Q
GLuint QGLContext::bindTexture(const QPixmap &pixmap, QMacCompatGLenum target, QMacCompatGLint format,
BindOptions options)
{
+ if (pixmap.isNull())
+ return 0;
+
Q_D(QGLContext);
QGLTexture *texture = d->bindTexture(pixmap, GLenum(target), GLint(format), options);
return texture->id;
@@ -4595,6 +4619,9 @@ bool QGLWidget::autoBufferSwap() const
*/
GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLWidget);
return d->glcx->bindTexture(image, target, format, QGLContext::DefaultBindOption);
}
@@ -4608,6 +4635,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format)
*/
GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format, QGLContext::BindOptions options)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLWidget);
return d->glcx->bindTexture(image, target, format, options);
}
@@ -4617,6 +4647,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, GLenum target, GLint format,
/*! \internal */
GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLWidget);
return d->glcx->bindTexture(image, GLenum(target), GLint(format), QGLContext::DefaultBindOption);
}
@@ -4624,6 +4657,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac
GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMacCompatGLint format,
QGLContext::BindOptions options)
{
+ if (image.isNull())
+ return 0;
+
Q_D(QGLWidget);
return d->glcx->bindTexture(image, GLenum(target), GLint(format), options);
}
@@ -4637,6 +4673,9 @@ GLuint QGLWidget::bindTexture(const QImage &image, QMacCompatGLenum target, QMac
*/
GLuint QGLWidget::bindTexture(const QPixmap &pixmap, GLenum target, GLint format)
{
+ if (pixmap.isNull())
+ return 0;
+
Q_D(QGLWidget);
return d->glcx->bindTexture(pixmap, target, format, QGLContext::DefaultBindOption);
}