MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / PrepareOverlayImage

Function PrepareOverlayImage

examples/VulkanBenchmark.cpp:355–371  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355static QImage PrepareOverlayImage(const BenchmarkOptions& options, const RenderLayout& layout, const QImage& overlay_base) {
356 QImage scaled = overlay_base.scaled(
357 layout.overlay_width,
358 layout.overlay_height,
359 Qt::IgnoreAspectRatio,
360 Qt::SmoothTransformation);
361
362 QTransform rotation;
363 rotation.rotate(layout.overlay_rotation);
364 QImage rgba = scaled.transformed(rotation, Qt::SmoothTransformation).convertToFormat(QImage::Format_RGBA8888);
365 QPainter alpha_painter(&rgba);
366 alpha_painter.setCompositionMode(QPainter::CompositionMode_DestinationIn);
367 alpha_painter.fillRect(rgba.rect(), QColor(255, 255, 255,
368 static_cast<int>(std::clamp(options.overlay_alpha, 0.0, 1.0) * 255.0)));
369 alpha_painter.end();
370 return rgba;
371}
372
373static TimingStats RunCpuBenchmark(const BenchmarkOptions& options, const QImage& overlay_image) {
374 TimingStats stats;

Callers 3

RunCpuBenchmarkFunction · 0.85
RunCpuCompositeBenchmarkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected