Respect device pixel ratio when scaling card imgs (#4467)
This commit is contained in:
parent
26acfd5102
commit
5652b56b45
1 changed files with 5 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue