qtextengine: replace qlist with qvla
CoW is not required here Change-Id: Ia0d55dd1e82a225e089ca50f0d3c72bfb52d44f4 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
1427aa6711
commit
621f7c8735
@ -1434,8 +1434,7 @@ void QTextEngine::shapeText(int item) const
|
|||||||
|
|
||||||
// split up the item into parts that come from different font engines
|
// split up the item into parts that come from different font engines
|
||||||
// k * 3 entries, array[k] == index in string, array[k + 1] == index in glyphs, array[k + 2] == engine index
|
// k * 3 entries, array[k] == index in string, array[k + 1] == index in glyphs, array[k + 2] == engine index
|
||||||
QList<uint> itemBoundaries;
|
QVarLengthArray<uint, 24> itemBoundaries;
|
||||||
itemBoundaries.reserve(24);
|
|
||||||
|
|
||||||
QGlyphLayout initialGlyphs = availableGlyphs(&si);
|
QGlyphLayout initialGlyphs = availableGlyphs(&si);
|
||||||
int nGlyphs = initialGlyphs.numGlyphs;
|
int nGlyphs = initialGlyphs.numGlyphs;
|
||||||
@ -1455,9 +1454,9 @@ void QTextEngine::shapeText(int item) const
|
|||||||
for (int i = 0, glyph_pos = 0; i < itemLength; ++i, ++glyph_pos) {
|
for (int i = 0, glyph_pos = 0; i < itemLength; ++i, ++glyph_pos) {
|
||||||
const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
|
const uint engineIdx = initialGlyphs.glyphs[glyph_pos] >> 24;
|
||||||
if (lastEngine != engineIdx) {
|
if (lastEngine != engineIdx) {
|
||||||
itemBoundaries.append(i);
|
itemBoundaries.push_back(i);
|
||||||
itemBoundaries.append(glyph_pos);
|
itemBoundaries.push_back(glyph_pos);
|
||||||
itemBoundaries.append(engineIdx);
|
itemBoundaries.push_back(engineIdx);
|
||||||
|
|
||||||
if (engineIdx != 0) {
|
if (engineIdx != 0) {
|
||||||
QFontEngine *actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
|
QFontEngine *actualFontEngine = static_cast<QFontEngineMulti *>(fontEngine)->engine(engineIdx);
|
||||||
@ -1473,9 +1472,9 @@ void QTextEngine::shapeText(int item) const
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
itemBoundaries.append(0);
|
itemBoundaries.push_back(0);
|
||||||
itemBoundaries.append(0);
|
itemBoundaries.push_back(0);
|
||||||
itemBoundaries.append(0);
|
itemBoundaries.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_CONFIG(harfbuzz)
|
#if QT_CONFIG(harfbuzz)
|
||||||
@ -1597,7 +1596,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
|||||||
const ushort *string,
|
const ushort *string,
|
||||||
int itemLength,
|
int itemLength,
|
||||||
QFontEngine *fontEngine,
|
QFontEngine *fontEngine,
|
||||||
const QList<uint> &itemBoundaries,
|
QSpan<uint> itemBoundaries,
|
||||||
bool kerningEnabled,
|
bool kerningEnabled,
|
||||||
bool hasLetterSpacing,
|
bool hasLetterSpacing,
|
||||||
const QHash<QFont::Tag, quint32> &fontFeatures) const
|
const QHash<QFont::Tag, quint32> &fontFeatures) const
|
||||||
@ -1619,7 +1618,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
|||||||
// ### TODO get_default_for_script?
|
// ### TODO get_default_for_script?
|
||||||
props.language = hb_language_get_default(); // use default language from locale
|
props.language = hb_language_get_default(); // use default language from locale
|
||||||
|
|
||||||
for (int k = 0; k < itemBoundaries.size(); k += 3) {
|
for (qsizetype k = 0; k < itemBoundaries.size(); k += 3) {
|
||||||
const uint item_pos = itemBoundaries[k];
|
const uint item_pos = itemBoundaries[k];
|
||||||
const uint item_length = (k + 4 < itemBoundaries.size() ? itemBoundaries[k + 3] : itemLength) - item_pos;
|
const uint item_length = (k + 4 < itemBoundaries.size() ? itemBoundaries[k + 3] : itemLength) - item_pos;
|
||||||
const uint engineIdx = itemBoundaries[k + 2];
|
const uint engineIdx = itemBoundaries[k + 2];
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "private/qfont_p.h"
|
#include "private/qfont_p.h"
|
||||||
#include "private/qtextformat_p.h"
|
#include "private/qtextformat_p.h"
|
||||||
#include "private/qunicodetools_p.h"
|
#include "private/qunicodetools_p.h"
|
||||||
|
#include "private/qspan_p.h"
|
||||||
#ifndef QT_BUILD_COMPAT_LIB
|
#ifndef QT_BUILD_COMPAT_LIB
|
||||||
#include "private/qtextdocument_p.h"
|
#include "private/qtextdocument_p.h"
|
||||||
#endif
|
#endif
|
||||||
@ -625,7 +626,7 @@ private:
|
|||||||
const ushort *string,
|
const ushort *string,
|
||||||
int itemLength,
|
int itemLength,
|
||||||
QFontEngine *fontEngine,
|
QFontEngine *fontEngine,
|
||||||
const QList<uint> &itemBoundaries,
|
QSpan<uint> itemBoundaries,
|
||||||
bool kerningEnabled,
|
bool kerningEnabled,
|
||||||
bool hasLetterSpacing,
|
bool hasLetterSpacing,
|
||||||
const QHash<QFont::Tag, quint32> &features) const;
|
const QHash<QFont::Tag, quint32> &features) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user