summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTom Cooksey <thomas.cooksey@nokia.com>2010-04-27 09:16:10 (GMT)
committerTom Cooksey <thomas.cooksey@nokia.com>2010-04-27 11:45:59 (GMT)
commit939fdb8f03b998996e532cb89c8e522565c1aecc (patch)
tree0565fdf1f64b6bef2366039832a83863431ba456 /src
parent62f952daa97d7a85d62f839bef2a3d015e7bb9e0 (diff)
downloadQt-939fdb8f03b998996e532cb89c8e522565c1aecc.zip
Qt-939fdb8f03b998996e532cb89c8e522565c1aecc.tar.gz
Qt-939fdb8f03b998996e532cb89c8e522565c1aecc.tar.bz2
Fix crash when using opengl graphicssystem on desktop
Reviewed-By: Eskil Task-number: QTBUG-10225
Diffstat (limited to 'src')
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp6
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h3
-rw-r--r--src/opengl/qgl.cpp8
3 files changed, 11 insertions, 6 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 8460430..4461358 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1337,9 +1337,12 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
d->drawCachedGlyphs(glyphType, textItem, true);
}
-void QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)
+bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)
{
Q_D(QGL2PaintEngineEx);
+ if (!d->shaderManager)
+ return false;
+
ensureActive();
d->transferMode(ImageDrawingMode);
@@ -1354,6 +1357,7 @@ void QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const
d->updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE,
state()->renderHints & QPainter::SmoothPixmapTransform, textureId);
d->drawTexture(dest, srcRect, size, false);
+ return true;
}
void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 30f6634..6ba0c42 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -123,7 +123,6 @@ public:
virtual void renderHintsChanged();
virtual void transformChanged();
- virtual void drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
virtual void drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap,
QPainter::PixmapFragmentHints hints);
@@ -136,6 +135,8 @@ public:
virtual void drawStaticTextItem(QStaticTextItem *textItem);
+ bool drawTexture(const QRectF &r, GLuint textureId, const QSize &size, const QRectF &sr);
+
Type type() const { return OpenGL2; }
virtual void setState(QPainterState *s);
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 72ed6be..52efea5 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -2774,8 +2774,8 @@ void QGLContext::drawTexture(const QRectF &target, GLuint textureId, GLenum text
if (!eng->isNativePaintingActive()) {
QRectF src(0, 0, target.width(), target.height());
QSize size(target.width(), target.height());
- eng->drawTexture(target, textureId, size, src);
- return;
+ if (eng->drawTexture(target, textureId, size, src))
+ return;
}
}
@@ -2850,8 +2850,8 @@ void QGLContext::drawTexture(const QPointF &point, GLuint textureId, GLenum text
QRectF dest(point, QSizeF(textureWidth, textureHeight));
QRectF src(0, 0, textureWidth, textureHeight);
QSize size(textureWidth, textureHeight);
- eng->drawTexture(dest, textureId, size, src);
- return;
+ if (eng->drawTexture(dest, textureId, size, src))
+ return;
}
}