| 146 | } |
| 147 | |
| 148 | SpanLayout 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 | |
| 188 | void LogViewer::OnPaintFrame(Canvas* canvas) |
| 189 | { |
nothing calls this directly
no test coverage detected