diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2014-01-31 17:23:47 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-31 18:57:50 +0100 |
commit | bc91dc48952680c0652a80e15ab3f0b8f87b6374 (patch) | |
tree | 02979cb0b0f3a7334c9343c4abdd31879ec7a4ac /src/gui/opengl/qopengltexture.cpp | |
parent | c5ee652278d3412b146e54589f3073c3a5dd032c (diff) |
QOpenGLTexture: avoid a QImage detach when uploading texture data from it
If the image is already in the right format, converting it to RGBA8888
will be just a refcount increment; but calling bits() will then cause
an unnecessary detach.
Change-Id: I3b06139cd86b74a9082bd0b401a9a14bd4992a10
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/gui/opengl/qopengltexture.cpp')
-rw-r--r-- | src/gui/opengl/qopengltexture.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 8bb78e1557..76543d1e9f 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -2253,7 +2253,7 @@ void QOpenGLTexture::setData(const QImage& image, MipMapGeneration genMipMaps) QImage glImage = image.convertToFormat(QImage::Format_RGBA8888); QOpenGLPixelTransferOptions uploadOptions; uploadOptions.setAlignment(1); - setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, glImage.bits(), &uploadOptions); + setData(0, QOpenGLTexture::RGBA, QOpenGLTexture::UInt8, glImage.constBits(), &uploadOptions); } /*! |