diff options
author | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-02-09 10:49:13 (GMT) |
---|---|---|
committer | Jani Hautakangas <jani.hautakangas@nokia.com> | 2011-02-25 13:36:48 (GMT) |
commit | db5d15c9698f797f1cd56a3ab3778ecd4fbad9fc (patch) | |
tree | fb38a4df91789b8d8c334e2589e05423352e23df /src/opengl | |
parent | efe5a9415f69e5a9ab7a46efa91d465616364371 (diff) | |
download | Qt-db5d15c9698f797f1cd56a3ab3778ecd4fbad9fc.zip Qt-db5d15c9698f797f1cd56a3ab3778ecd4fbad9fc.tar.gz Qt-db5d15c9698f797f1cd56a3ab3778ecd4fbad9fc.tar.bz2 |
Fix for loading QPixmaps from file in GL graphics system
QPixmap::load fails if extension (.png) is left out from given
filename when loading a pixmap. QPixmap should try loading with
all supported formats.
Task-number: QTBUG-17328
Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 011d5b6..4f8d647 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -390,29 +390,29 @@ bool QGLPixmapData::fromFile(const QString &filename, const char *format, if (pixelType() == QPixmapData::BitmapType) return QPixmapData::fromFile(filename, format, flags); QFile file(filename); - if (!file.open(QIODevice::ReadOnly)) - return false; - QByteArray data = file.peek(64); - bool alpha; - if (m_texture.canBindCompressedTexture - (data.constData(), data.size(), format, &alpha)) { - resize(0, 0); - data = file.readAll(); - file.close(); - QGLShareContextScope ctx(qt_gl_share_widget()->context()); - QSize size = m_texture.bindCompressedTexture - (data.constData(), data.size(), format); - if (!size.isEmpty()) { - w = size.width(); - h = size.height(); - is_null = false; - d = 32; - m_hasAlpha = alpha; - m_source = QImage(); - m_dirty = isValid(); - return true; + if (file.open(QIODevice::ReadOnly)) { + QByteArray data = file.peek(64); + bool alpha; + if (m_texture.canBindCompressedTexture + (data.constData(), data.size(), format, &alpha)) { + resize(0, 0); + data = file.readAll(); + file.close(); + QGLShareContextScope ctx(qt_gl_share_widget()->context()); + QSize size = m_texture.bindCompressedTexture + (data.constData(), data.size(), format); + if (!size.isEmpty()) { + w = size.width(); + h = size.height(); + is_null = false; + d = 32; + m_hasAlpha = alpha; + m_source = QImage(); + m_dirty = isValid(); + return true; + } + return false; } - return false; } QImage image = QImageReader(filename, format).read(); |