Support fractional scaling when scaling card images (#4962)

Fixes #4880
This commit is contained in:
Basile Clement 2023-12-14 14:24:35 +01:00 committed by GitHub
parent 78a928464c
commit cb18a55338
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -621,7 +621,7 @@ void PictureLoader::getPixmap(QPixmap &pixmap, CardInfoPtr card, QSize size)
QPixmap bigPixmap; QPixmap bigPixmap;
if (QPixmapCache::find(key, &bigPixmap)) { if (QPixmapCache::find(key, &bigPixmap)) {
QScreen *screen = qApp->primaryScreen(); QScreen *screen = qApp->primaryScreen();
int dpr = screen->devicePixelRatio(); qreal dpr = screen->devicePixelRatio();
pixmap = bigPixmap.scaled(size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation); pixmap = bigPixmap.scaled(size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation);
pixmap.setDevicePixelRatio(dpr); pixmap.setDevicePixelRatio(dpr);
QPixmapCache::insert(sizeKey, pixmap); QPixmapCache::insert(sizeKey, pixmap);