1 From 87777f7c0f4c3e338d23d2c3d368a8a484a35a6e Mon Sep 17 00:00:00 2001
2 From: Rhys Weatherley <rhys.weatherley@nokia.com>
3 Date: Fri, 18 Dec 2009 15:01:07 +1000
4 Subject: [PATCH 1157/1244] Align GL_RGB lines on a 4-byte boundary when uploading pixmap textures
6 Previous code was aligning lines on a 3-byte boundary.
8 Task-number: QTBUG-6902
9 Reviewed-by: Julian de Bhal
11 src/opengl/qpixmapdata_gl.cpp | 15 ++-------------
12 1 files changed, 2 insertions(+), 13 deletions(-)
14 diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
15 index 4e1d50d..92c990b 100644
16 --- a/src/opengl/qpixmapdata_gl.cpp
17 +++ b/src/opengl/qpixmapdata_gl.cpp
18 @@ -341,22 +341,11 @@ void QGLPixmapData::ensureCreated() const
20 if (!m_source.isNull()) {
21 if (external_format == GL_RGB) {
22 - QImage tx = m_source.convertToFormat(QImage::Format_RGB32);
24 - QVector<uchar> pixelData(w * h * 3);
25 - uchar *p = &pixelData[0];
26 - QRgb *src = (QRgb *)tx.bits();
28 - for (int i = 0; i < w * h; ++i) {
30 - *p++ = qGreen(*src);
34 + const QImage tx = m_source.convertToFormat(QImage::Format_RGB888);
36 glBindTexture(target, m_texture.id);
37 glTexSubImage2D(target, 0, 0, 0, w, h, external_format,
38 - GL_UNSIGNED_BYTE, &pixelData[0]);
39 + GL_UNSIGNED_BYTE, tx.bits());
41 const QImage tx = ctx->d_func()->convertToGLFormat(m_source, true, external_format);