summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/opengl/qpixmapdata_gl.cpp15
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);