| 320 | } |
| 321 | |
| 322 | static RenderLayout ComputeRenderLayout(const BenchmarkOptions& options, int input_width, int input_height) { |
| 323 | RenderLayout layout; |
| 324 | if (options.output_width > 0 && options.output_height > 0) { |
| 325 | layout.output_width = options.output_width; |
| 326 | layout.output_height = options.output_height; |
| 327 | } else if (options.mode == "export") { |
| 328 | layout.output_width = input_width; |
| 329 | layout.output_height = input_height; |
| 330 | } else { |
| 331 | const double width_scale = static_cast<double>(options.preview_width) / std::max(1, input_width); |
| 332 | const double height_scale = static_cast<double>(options.preview_height) / std::max(1, input_height); |
| 333 | const double scale = std::min(width_scale, height_scale); |
| 334 | layout.output_width = std::max(1, static_cast<int>(std::lround(input_width * scale))); |
| 335 | layout.output_height = std::max(1, static_cast<int>(std::lround(input_height * scale))); |
| 336 | } |
| 337 | |
| 338 | layout.overlay_width = std::max(48, static_cast<int>(std::lround(layout.output_width * 0.28))); |
| 339 | layout.overlay_height = std::max(27, static_cast<int>(std::lround(layout.overlay_width * 9.0 / 16.0))); |
| 340 | layout.overlay_x = std::max(0, layout.output_width - layout.overlay_width - 24); |
| 341 | layout.overlay_y = 24; |
| 342 | layout.overlay_rotation = options.overlay_rotation; |
| 343 | return layout; |
| 344 | } |
| 345 | |
| 346 | static QImage LoadOverlayImage(const BenchmarkOptions& options) { |
| 347 | QImage overlay(QString::fromStdString(options.overlay_path)); |
no outgoing calls
no test coverage detected