From 15557a12de494c183e3cc359db434f757bb7f459 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 22 Nov 2017 09:30:40 +0100 Subject: QImage: Output some bytes of first scanline on verbose debug streams Change-Id: I1003c2b4109112fb2d2733a156120a041d7bd695 Reviewed-by: Eirik Aavitsland --- src/gui/image/qimage.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 96a1b38d48..081229e4c4 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4811,8 +4811,8 @@ bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFla QDebug operator<<(QDebug dbg, const QImage &i) { QDebugStateSaver saver(dbg); - dbg.resetFormat(); dbg.nospace(); + dbg.noquote(); dbg << "QImage("; if (i.isNull()) { dbg << "null"; @@ -4820,8 +4820,15 @@ QDebug operator<<(QDebug dbg, const QImage &i) dbg << i.size() << ",format=" << i.format() << ",depth=" << i.depth(); if (i.colorCount()) dbg << ",colorCount=" << i.colorCount(); + const int bytesPerLine = i.bytesPerLine(); dbg << ",devicePixelRatio=" << i.devicePixelRatio() - << ",bytesPerLine=" << i.bytesPerLine() << ",sizeInBytes=" << i.sizeInBytes(); + << ",bytesPerLine=" << bytesPerLine << ",sizeInBytes=" << i.sizeInBytes(); + if (dbg.verbosity() > 2 && i.height() > 0) { + const int outputLength = qMin(bytesPerLine, 24); + dbg << ",line0=" + << QByteArray(reinterpret_cast(i.scanLine(0)), outputLength).toHex() + << "..."; + } } dbg << ')'; return dbg; -- cgit v1.2.3