diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-08-17 13:29:02 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-01-14 12:55:45 (GMT) |
commit | 5290c50b240abbcd0477df1db1808d33b96ca856 (patch) | |
tree | f458300ef95d7c51f70d82dfec0b244faad5b14a /src/gui/text/qstatictext_p.h | |
parent | 91e96d6c730aac4accef64e5eaab1b289939ef8e (diff) | |
download | Qt-5290c50b240abbcd0477df1db1808d33b96ca856.zip Qt-5290c50b240abbcd0477df1db1808d33b96ca856.tar.gz Qt-5290c50b240abbcd0477df1db1808d33b96ca856.tar.bz2 |
Support transformations in drawStaticText() and optimize for space
1. Support transformations on the painter in drawStaticText().
Transforming the painter will cause the text layout to be recalculated,
except for translations, which are handled by shifting the position of
the text items.
2. Make const length arrays of the internal data in QStaticTextItem in
order to minimize the memory consumption.
Diffstat (limited to 'src/gui/text/qstatictext_p.h')
-rw-r--r-- | src/gui/text/qstatictext_p.h | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h index 2a8d23a..e1ae80d 100644 --- a/src/gui/text/qstatictext_p.h +++ b/src/gui/text/qstatictext_p.h @@ -63,16 +63,18 @@ class QStaticTextItem public: QStaticTextItem() : chars(0), numChars(0), fontEngine(0) {} - QVarLengthArray<QFixedPoint> glyphPositions; // 8 bytes per glyph - QVarLengthArray<glyph_t> glyphs; // 4 bytes per glyph + // ### Use constant length arrays here to minimize memory consumption + QFixedPoint *glyphPositions; // 8 bytes per glyph + glyph_t *glyphs; // 4 bytes per glyph const QChar *chars; // 2 bytes per glyph // ================= // 14 bytes per glyph + int numGlyphs; // 4 bytes per item int numChars; // 4 bytes per item QFontEngine *fontEngine; // 4 bytes per item // ================ - // 8 bytes per item + // 12 bytes per item }; class QStaticText; @@ -85,16 +87,19 @@ public: void init(); - QAtomicInt ref; // 4 bytes per text + QAtomicInt ref; // 4 bytes per text - QString text; // 4 bytes per text - QFont font; // 8 bytes per text - QSizeF size; // 16 bytes per text + QString text; // 4 bytes per text + QFont font; // 8 bytes per text + QSizeF size; // 16 bytes per text - QStaticTextItem *items; // 4 bytes per text - int itemCount; // 4 bytes per text - // ================ - // 40 bytes per text + 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 + // ================ + // 128 bytes per text static QStaticTextPrivate *get(const QStaticText *q); }; |