aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-04 17:48:20 +0200
committerLaszlo Agocs <laszlo.agocs@theqtcompany.com>2016-05-06 11:27:27 +0000
commit3fdaa13f7f0a4f0eeff2e7450df2df0df824b72a (patch)
tree085feb12499c96da106716ee9ca55ad13a16ae12 /src
parentb1f30239bcb827035c269d722a6b43ec9d9a8bfd (diff)
Fix up createTextureFromId
Return null gracefully when not running with OpenGL. Change-Id: I918e7d02a5641ccaf3c19c415791773e28191806 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/qquickwindow.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 9355c310fb..fda01a72f2 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -3744,7 +3744,7 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText
/*!
- Creates a new QSGTexture object from an existing GL texture \a id and \a size.
+ Creates a new QSGTexture object from an existing OpenGL texture \a id and \a size.
The caller of the function is responsible for deleting the returned texture.
@@ -3755,17 +3755,15 @@ QSGTexture *QQuickWindow::createTextureFromImage(const QImage &image, CreateText
Use \a options to customize the texture attributes. The TextureUsesAtlas
option is ignored.
- \warning This function will return 0 if the scenegraph has not yet been
- initialized.
+ \warning This function will return null if the scenegraph has not yet been
+ initialized or OpenGL is not in use.
\sa sceneGraphInitialized(), QSGTexture
*/
QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, CreateTextureOptions options) const
{
#ifndef QT_NO_OPENGL
- Q_D(const QQuickWindow);
- auto openglRenderContext = static_cast<const QSGDefaultRenderContext *>(d->context);
- if (openglRenderContext && openglRenderContext->openglContext()) {
+ if (openglContext()) {
QSGPlainTexture *texture = new QSGPlainTexture();
texture->setTextureId(id);
texture->setHasAlphaChannel(options & TextureHasAlphaChannel);