From 598d37a2f03db618e18a0f9ea320cea8405d83c0 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 3 Oct 2011 10:16:22 +0200 Subject: qpixmap: Use the primaryScreen for QPixmap::defaultDepth MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently tst_QPixmap::testMetrics can fail if the native display resolution is below 32 bpp. Upate the documentation, use the primary screen to find the depth. Tested-on: XCB and directFB plugin. Change-Id: I29c08db25d8f6bcee01f9315ed90685fef668e0c Merge-request: 61 Reviewed-on: http://codereview.qt-project.org/5917 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/gui/image/qpixmap.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c2b9c6a1b9..00451268f3 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -59,6 +59,7 @@ #include "qimagereader.h" #include "qimagewriter.h" #include "qpaintengine.h" +#include "qscreen.h" #include "qthread.h" #include "qdebug.h" @@ -1648,16 +1649,14 @@ QBitmap QPixmap::mask() const /*! Returns the default pixmap depth used by the application. - On Windows and Mac, the default depth is always 32. On X11 and - embedded, the depth of the screen will be returned by this - function. + On all platforms the depth of the primary screen will be returned. \sa depth(), QColormap::depth(), {QPixmap#Pixmap Information}{Pixmap Information} */ int QPixmap::defaultDepth() { - return 32; // LITE: ### use QPlatformScreen (we should do that in general) + return QGuiApplication::primaryScreen()->depth(); } /*! -- cgit v1.2.3