QWindowsUiaTextRangeProvider: replace ephemeral QList<QRect> with QVLA

QList<QRect> is horribly inefficient™. Since the container only lives
for the duration of the function call, use QVLA instead.

Change-Id: I2d179caef37bb78efface5547ff8bfcdc8f9a6ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Marc Mutz 2019-09-04 23:25:35 +02:00
parent 4ac872639e
commit c2e32a29c3

View File

@ -48,6 +48,7 @@
#include <QtGui/qaccessible.h> #include <QtGui/qaccessible.h>
#include <QtCore/qloggingcategory.h> #include <QtCore/qloggingcategory.h>
#include <QtCore/qstring.h> #include <QtCore/qstring.h>
#include <QtCore/qvarlengtharray.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -227,7 +228,7 @@ HRESULT QWindowsUiaTextRangeProvider::GetBoundingRectangles(SAFEARRAY **pRetVal)
return UIA_E_ELEMENTNOTAVAILABLE; return UIA_E_ELEMENTNOTAVAILABLE;
int len = textInterface->characterCount(); int len = textInterface->characterCount();
QList<QRect> rectList; QVarLengthArray<QRect> rectList;
if ((m_startOffset >= 0) && (m_endOffset <= len) && (m_startOffset < m_endOffset)) { if ((m_startOffset >= 0) && (m_endOffset <= len) && (m_startOffset < m_endOffset)) {
int start, end; int start, end;