summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext_p.h
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-27 07:08:14 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-05-27 07:41:52 (GMT)
commit7cc8e62f74f66f20c216a8bc8c3187c989a3dcb4 (patch)
tree94156a2ff64389bbddd08b7275ed69a12fcd37b4 /src/gui/text/qstatictext_p.h
parent11a8c52498e8dc74fdfef48e953055338c8f18d7 (diff)
downloadQt-7cc8e62f74f66f20c216a8bc8c3187c989a3dcb4.zip
Qt-7cc8e62f74f66f20c216a8bc8c3187c989a3dcb4.tar.gz
Qt-7cc8e62f74f66f20c216a8bc8c3187c989a3dcb4.tar.bz2
Optimize initialization of QStaticText
Since QStaticText would be created once and used often, not much thought was put into optimizing its initialization. For simplicity, the code would do two drawText() passes. Since this was an unnecessary overhead, the extra pass has been removed and replaced by memmoves instead. Initialization is now twice as fast. Reviewed-by: Samuel
Diffstat (limited to 'src/gui/text/qstatictext_p.h')
-rw-r--r--src/gui/text/qstatictext_p.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index f017ed1..2ab5579 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -88,9 +88,18 @@ public:
userData = newUserData;
}
- QFixedPoint *glyphPositions; // 8 bytes per glyph
- glyph_t *glyphs; // 4 bytes per glyph
- const QChar *chars; // 2 bytes per glyph
+ union {
+ QFixedPoint *glyphPositions; // 8 bytes per glyph
+ int positionOffset;
+ };
+ union {
+ glyph_t *glyphs; // 4 bytes per glyph
+ int glyphOffset;
+ };
+ union {
+ QChar *chars; // 2 bytes per glyph
+ int charOffset;
+ };
// =================
// 14 bytes per glyph
@@ -134,14 +143,16 @@ public:
QTransform matrix; // 80 bytes per text
QStaticTextItem *items; // 4 bytes per text
int itemCount; // 4 bytes per text
+
glyph_t *glyphPool; // 4 bytes per text
QFixedPoint *positionPool; // 4 bytes per text
+ QChar *charPool; // 4 bytes per text
unsigned char needsRelayout : 1;
unsigned char useBackendOptimizations : 1; // 1 byte per text
unsigned char textFormat : 2;
// ================
- // 163 bytes per text
+ // 167 bytes per text
static QStaticTextPrivate *get(const QStaticText *q);
};