MCPcopy Create free account
hub / github.com/ZDoom/Raze / CreateLineLayout

Method CreateLineLayout

source/common/widgets/errorwindow.cpp:148–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148SpanLayout LogViewer::CreateLineLayout(const std::string& text)
149{
150 SpanLayout layout;
151
152 Colorf curcolor = Colorf::fromRgba8(255, 255, 255);
153 std::string curtext;
154
155 const uint8_t* cptr = (const uint8_t*)text.data();
156 while (int chr = GetCharFromString(cptr))
157 {
158 if (chr != TEXTCOLOR_ESCAPE)
159 {
160 // The bar characters, most commonly used to indicate map changes
161 if (chr >= 0x1D && chr <= 0x1F)
162 {
163 chr = 0x2550; // Box Drawings Double Horizontal
164 }
165 curtext += MakeUTF8(chr);
166 }
167 else
168 {
169 EColorRange range = V_ParseFontColor(cptr, CR_UNTRANSLATED, CR_YELLOW);
170 if (range != CR_UNDEFINED)
171 {
172 if (!curtext.empty())
173 layout.AddText(curtext, font, curcolor);
174 curtext.clear();
175
176 PalEntry color = V_LogColorFromColorRange(range);
177 curcolor = Colorf::fromRgba8(color.r, color.g, color.b);
178 }
179 }
180 }
181
182 curtext.push_back(' ');
183 layout.AddText(curtext, font, curcolor);
184
185 return layout;
186}
187
188void LogViewer::OnPaintFrame(Canvas* canvas)
189{

Callers

nothing calls this directly

Calls 9

MakeUTF8Function · 0.85
V_LogColorFromColorRangeFunction · 0.85
GetCharFromStringFunction · 0.50
V_ParseFontColorFunction · 0.50
dataMethod · 0.45
emptyMethod · 0.45
AddTextMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected