From 665a506fbee9f4c39dfe3b577338815270f090c5 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 19 Jan 2010 11:02:24 +0100 Subject: 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(). --- src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp | 13 +++++++++++-- 1 file 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) -- cgit v0.12