summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@qt.io>2020-09-01 13:45:24 +0200
committerMorten Johan Sørvig <morten.sorvig@qt.io>2020-09-10 17:28:11 +0200
commitb3c991ae8f9da6d8eb26f10b3d4ab08587588c9e (patch)
tree8f2ff32cadf9b8733701b8f99229a6135f53f7d7 /src/plugins
parente1ce78d48498a3de21fe4714e92e2c0fcf1a0813 (diff)
Port from devicePixelRatioF() to devicePixelRatio()
This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/wasm/qwasmcompositor.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp4
-rw-r--r--src/plugins/styles/mac/qmacstyle_mac.mm4
-rw-r--r--src/plugins/styles/windowsvista/qwindowsxpstyle.cpp4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/plugins/platforms/wasm/qwasmcompositor.cpp b/src/plugins/platforms/wasm/qwasmcompositor.cpp
index 4ea69a3e78..72fccd4a2b 100644
--- a/src/plugins/platforms/wasm/qwasmcompositor.cpp
+++ b/src/plugins/platforms/wasm/qwasmcompositor.cpp
@@ -456,7 +456,7 @@ void QWasmCompositor::drawFrameWindow(QWasmFrameOptions options, QPainter *paint
const QColor &c4 = options.palette.dark().color();
const QBrush *fill = 0;
- const qreal devicePixelRatio = painter->device()->devicePixelRatioF();
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
const qreal inverseScale = qreal(1) / devicePixelRatio;
painter->scale(inverseScale, inverseScale);
@@ -599,7 +599,7 @@ void QWasmCompositor::drawShadePanel(QWasmTitleBarOptions options, QPainter *pai
int w = options.rect.width();
int h = options.rect.height();
- const qreal devicePixelRatio = painter->device()->devicePixelRatioF();
+ const qreal devicePixelRatio = painter->device()->devicePixelRatio();
if (!qFuzzyCompare(devicePixelRatio, qreal(1))) {
const qreal inverseScale = qreal(1) / devicePixelRatio;
painter->scale(inverseScale, inverseScale);
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 70827cc57d..fe8b6f7085 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -102,7 +102,7 @@ QWindowsPixmapCursorCacheKey::QWindowsPixmapCursorCacheKey(const QCursor &c)
HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot, qreal scaleFactor)
{
HCURSOR cur = nullptr;
- const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatioF();
+ const qreal pixmapScaleFactor = scaleFactor / pixmap.devicePixelRatio();
if (!qFuzzyCompare(pixmapScaleFactor, 1)) {
pixmap = pixmap.scaled((pixmapScaleFactor * QSizeF(pixmap.size())).toSize(),
Qt::KeepAspectRatio, Qt::SmoothTransformation);
@@ -170,7 +170,7 @@ static HCURSOR createBitmapCursor(const QCursor &cursor, qreal scaleFactor = 1)
Q_ASSERT(cursor.shape() == Qt::BitmapCursor && !cursor.bitmap(Qt::ReturnByValue).isNull());
QImage bbits = cursor.bitmap(Qt::ReturnByValue).toImage();
QImage mbits = cursor.mask(Qt::ReturnByValue).toImage();
- scaleFactor /= bbits.devicePixelRatioF();
+ scaleFactor /= bbits.devicePixelRatio();
if (!qFuzzyCompare(scaleFactor, 1)) {
const QSize scaledSize = (QSizeF(bbits.size()) * scaleFactor).toSize();
bbits = bbits.scaled(scaledSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm
index 7b34d3c8a7..88de97ab10 100644
--- a/src/plugins/styles/mac/qmacstyle_mac.mm
+++ b/src/plugins/styles/mac/qmacstyle_mac.mm
@@ -3977,7 +3977,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (needsInactiveHack) {
// First, render tab as non-selected tab on a pixamp
- const qreal pixelRatio = p->device()->devicePixelRatioF();
+ const qreal pixelRatio = p->device()->devicePixelRatio();
QImage tabPixmap(opt->rect.size() * pixelRatio, QImage::Format_ARGB32_Premultiplied);
tabPixmap.setDevicePixelRatio(pixelRatio);
tabPixmap.fill(Qt::transparent);
@@ -5570,7 +5570,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
QPainterPath outerFramePath = d->windowPanelPath(outerFrameRect);
p->fillPath(outerFramePath, opt->palette.dark());
- const auto frameAdjust = 1.0 / p->device()->devicePixelRatioF();
+ const auto frameAdjust = 1.0 / p->device()->devicePixelRatio();
const auto innerFrameRect = outerFrameRect.adjusted(frameAdjust, frameAdjust, -frameAdjust, 0);
QPainterPath innerFramePath = d->windowPanelPath(innerFrameRect);
if (isActive) {
diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
index bbd0401ff1..5039475930 100644
--- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
+++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp
@@ -679,7 +679,7 @@ bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData, qreal correc
bool translucentToplevel = false;
const QPaintDevice *paintDevice = painter->device();
- const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatioF() : qreal(1);
+ const qreal aditionalDevicePixelRatio = themeData.widget ? themeData.widget->devicePixelRatio() : qreal(1);
if (paintDevice->devType() == QInternal::Widget) {
const QWidget *window = static_cast<const QWidget *>(paintDevice)->window();
translucentToplevel = window->testAttribute(Qt::WA_TranslucentBackground);
@@ -2495,7 +2495,7 @@ static void populateMdiButtonTheme(const QStyle *proxy, const QWidget *widget,
// small on High DPI screens (QTBUG-75927).
qreal mdiButtonCorrectionFactor(XPThemeData &theme, const QPaintDevice *pd = nullptr)
{
- const auto dpr = pd ? pd->devicePixelRatioF() : qApp->devicePixelRatio();
+ const auto dpr = pd ? pd->devicePixelRatio() : qApp->devicePixelRatio();
const QSizeF nativeSize = QSizeF(theme.size()) / dpr;
const QSizeF requestedSize(theme.rect.size());
const auto rawFactor = qMin(requestedSize.width() / nativeSize.width(),