summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
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/gui/painting
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/gui/painting')
-rw-r--r--src/gui/painting/qcoregraphics.mm4
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp2
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp6
4 files changed, 8 insertions, 8 deletions
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index 0030e8e29c..302fa1b049 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -145,7 +145,7 @@ QT_END_NAMESPACE
// NSImage.
auto nsImage = [[NSImage alloc] initWithSize:NSZeroSize];
auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- imageRep.size = (image.size() / image.devicePixelRatioF()).toCGSize();
+ imageRep.size = (image.size() / image.devicePixelRatio()).toCGSize();
[nsImage addRepresentation:[imageRep autorelease]];
Q_ASSERT(CGSizeEqualToSize(nsImage.size, imageRep.size));
@@ -178,7 +178,7 @@ QT_END_NAMESPACE
continue;
auto *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
- imageRep.size = (image.size() / image.devicePixelRatioF()).toCGSize();
+ imageRep.size = (image.size() / image.devicePixelRatio()).toCGSize();
[nsImage addRepresentation:[imageRep autorelease]];
}
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index a97cdf0b30..e3c34ed533 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -103,7 +103,7 @@ void QEmulationPaintEngine::fill(const QVectorPath &path, const QBrush &brush)
return;
}
} else if (style == Qt::TexturePattern) {
- qreal dpr = qHasPixmapTexture(brush) ? brush.texture().devicePixelRatioF() : brush.textureImage().devicePixelRatioF();
+ qreal dpr = qHasPixmapTexture(brush) ? brush.texture().devicePixelRatio() : brush.textureImage().devicePixelRatio();
if (!qFuzzyCompare(dpr, qreal(1.0))) {
QBrush copy = brush;
combineXForm(&copy, QRectF(0, 0, 1.0/dpr, 1.0/dpr));
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index d2d6b99f67..8b91f13bde 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -951,8 +951,8 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con
{
QBrush brush(state()->pen.color(), pixmap);
QTransform xform = QTransform::fromTranslate(r.x() - s.x(), r.y() - s.y());
- if (!qFuzzyCompare(pixmap.devicePixelRatioF(), qreal(1.0)))
- xform.scale(1.0/pixmap.devicePixelRatioF(), 1.0/pixmap.devicePixelRatioF());
+ if (!qFuzzyCompare(pixmap.devicePixelRatio(), qreal(1.0)))
+ xform.scale(1.0/pixmap.devicePixelRatio(), 1.0/pixmap.devicePixelRatio());
brush.setTransform(xform);
qreal pts[] = { r.x(), r.y(),
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 077e28b3e0..175c576111 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -197,9 +197,9 @@ void QPainterPrivate::checkEmulation()
if (state->brush.style() == Qt::TexturePattern) {
if (qHasPixmapTexture(state->brush))
- doEmulation |= !qFuzzyCompare(state->brush.texture().devicePixelRatioF(), qreal(1.0));
+ doEmulation |= !qFuzzyCompare(state->brush.texture().devicePixelRatio(), qreal(1.0));
else
- doEmulation |= !qFuzzyCompare(state->brush.textureImage().devicePixelRatioF(), qreal(1.0));
+ doEmulation |= !qFuzzyCompare(state->brush.textureImage().devicePixelRatio(), qreal(1.0));
}
if (doEmulation && extended->flags() & QPaintEngineEx::DoNotEmulate)
@@ -242,7 +242,7 @@ qreal QPainterPrivate::effectiveDevicePixelRatio() const
if (device->devType() == QInternal::Printer)
return qreal(1);
- return qMax(qreal(1), device->devicePixelRatioF());
+ return qMax(qreal(1), device->devicePixelRatio());
}
QTransform QPainterPrivate::hidpiScaleTransform() const