diff options
-rw-r--r-- | src/gui/opengl/qopengltextureuploader.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp index 1147c81471..2428baed93 100644 --- a/src/gui/opengl/qopengltextureuploader.cpp +++ b/src/gui/opengl/qopengltextureuploader.cpp @@ -313,6 +313,11 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag if (newSize != tx.size()) tx = tx.scaled(newSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + // Handle cases where the QImage is actually a sub image of its image data: + qsizetype naturalBpl = ((qsizetype(tx.width()) * tx.depth() + 31) >> 5) << 2; + if (tx.bytesPerLine() != naturalBpl) + tx = tx.copy(tx.rect()); + funcs->glTexImage2D(target, 0, internalFormat, tx.width(), tx.height(), 0, externalFormat, pixelType, tx.constBits()); qsizetype cost = qint64(tx.width()) * tx.height() * tx.depth() / 8; |