qpixmap: Use the primaryScreen for QPixmap::defaultDepth

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>
bb10
Holger Hans Peter Freyther 2011-10-03 10:16:22 +02:00 committed by Qt by Nokia
parent 677cf76340
commit 598d37a2f0
1 changed files with 3 additions and 4 deletions

View 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();
}
/*!