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 <Friedemann.Kleint@digia.com>
bb10
Paul Olav Tvete 2014-07-29 12:42:58 +02:00
parent 1a47595d3a
commit 1fec23f927
2 changed files with 0 additions and 11 deletions

View File

@ -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

View File

@ -2028,17 +2028,11 @@ QRegion QWidgetPrivate::clipRegion() const
void QWidgetPrivate::setSystemClip(QPaintDevice *paintDevice, const QRegion &region)
{
// 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