diff options
Diffstat (limited to 'src/gui/image/qpixmap.cpp')
-rw-r--r-- | src/gui/image/qpixmap.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c6d8d19bb1..2d41ca7e24 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -1511,7 +1511,8 @@ QBitmap QPixmap::mask() const return QBitmap(); const QImage img = toImage(); - const QImage image = (img.depth() < 32 ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img); + bool shouldConvert = (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32_Premultiplied); + const QImage image = (shouldConvert ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img); const int w = image.width(); const int h = image.height(); @@ -1723,8 +1724,19 @@ QPlatformPixmap* QPixmap::handle() const #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QPixmap &r) { - dbg.nospace() << "QPixmap(" << r.size() << ')'; - return dbg.space(); + QDebugStateSaver saver(dbg); + dbg.resetFormat(); + dbg.nospace(); + dbg << "QPixmap("; + if (r.isNull()) { + dbg << "null"; + } else { + dbg << r.size() << ",depth=" << r.depth() + << ",devicePixelRatio=" << r.devicePixelRatio() + << ",cacheKey=" << showbase << hex << r.cacheKey() << dec << noshowbase; + } + dbg << ')'; + return dbg; } #endif |