OSDN Git Service

remove unused QTextEngine methods
[kde/Katie.git] / src / gui / text / qstatictext_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2015 The Qt Company Ltd.
4 ** Copyright (C) 2016 Ivailo Monev
5 **
6 ** This file is part of the test suite of the Katie Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 **
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser
12 ** General Public License version 2.1 as published by the Free Software
13 ** Foundation and appearing in the file LICENSE.LGPL included in the
14 ** packaging of this file.  Please review the following information to
15 ** ensure the GNU Lesser General Public License version 2.1 requirements
16 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** $QT_END_LICENSE$
19 **
20 ****************************************************************************/
21
22 #ifndef QSTATICTEXT_P_H
23 #define QSTATICTEXT_P_H
24
25 //
26 //  W A R N I N G
27 //  -------------
28 //
29 // This file is not part of the Katie API.  It exists for the convenience
30 // of internal files.  This header file may change from version to version
31 // without notice, or even be removed.
32 //
33 // We mean it.
34 //
35
36 #include "qstatictext.h"
37
38 #include "qfontengine_p.h"
39 #include <QtGui/qcolor.h>
40
41 QT_BEGIN_NAMESPACE
42
43 class Q_GUI_EXPORT QStaticTextItem
44 {
45 public:
46     QStaticTextItem() : chars(nullptr), numChars(0), m_fontEngine(nullptr) {}
47
48     QStaticTextItem(const QStaticTextItem &other)
49     {
50         operator=(other);
51     }
52
53     void operator=(const QStaticTextItem &other)
54     {
55         glyphPositions = other.glyphPositions;
56         glyphs = other.glyphs;
57         chars = other.chars;
58         numGlyphs = other.numGlyphs;
59         numChars = other.numChars;
60         font = other.font;
61         color = other.color;
62
63         m_fontEngine = nullptr;
64         setFontEngine(other.fontEngine());
65     }
66
67     ~QStaticTextItem();
68
69     void setFontEngine(QFontEngine *fe);
70     QFontEngine *fontEngine() const { return m_fontEngine; }
71
72     union {
73         QFixedPoint *glyphPositions;             // 8 bytes per glyph
74         int positionOffset;
75     };
76     union {
77         glyph_t *glyphs;                         // 4 bytes per glyph
78         int glyphOffset;
79     };
80     union {
81         QChar *chars;                            // 2 bytes per glyph
82         int charOffset;
83     };
84                                                  // =================
85                                                  // 14 bytes per glyph
86
87                                                  // 12 bytes for pointers
88     int numGlyphs;                               // 4 bytes per item
89     int numChars;                                // 4 bytes per item
90     QFont font;                                  // 8 bytes per item
91     QColor color;                                // 10 bytes per item
92                                                  // ================
93                                                  // 51 bytes per item
94
95 private: // Needs special handling in setters, so private to avoid abuse
96     QFontEngine *m_fontEngine;                     // 4 bytes per item
97 };
98
99 class QStaticText;
100 class Q_AUTOTEST_EXPORT QStaticTextPrivate
101 {
102 public:
103     QStaticTextPrivate();
104     QStaticTextPrivate(const QStaticTextPrivate &other);
105     ~QStaticTextPrivate();
106
107     void init();
108     void paintText(const QPointF &pos, QPainter *p);
109
110     void invalidate()
111     {
112         needsRelayout = true;
113     }
114
115     QAtomicInt ref;                      // 4 bytes per text
116
117     QString text;                        // 4 bytes per text
118     QFont font;                          // 8 bytes per text
119     qreal textWidth;                     // 8 bytes per text
120     QSizeF actualSize;                   // 16 bytes per text
121     QPointF position;                    // 16 bytes per text
122
123     QTransform matrix;                   // 80 bytes per text
124     QStaticTextItem *items;              // 4 bytes per text
125     int itemCount;                       // 4 bytes per text
126
127     glyph_t *glyphPool;                  // 4 bytes per text
128     QFixedPoint *positionPool;           // 4 bytes per text
129     QChar *charPool;                     // 4 bytes per text
130
131     QTextOption textOption;              // 28 bytes per text
132
133     bool needsRelayout;                  // 1 byte per text
134     Qt::TextFormat textFormat;
135     bool untransformedCoordinates;
136                                          // ================
137                                          // 195 bytes per text
138
139     static QStaticTextPrivate *get(const QStaticText *q);
140 };
141
142 QT_END_NAMESPACE
143
144 #endif // QSTATICTEXT_P_H