From a2f6dd5b670f143bd40e698553e8f7a530c28d86 Mon Sep 17 00:00:00 2001 From: ANK-dev Date: Sun, 31 Aug 2025 00:09:04 -0300 Subject: [PATCH] fix off-by-1 error for memcard editor icon size --- src/duckstation-qt/memorycardeditorwindow.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/duckstation-qt/memorycardeditorwindow.cpp b/src/duckstation-qt/memorycardeditorwindow.cpp index 9e14d1bd1..6dd81ca6f 100644 --- a/src/duckstation-qt/memorycardeditorwindow.cpp +++ b/src/duckstation-qt/memorycardeditorwindow.cpp @@ -37,7 +37,9 @@ static constexpr std::array, 3> MEMORY_CAR {ConsoleRegion::NTSC_J, "BI"}, {ConsoleRegion::PAL, "BE"}, }}; -static constexpr int MEMORY_CARD_ICON_SIZE = MemoryCardImage::ICON_HEIGHT * 2; + +// -1: QRect::width() and QRect::height() are inclusive, needs -1 to compensate. Fixes uneven scaling. +static constexpr int MEMORY_CARD_ICON_SIZE = MemoryCardImage::ICON_HEIGHT * 2 - 1; static constexpr int MEMORY_CARD_ICON_FRAME_DURATION_MS = 200; namespace { @@ -86,8 +88,8 @@ public: // doing this on the UI thread is a bit ehh, but whatever, they're small images. const MemoryCardImage::IconFrame& frame = fi.icon_frames[real_frame_index]; - const int pixmap_width = static_cast(std::ceil(static_cast(rc.width() - 1) * dpr)); - const int pixmap_height = static_cast(std::ceil(static_cast(rc.height() - 1) * dpr)); + const int pixmap_width = static_cast(std::ceil(static_cast(rc.width()) * dpr)); + const int pixmap_height = static_cast(std::ceil(static_cast(rc.height()) * dpr)); const int icon_size = std::min(pixmap_width, pixmap_height); const int xoffs = std::max(static_cast((static_cast(pixmap_width - icon_size) * static_cast(0.5)) / dpr), 0);