summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2014-11-22 06:03:52 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2014-12-14 05:29:25 +0100
commita69b2c01684756c959de7645451f02397ca19b51 (patch)
tree220ffaf0e8211234007f982a5a945457f531ec6a /src/gui/text
parent5c5e4582d60ce38868e838bced73f52febec5841 (diff)
[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>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qstatictext.cpp28
-rw-r--r--src/gui/text/qstatictext_p.h21
2 files changed, 8 insertions, 41 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 6f1916afc6..913cd08a0e 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -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;
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 29db8836d9..694a2e4baa 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -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;
@@ -125,28 +123,22 @@ public:
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);
};