aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2013-06-12 10:11:06 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-12 11:07:14 +0200
commite99cb6767b54aa9b082c4fd8bef93760c563da59 (patch)
tree10ba045d59e03443f688a30e375fdd5d63a854dd
parent1261b75a36fc330f182dd1c3b34a2b4a0d439a80 (diff)
Support unaligned QImage strides in QSGTexture
If a QImage has a different stride than its width, copy the image to relayout the memory for compatibility with glTexImage2D(). Change-Id: I74338da97d785ffb9e00820caff36466dfa46838 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index a104e4af2f..a69f43f8d6 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -663,6 +663,8 @@ void QSGPlainTexture::bind()
QImage tmp = (m_image.format() == QImage::Format_RGB32 || m_image.format() == QImage::Format_ARGB32_Premultiplied)
? m_image
: m_image.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ if (tmp.width() * 4 != tmp.bytesPerLine())
+ tmp = tmp.copy();
#ifndef QSG_NO_RENDER_TIMING
qint64 convertTime = 0;