[QStaticTextItem] Drop unused members
The QStaticTextItem's `chars` and `numChars` members are never used, even when set. In fact, there is nothing useful we can do with the input string in the absence of clusters mapping. Change-Id: I81fcbce3e575f4d0dcfc2515286d512b858f592b Reviewed-by: Lars Knoll <lars.knoll@digia.com>bb10
parent
5c5e4582d6
commit
a69b2c0168
|
|
@ -1528,10 +1528,8 @@ void QOpenGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &text
|
|||
|
||||
{
|
||||
QStaticTextItem staticTextItem;
|
||||
staticTextItem.chars = const_cast<QChar *>(ti.chars);
|
||||
staticTextItem.setFontEngine(ti.fontEngine);
|
||||
staticTextItem.glyphs = glyphs.data();
|
||||
staticTextItem.numChars = ti.num_chars;
|
||||
staticTextItem.numGlyphs = glyphs.size();
|
||||
staticTextItem.glyphPositions = positions.data();
|
||||
|
||||
|
|
|
|||
|
|
@ -393,7 +393,7 @@ QSizeF QStaticText::size() const
|
|||
}
|
||||
|
||||
QStaticTextPrivate::QStaticTextPrivate()
|
||||
: textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0),
|
||||
: textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0),
|
||||
needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText),
|
||||
untransformedCoordinates(false)
|
||||
{
|
||||
|
|
@ -401,7 +401,7 @@ QStaticTextPrivate::QStaticTextPrivate()
|
|||
|
||||
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
|
||||
: text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix),
|
||||
items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), textOption(other.textOption),
|
||||
items(0), itemCount(0), glyphPool(0), positionPool(0), textOption(other.textOption),
|
||||
needsRelayout(true), useBackendOptimizations(other.useBackendOptimizations),
|
||||
textFormat(other.textFormat), untransformedCoordinates(other.untransformedCoordinates)
|
||||
{
|
||||
|
|
@ -412,7 +412,6 @@ QStaticTextPrivate::~QStaticTextPrivate()
|
|||
delete[] items;
|
||||
delete[] glyphPool;
|
||||
delete[] positionPool;
|
||||
delete[] charPool;
|
||||
}
|
||||
|
||||
QStaticTextPrivate *QStaticTextPrivate::get(const QStaticText *q)
|
||||
|
|
@ -447,8 +446,6 @@ namespace {
|
|||
QStaticTextItem currentItem;
|
||||
currentItem.setFontEngine(ti.fontEngine);
|
||||
currentItem.font = ti.font();
|
||||
currentItem.charOffset = m_chars.size();
|
||||
currentItem.numChars = ti.num_chars;
|
||||
currentItem.glyphOffset = m_glyphs.size(); // Store offset into glyph pool
|
||||
currentItem.positionOffset = m_glyphs.size(); // Offset into position pool
|
||||
currentItem.useBackendOptimizations = m_useBackendOptimizations;
|
||||
|
|
@ -468,7 +465,6 @@ namespace {
|
|||
|
||||
m_glyphs.resize(m_glyphs.size() + size);
|
||||
m_positions.resize(m_glyphs.size());
|
||||
m_chars.resize(m_chars.size() + ti.num_chars);
|
||||
|
||||
glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset;
|
||||
memcpy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
|
||||
|
|
@ -476,9 +472,6 @@ namespace {
|
|||
QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset;
|
||||
memcpy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
|
||||
|
||||
QChar *charsDestination = m_chars.data() + currentItem.charOffset;
|
||||
memcpy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars);
|
||||
|
||||
m_items.append(currentItem);
|
||||
}
|
||||
|
||||
|
|
@ -510,16 +503,10 @@ namespace {
|
|||
return m_glyphs;
|
||||
}
|
||||
|
||||
QVector<QChar> chars() const
|
||||
{
|
||||
return m_chars;
|
||||
}
|
||||
|
||||
private:
|
||||
QVector<QStaticTextItem> m_items;
|
||||
QVector<QFixedPoint> m_positions;
|
||||
QVector<glyph_t> m_glyphs;
|
||||
QVector<QChar> m_chars;
|
||||
|
||||
bool m_dirtyPen;
|
||||
bool m_useBackendOptimizations;
|
||||
|
|
@ -595,11 +582,6 @@ namespace {
|
|||
return m_paintEngine->items();
|
||||
}
|
||||
|
||||
QVector<QChar> chars() const
|
||||
{
|
||||
return m_paintEngine->chars();
|
||||
}
|
||||
|
||||
private:
|
||||
DrawTextItemRecorder *m_paintEngine;
|
||||
};
|
||||
|
|
@ -677,7 +659,6 @@ void QStaticTextPrivate::init()
|
|||
delete[] items;
|
||||
delete[] glyphPool;
|
||||
delete[] positionPool;
|
||||
delete[] charPool;
|
||||
|
||||
position = QPointF(0, 0);
|
||||
|
||||
|
|
@ -693,7 +674,6 @@ void QStaticTextPrivate::init()
|
|||
QVector<QStaticTextItem> deviceItems = device.items();
|
||||
QVector<QFixedPoint> positions = device.positions();
|
||||
QVector<glyph_t> glyphs = device.glyphs();
|
||||
QVector<QChar> chars = device.chars();
|
||||
|
||||
itemCount = deviceItems.size();
|
||||
items = new QStaticTextItem[itemCount];
|
||||
|
|
@ -704,15 +684,11 @@ void QStaticTextPrivate::init()
|
|||
positionPool = new QFixedPoint[positions.size()];
|
||||
memcpy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
|
||||
|
||||
charPool = new QChar[chars.size()];
|
||||
memcpy(charPool, chars.constData(), chars.size() * sizeof(QChar));
|
||||
|
||||
for (int i=0; i<itemCount; ++i) {
|
||||
items[i] = deviceItems.at(i);
|
||||
|
||||
items[i].glyphs = glyphPool + items[i].glyphOffset;
|
||||
items[i].glyphPositions = positionPool + items[i].positionOffset;
|
||||
items[i].chars = charPool + items[i].charOffset;
|
||||
}
|
||||
|
||||
needsRelayout = false;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public:
|
|||
class Q_GUI_EXPORT QStaticTextItem
|
||||
{
|
||||
public:
|
||||
QStaticTextItem() : chars(0), numChars(0), useBackendOptimizations(false),
|
||||
QStaticTextItem() : useBackendOptimizations(false),
|
||||
userDataNeedsUpdate(0), usesRawFont(0),
|
||||
m_fontEngine(0), m_userData(0) {}
|
||||
|
||||
|
|
@ -83,9 +83,7 @@ public:
|
|||
{
|
||||
glyphPositions = other.glyphPositions;
|
||||
glyphs = other.glyphs;
|
||||
chars = other.chars;
|
||||
numGlyphs = other.numGlyphs;
|
||||
numChars = other.numChars;
|
||||
font = other.font;
|
||||
color = other.color;
|
||||
useBackendOptimizations = other.useBackendOptimizations;
|
||||
|
|
@ -124,29 +122,23 @@ public:
|
|||
union {
|
||||
glyph_t *glyphs; // 4 bytes per glyph
|
||||
int glyphOffset;
|
||||
};
|
||||
union {
|
||||
QChar *chars; // 2 bytes per glyph
|
||||
int charOffset;
|
||||
};
|
||||
// =================
|
||||
// 14 bytes per glyph
|
||||
// 12 bytes per glyph
|
||||
|
||||
// 12 bytes for pointers
|
||||
// 8 bytes for pointers
|
||||
int numGlyphs; // 4 bytes per item
|
||||
int numChars; // 4 bytes per item
|
||||
QFont font; // 8 bytes per item
|
||||
QColor color; // 10 bytes per item
|
||||
char useBackendOptimizations : 1; // 1 byte per item
|
||||
char userDataNeedsUpdate : 1; //
|
||||
char usesRawFont : 1; //
|
||||
// ================
|
||||
// 51 bytes per item
|
||||
|
||||
private: // Needs special handling in setters, so private to avoid abuse
|
||||
QFontEngine *m_fontEngine; // 4 bytes per item
|
||||
QStaticTextUserData *m_userData; // 8 bytes per item
|
||||
|
||||
// ================
|
||||
// 43 bytes per item
|
||||
};
|
||||
|
||||
class QStaticText;
|
||||
|
|
@ -179,7 +171,6 @@ public:
|
|||
|
||||
glyph_t *glyphPool; // 4 bytes per text
|
||||
QFixedPoint *positionPool; // 4 bytes per text
|
||||
QChar *charPool; // 4 bytes per text
|
||||
|
||||
QTextOption textOption; // 28 bytes per text
|
||||
|
||||
|
|
@ -188,7 +179,7 @@ public:
|
|||
unsigned char textFormat : 2;
|
||||
unsigned char untransformedCoordinates : 1;
|
||||
// ================
|
||||
// 195 bytes per text
|
||||
// 191 bytes per text
|
||||
|
||||
static QStaticTextPrivate *get(const QStaticText *q);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1583,10 +1583,8 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
|
|||
|
||||
{
|
||||
QStaticTextItem staticTextItem;
|
||||
staticTextItem.chars = const_cast<QChar *>(ti.chars);
|
||||
staticTextItem.setFontEngine(ti.fontEngine);
|
||||
staticTextItem.glyphs = glyphs.data();
|
||||
staticTextItem.numChars = ti.num_chars;
|
||||
staticTextItem.numGlyphs = glyphs.size();
|
||||
staticTextItem.glyphPositions = positions.data();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue