From dcd2debe625841ee8cba6d13a56cde7613c40358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Fri, 19 Jun 2015 16:40:39 +0200 Subject: Enable non-integer device pixel ratio Work around QPaintDevice::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 QPaintDevice::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 QPaintDevice::devicePixelRatio() to use QPainDevice::devicePixelRatioF(). Task-number: QTBUG-46615 Change-Id: I97ec4000fe379b7ff5e1624a871ae2512790aad9 Reviewed-by: Paul Olav Tvete Reviewed-by: Lars Knoll --- src/gui/opengl/qopenglpaintdevice.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui/opengl/qopenglpaintdevice.cpp') diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp index e509b26a95..17a32774d8 100644 --- a/src/gui/opengl/qopenglpaintdevice.cpp +++ b/src/gui/opengl/qopenglpaintdevice.cpp @@ -275,6 +275,9 @@ int QOpenGLPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const return qRound(d_ptr->dpmy * 0.0254); case PdmDevicePixelRatio: return d_ptr->devicePixelRatio; + case PdmDevicePixelRatioScaled: + return d_ptr->devicePixelRatio * QPaintDevice::devicePixelRatioFScale(); + default: qWarning("QOpenGLPaintDevice::metric() - metric %d not known", metric); return 0; -- cgit v1.2.3