summaryrefslogtreecommitdiffstats
path: root/src/opengl/qpaintengine_opengl.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-09-09 08:22:55 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-09-09 08:37:58 (GMT)
commit67645790afd965e3fdf312d5233d7c2f0dc3619a (patch)
treef92f4985743c4d141d4dcbee1e764636891df016 /src/opengl/qpaintengine_opengl.cpp
parent252a61de1dda0cb315968875288ff5f2d730621c (diff)
downloadQt-67645790afd965e3fdf312d5233d7c2f0dc3619a.zip
Qt-67645790afd965e3fdf312d5233d7c2f0dc3619a.tar.gz
Qt-67645790afd965e3fdf312d5233d7c2f0dc3619a.tar.bz2
Fixed y-inversion of pixmap drawing on gl graphics system
Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qpaintengine_opengl.cpp')
-rw-r--r--src/opengl/qpaintengine_opengl.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index bf4d4b9..8c545d2 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4335,10 +4335,11 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
} else {
d->flushDrawQueue();
+ QGLTexture *tex;
if (scaled.isNull())
- d->drawable.bindTexture(pm);
+ tex = d->drawable.bindTexture(pm);
else
- d->drawable.bindTexture(scaled);
+ tex = d->drawable.bindTexture(scaled);
updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, d->use_smooth_pixmap_transform);
#ifndef QT_OPENGL_ES
@@ -4351,6 +4352,15 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
GLdouble tc_w = r.width()/pm.width();
GLdouble tc_h = r.height()/pm.height();
+ // Rotate the texture so that it is aligned correctly and the
+ // wrapping is done correctly
+ if (tex->options & QGLContext::InvertedYBindOption) {
+ glMatrixMode(GL_TEXTURE);
+ glPushMatrix();
+ glRotatef(180.0, 0.0, 1.0, 0.0);
+ glRotatef(180.0, 0.0, 0.0, 1.0);
+ }
+
q_vertexType vertexArray[4*2];
q_vertexType texCoordArray[4*2];
@@ -4369,6 +4379,8 @@ void QOpenGLPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, con
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
+ if (tex->options & QGLContext::InvertedYBindOption)
+ glPopMatrix();
glDisable(GL_TEXTURE_2D);
#ifndef QT_OPENGL_ES