From b3c991ae8f9da6d8eb26f10b3d4ab08587588c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 1 Sep 2020 13:45:24 +0200 Subject: Port from devicePixelRatioF() to devicePixelRatio() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø --- src/gui/painting/qcoregraphics.mm | 4 ++-- src/gui/painting/qemulationpaintengine.cpp | 2 +- src/gui/painting/qpaintengineex.cpp | 4 ++-- src/gui/painting/qpainter.cpp | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/gui/painting') 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(©, 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 -- cgit v1.2.3