From dfc650410edc8606b59d31887248f7f109b78f22 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Mon, 8 Sep 2025 21:54:57 +1000 Subject: [PATCH] Qt: Use RGB32 format for covers/background As per QPainter documentation, ARGB32 etc is not optimal. https://doc.qt.io/qt-6/qpainter.html#performance --- src/duckstation-qt/gamelistwidget.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/duckstation-qt/gamelistwidget.cpp b/src/duckstation-qt/gamelistwidget.cpp index 06b38e0b8..b59fe96a6 100644 --- a/src/duckstation-qt/gamelistwidget.cpp +++ b/src/duckstation-qt/gamelistwidget.cpp @@ -69,6 +69,10 @@ static constexpr int MEMORY_CARD_ICON_PADDING = 12; static void resizeAndPadImage(QImage* image, int expected_width, int expected_height, bool fill_with_top_left) { + // Get source image in RGB32 format for QPainter. + if (image->format() != QImage::Format_RGB32) + *image = image->convertToFormat(QImage::Format_RGB32); + const qreal dpr = image->devicePixelRatio(); const int dpr_expected_width = static_cast(static_cast(expected_width) * dpr); const int dpr_expected_height = static_cast(static_cast(expected_height) * dpr); @@ -98,7 +102,7 @@ static void resizeAndPadImage(QImage* image, int expected_width, int expected_he if (image_height < dpr_expected_height) yoffs = static_cast(static_cast((dpr_expected_height - image_height) / 2) / dpr); - QImage padded_image(dpr_expected_width, dpr_expected_height, QImage::Format_ARGB32); + QImage padded_image(dpr_expected_width, dpr_expected_height, QImage::Format_RGB32); padded_image.setDevicePixelRatio(dpr); if (fill_with_top_left) padded_image.fill(image->pixel(0, 0));