From bc91dc48952680c0652a80e15ab3f0b8f87b6374 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 31 Jan 2014 17:23:47 +0100 Subject: 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 --- src/gui/opengl/qopengltexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/opengl/qopengltexture.cpp') diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 8bb78e1557d..76543d1e9f3 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); } /*! -- cgit v1.2.3