diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-09-09 08:22:55 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-09-09 08:37:58 (GMT) |
commit | 67645790afd965e3fdf312d5233d7c2f0dc3619a (patch) | |
tree | f92f4985743c4d141d4dcbee1e764636891df016 /src/opengl/gl2paintengineex | |
parent | 252a61de1dda0cb315968875288ff5f2d730621c (diff) | |
download | Qt-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/gl2paintengineex')
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 5 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index e24539b..0ad454f 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -423,8 +423,9 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() const QPixmap& texPixmap = currentBrush->texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); + textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1; } brushTextureDirty = false; } @@ -517,7 +518,7 @@ void QGL2PaintEngineExPrivate::updateBrushUniforms() shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::PatternColor), col); } - QSizeF invertedTextureSize( 1.0 / texPixmap.width(), 1.0 / texPixmap.height() ); + QSizeF invertedTextureSize(1.0 / texPixmap.width(), 1.0 * textureInvertedY / texPixmap.height()); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::InvertedTextureSize), invertedTextureSize); QVector2D halfViewportSize(width*0.5, height*0.5); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index cb23b11..2b16019 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -261,6 +261,8 @@ public: bool needsSync; bool inRenderText; + + float textureInvertedY; }; QT_END_NAMESPACE |