HiDPI: Fix calculating window mask from pixmap on drag and drop
Use platform window directly for setting a mask to prevent bitmap scaling if pixmap and window DPR are the same. Amends: 42f788ffe26d67864d569c3a3044619d49fc693a Task-number: QTBUG-61948 Change-Id: I5eec85c01f20bdefff7343e83ff10cbcb2c79508 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
2de297f1b7
commit
c5af04cf8a
@ -39,6 +39,8 @@
|
||||
|
||||
#include "qshapedpixmapdndwindow_p.h"
|
||||
|
||||
#include "qplatformwindow.h"
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QGuiApplication>
|
||||
@ -70,7 +72,12 @@ void QShapedPixmapWindow::setPixmap(const QPixmap &pixmap)
|
||||
if (!mask.isNull()) {
|
||||
if (!handle())
|
||||
create();
|
||||
setMask(mask);
|
||||
if (auto platformWindow = handle()) {
|
||||
const auto pixmapDpr = m_pixmap.devicePixelRatio();
|
||||
const auto winDpr = devicePixelRatio();
|
||||
const auto maskSize = (QSizeF(m_pixmap.size()) * winDpr / pixmapDpr).toSize();
|
||||
platformWindow->setMask(QBitmap(mask.scaled(maskSize)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user