QPainter: replace an QVector with QVarLengthArray

We usually do not keep a lot of QPainter states, but we need to
call 1 allocation and 1 reallocation for keep 4 states. It will be
better to use QVarLengthArray with preallocation for 8 states.

Change-Id: Iacb6aa7a73807491534b1a915453f218d6e4305b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Mikhail Svetkin 2019-01-03 15:57:37 +01:00
parent 4f598ff062
commit bec8173347

View File

@ -51,6 +51,7 @@
// We mean it.
//
#include <QtCore/qvarlengtharray.h>
#include <QtGui/private/qtguiglobal_p.h>
#include "QtGui/qbrush.h"
#include "QtGui/qfont.h"
@ -202,7 +203,7 @@ public:
QPainterPrivate **d_ptrs;
QPainterState *state;
QVector<QPainterState*> states;
QVarLengthArray<QPainterState *, 8> states;
mutable QPainterDummyState *dummyState;