mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-12 23:59:34 -08:00
Respect device pixel ratio when scaling card imgs (#4467)
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
#include "thememanager.h"
|
#include "thememanager.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QScreen>
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
@@ -572,7 +573,10 @@ void PictureLoader::getPixmap(QPixmap &pixmap, CardInfoPtr card, QSize size)
|
|||||||
// load the image and create a copy of the correct size
|
// load the image and create a copy of the correct size
|
||||||
QPixmap bigPixmap;
|
QPixmap bigPixmap;
|
||||||
if (QPixmapCache::find(key, &bigPixmap)) {
|
if (QPixmapCache::find(key, &bigPixmap)) {
|
||||||
pixmap = bigPixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
QScreen * screen = qApp->primaryScreen();
|
||||||
|
int dpr = screen->devicePixelRatio();
|
||||||
|
pixmap = bigPixmap.scaled(size * dpr, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||||
|
pixmap.setDevicePixelRatio(dpr);
|
||||||
QPixmapCache::insert(sizeKey, pixmap);
|
QPixmapCache::insert(sizeKey, pixmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user