MCPcopy Create free account
hub / github.com/MyGUI/mygui / update

Method update

MyGUIEngine/src/MyGUI_TextView.cpp:90–280  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88 };
89
90 void TextView::update(
91 const UString::utf32string& _text,
92 IFont* _font,
93 int _height,
94 Align _align,
95 VertexColourType _format,
96 int _maxWidth)
97 {
98 mFontHeight = _height;
99
100 // массив для быстрой конвертации цветов
101 static const char convert_colour[64] = {
102 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0,
103 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0};
104
105 mViewSize.clear();
106
107 RollBackPoint roll_back;
108 IntSize result;
109 float width = 0.0f;
110 size_t count = 0;
111 mLength = 0;
112 mLineInfo.clear();
113 LineInfo line_info;
114 int font_height = _font->getDefaultHeight();
115
116 UString::utf32string::const_iterator end = _text.end();
117 UString::utf32string::const_iterator index = _text.begin();
118
119 /*if (index == end)
120 return;*/
121
122 result.height += _height;
123
124 for (; index != end; ++index)
125 {
126 Char character = *index;
127
128 // new line
129 if (character == FontCodeType::CR || character == FontCodeType::NEL || character == FontCodeType::LF)
130 {
131 if (character == FontCodeType::CR)
132 {
133 UString::utf32string::const_iterator peeki = index;
134 ++peeki;
135 if ((peeki != end) && (*peeki == FontCodeType::LF))
136 index = peeki; // skip both as one newline
137 }
138
139 line_info.width = (int)std::ceil(width);
140 line_info.count = count;
141 mLength += line_info.count + 1;
142
143 result.height += _height;
144 setMax(result.width, line_info.width);
145 width = 0;
146 count = 0;
147

Callers 1

updateRawDataMethod · 0.45

Calls 15

convertColourFunction · 0.85
getTextIterMethod · 0.80
setMaxFunction · 0.70
clearMethod · 0.45
getDefaultHeightMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
getGlyphInfoMethod · 0.45
setMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected