* Extract the resolution from the given string and store * it in the 'res' parameter. * @param res variable to store the resolution in. * @param s the string to decompose. */
| 272 | * @param s the string to decompose. |
| 273 | */ |
| 274 | static void ParseResolution(Dimension &res, std::string_view s) |
| 275 | { |
| 276 | StringConsumer consumer(s); |
| 277 | auto width = consumer.TryReadIntegerBase<uint>(10); |
| 278 | auto valid = consumer.ReadIf("x"); |
| 279 | auto height = consumer.TryReadIntegerBase<uint>(10); |
| 280 | if (!width.has_value() || !valid || !height.has_value() || consumer.AnyBytesLeft()) { |
| 281 | ShowInfo("Invalid resolution '{}'", s); |
| 282 | return; |
| 283 | } |
| 284 | |
| 285 | res.width = std::max<uint>(*width, 64); |
| 286 | res.height = std::max<uint>(*height, 64); |
| 287 | } |
| 288 | |
| 289 | |
| 290 | /** |
no test coverage detected