summaryrefslogtreecommitdiffstats
path: root/src/opengl/qglpixelbuffer.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-05-19 07:55:08 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-05-25 08:43:48 (GMT)
commit943b709a71b1ffc9abdf459269c79dd1b731d781 (patch)
tree1a89188429b0e8f3a28c27a59a3db1066395dacb /src/opengl/qglpixelbuffer.cpp
parentf8d4c07981e556bf416ccd75e7c460a0b84e4e98 (diff)
downloadQt-943b709a71b1ffc9abdf459269c79dd1b731d781.zip
Qt-943b709a71b1ffc9abdf459269c79dd1b731d781.tar.gz
Qt-943b709a71b1ffc9abdf459269c79dd1b731d781.tar.bz2
Made PixelBuffer/FramebufferObject report correct DPI based metrics.
We need to use both qt_defaultDpiX and qt_defaultDpiY, and round the resulting metric values. Reviewed-by: Trond
Diffstat (limited to 'src/opengl/qglpixelbuffer.cpp')
-rw-r--r--src/opengl/qglpixelbuffer.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index ce7e9bd..efc58f2 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -388,15 +388,16 @@ QPaintEngine *QGLPixelBuffer::paintEngine() const
#endif
}
-extern int qt_defaultDpi();
+extern int qt_defaultDpiX();
+extern int qt_defaultDpiY();
/*! \reimp */
int QGLPixelBuffer::metric(PaintDeviceMetric metric) const
{
Q_D(const QGLPixelBuffer);
- float dpmx = qt_defaultDpi()*100./2.54;
- float dpmy = qt_defaultDpi()*100./2.54;
+ float dpmx = qt_defaultDpiX()*100./2.54;
+ float dpmy = qt_defaultDpiY()*100./2.54;
int w = d->req_size.width();
int h = d->req_size.height();
switch (metric) {
@@ -419,16 +420,16 @@ int QGLPixelBuffer::metric(PaintDeviceMetric metric) const
return 32;//d->depth;
case PdmDpiX:
- return (int)(dpmx * 0.0254);
+ return qRound(dpmx * 0.0254);
case PdmDpiY:
- return (int)(dpmy * 0.0254);
+ return qRound(dpmy * 0.0254);
case PdmPhysicalDpiX:
- return (int)(dpmx * 0.0254);
+ return qRound(dpmx * 0.0254);
case PdmPhysicalDpiY:
- return (int)(dpmy * 0.0254);
+ return qRound(dpmy * 0.0254);
default:
qWarning("QGLPixelBuffer::metric(), Unhandled metric type: %d\n", metric);