qpixmap: Use the primaryScreen for QPixmap::defaultDepth
authorHolger Hans Peter Freyther <zecke@selfish.org>
Mon, 3 Oct 2011 08:16:22 +0000 (10:16 +0200)
committerQt by Nokia <qt-info@nokia.com>
Mon, 3 Oct 2011 09:55:32 +0000 (11:55 +0200)
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 <qt_sanity_bot@ovi.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/image/qpixmap.cpp

index c2b9c6a..0045126 100644 (file)
@@ -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();
 }
 
 /*!