From 1fec23f9276fe80ea8973bba1f3d2870658a8199 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Tue, 29 Jul 2014 12:42:58 +0200 Subject: [PATCH] Enable devicePixelRatio for non-Apple platforms Remove #ifdef Q_OS_MAC around devicePixelRatio code. We are planning to make it available on other platforms. Task-number: QTBUG-38858 Change-Id: I25230cb53ea1291095335ef5883b15087e44f6b8 Reviewed-by: Friedemann Kleint --- src/gui/painting/qpainter.cpp | 5 ----- src/widgets/kernel/qwidget.cpp | 6 ------ 2 files changed, 11 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 7c691c9670..8b2c315e58 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -229,16 +229,11 @@ QTransform QPainterPrivate::viewTransform() const int QPainterPrivate::effectiveDevicePixelRatio() const { - // Limited feature introduction for Qt 5.0.0, remove ifdef in a later release. -#ifdef Q_OS_MAC // Special cases for devices that does not support PdmDevicePixelRatio go here: if (device->devType() == QInternal::Printer) return 1; return qMax(1, device->metric(QPaintDevice::PdmDevicePixelRatio)); -#else - return 1; -#endif } QTransform QPainterPrivate::hidpiScaleTransform() const diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 05e638574d..95964bfb9d 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -2028,17 +2028,11 @@ QRegion QWidgetPrivate::clipRegion() const void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion ®ion) { // Transform the system clip region from device-independent pixels to device pixels -// Qt 5.0.0: This is a Mac-only code path for now, can be made cross-platform once -// it has been tested. QPaintEngine *paintEngine = paintDevice->paintEngine(); -#ifdef Q_OS_MAC QTransform scaleTransform; const qreal devicePixelRatio = paintDevice->devicePixelRatio(); scaleTransform.scale(devicePixelRatio, devicePixelRatio); paintEngine->d_func()->systemClip = scaleTransform.map(region); -#else - paintEngine->d_func()->systemClip = region; -#endif } #ifndef QT_NO_GRAPHICSEFFECT