diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-12-18 05:01:07 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-12-18 05:01:07 (GMT) |
commit | 87777f7c0f4c3e338d23d2c3d368a8a484a35a6e (patch) | |
tree | 05dceecdd8d3cbea488d779fed689d99980f6654 /src/opengl/qpixmapdata_gl.cpp | |
parent | 12a4be8cfea62249fd44a1e0c60642972a48f17e (diff) | |
download | Qt-87777f7c0f4c3e338d23d2c3d368a8a484a35a6e.zip Qt-87777f7c0f4c3e338d23d2c3d368a8a484a35a6e.tar.gz Qt-87777f7c0f4c3e338d23d2c3d368a8a484a35a6e.tar.bz2 |
Align GL_RGB lines on a 4-byte boundary when uploading pixmap textures
Previous code was aligning lines on a 3-byte boundary.
Task-number: QTBUG-6902
Reviewed-by: Julian de Bhal
Diffstat (limited to 'src/opengl/qpixmapdata_gl.cpp')
-rw-r--r-- | src/opengl/qpixmapdata_gl.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index 4e1d50d..92c990b 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -341,22 +341,11 @@ void QGLPixmapData::ensureCreated() const if (!m_source.isNull()) { if (external_format == GL_RGB) { - QImage tx = m_source.convertToFormat(QImage::Format_RGB32); - - QVector<uchar> pixelData(w * h * 3); - uchar *p = &pixelData[0]; - QRgb *src = (QRgb *)tx.bits(); - - for (int i = 0; i < w * h; ++i) { - *p++ = qRed(*src); - *p++ = qGreen(*src); - *p++ = qBlue(*src); - ++src; - } + const QImage tx = m_source.convertToFormat(QImage::Format_RGB888); glBindTexture(target, m_texture.id); glTexSubImage2D(target, 0, 0, 0, w, h, external_format, - GL_UNSIGNED_BYTE, &pixelData[0]); + GL_UNSIGNED_BYTE, tx.bits()); } else { const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format); |