diff options
author | Zack Rusin <zack@kde.org> | 2009-05-11 19:21:14 (GMT) |
---|---|---|
committer | Zack Rusin <zack@kde.org> | 2009-05-11 19:21:14 (GMT) |
commit | 17e1bca1ce366395f8331e16aa96b7176ca1abac (patch) | |
tree | 37edee6fd624bd0da2c45e36f5864d71bf4af29f /src | |
parent | 38809e24a48f6c4b148cd730a8d5d52a7525e5bd (diff) | |
download | Qt-17e1bca1ce366395f8331e16aa96b7176ca1abac.zip Qt-17e1bca1ce366395f8331e16aa96b7176ca1abac.tar.gz Qt-17e1bca1ce366395f8331e16aa96b7176ca1abac.tar.bz2 |
Optimize rendering in the GL engine
By using REPLACE we don't have to clean the stencil on every draw,
effectively optimizing the rendering by 200%.
Diffstat (limited to 'src')
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index aee351d..4259a5c 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -2233,7 +2233,7 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule) // Enable color writes. glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - glStencilMask(0); + glStencilMask(stencilMask); setGradientOps(cbrush, QRectF(QPointF(min_x, min_y), QSizeF(max_x - min_x, max_y - min_y))); @@ -2245,12 +2245,14 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule) // Enable stencil func. glStencilFunc(GL_NOTEQUAL, 0, stencilMask); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); composite(rect); } else { DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Drawing polygon using stencil method (no fragment programs)"; // Enable stencil func. glStencilFunc(GL_NOTEQUAL, 0, stencilMask); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); #ifndef QT_OPENGL_ES glBegin(GL_QUADS); glVertex2f(min_x, min_y); @@ -2261,24 +2263,6 @@ void QOpenGLPaintEnginePrivate::fillVertexArray(Qt::FillRule fillRule) #endif } - glStencilMask(~0); - glStencilFunc(GL_ALWAYS, 0, 0); - glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); - - // clear all stencil values to 0 - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); - -#ifndef QT_OPENGL_ES - glBegin(GL_QUADS); - glVertex2f(min_x, min_y); - glVertex2f(max_x, min_y); - glVertex2f(max_x, max_y); - glVertex2f(min_x, max_y); - glEnd(); -#endif - - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - // Disable stencil writes. glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); glStencilMask(0); |