From 3cede847c39269374c52dcf156dc982d7a51f29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Wed, 28 May 2014 11:21:29 +0200 Subject: WIP: Add PdmDevicePixelRatioScaled. Work around QPainDevice::metric's int return type by adding a new metric that returns a scaled devicePixelRatio. Choose a scale factor that gives us more than enough range. The QPainDevice::devicePixelRatio() convenience accessor is public API and can unfortunately not be changed to return a qreal. Add devicePixelRatioF() which returns the (unscaled) devicePixelRatio. Change all call sites of QPainDevice::devicePixelRatio() to use QPainDevice::devicePixelRatioF(). Task-number: QTBUG-38858 Change-Id: Ia97c24e1c7b10241d6425fab2fa513702bb750b8 --- src/widgets/styles/qmacstyle_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/widgets/styles') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 67970ba33d..95a41b4830 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1989,7 +1989,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD } } - int devicePixelRatio = p->device()->devicePixelRatio(); + int devicePixelRatio = p->device()->devicePixelRatioF(); int width = devicePixelRatio * (int(macRect.size.width) + extraWidth); int height = devicePixelRatio * (int(macRect.size.height) + extraHeight); @@ -7216,7 +7216,7 @@ CGContextRef qt_mac_cg_context(const QPaintDevice *pdev) } CGContextTranslateCTM(ret, 0, pm->height()); - int devicePixelRatio = pdev->devicePixelRatio(); + qreal devicePixelRatio = pdev->devicePixelRatioF(); CGContextScaleCTM(ret, devicePixelRatio, devicePixelRatio); CGContextScaleCTM(ret, 1, -1); return ret; -- cgit v1.2.3