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>bb10
parent
c5ee652278
commit
bc91dc4895
|
|
@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
Loading…
Reference in New Issue