summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-01-19 10:02:24 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-01-19 10:02:24 (GMT)
commit665a506fbee9f4c39dfe3b577338815270f090c5 (patch)
tree71486a5e5f64e8ca23d0ccfadca45f37e081a2a2
parent0b830897c6256b26289c912e28257d040e9c1b4c (diff)
downloadQt-665a506fbee9f4c39dfe3b577338815270f090c5.zip
Qt-665a506fbee9f4c39dfe3b577338815270f090c5.tar.gz
Qt-665a506fbee9f4c39dfe3b577338815270f090c5.tar.bz2
Optimize speed of QGL2PEXVertexArray
This function is the main performance hog when using QStaticText with the OpenGL engine, so I've improved on it a little by removing the conversion from (qreal,qreal) -> QPointF -> QGLPoint. Since the function is called so often, it has an impact on drawStaticText().
-rw-r--r--src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
index 516b847..3f08dbe 100644
--- a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
+++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp
@@ -63,8 +63,17 @@ QGLRect QGL2PEXVertexArray::boundingRect() const
void QGL2PEXVertexArray::addRect(const QRectF &rect)
{
- vertexArray << rect.topLeft() << rect.topRight() << rect.bottomRight()
- << rect.bottomRight() << rect.bottomLeft() << rect.topLeft();
+ qreal top = rect.top();
+ qreal left = rect.left();
+ qreal bottom = rect.bottom();
+ qreal right = rect.right();
+
+ vertexArray << QGLPoint(left, top)
+ << QGLPoint(right, top)
+ << QGLPoint(right, bottom)
+ << QGLPoint(right, bottom)
+ << QGLPoint(left, bottom)
+ << QGLPoint(left, top);
}
void QGL2PEXVertexArray::addClosingLine(int index)