From 1b56836c0e7715fb1321c9bd48c8d6fd5b56f217 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Wed, 2 Dec 2009 17:50:11 +1000 Subject: Reduce double-copying of textures when flipping upside down bindTexture() flipped images in-place, to reduce data copying. But there is one case where the in-place is worse: when the QImage is not detached. In that case, the flip was copying the entire image and then flipping the lines, effectively processing the contents twice. The new version uses mirrored() to reduce the overhead for non-detached images. Reviewed-by: Samuel --- src/opengl/qgl.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index d5ca218..5ada125 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2277,13 +2277,21 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G #ifdef QGL_BIND_TEXTURE_DEBUG printf(" - flipping bits over y (%d ms)\n", time.elapsed()); #endif - int ipl = img.bytesPerLine() / 4; - int h = img.height(); - for (int y=0; y