Include individual channel sizes in QPixelFormat debug output

Change-Id: Icbcbefa0c5b416e5d030d70e5965be7a7c62a92a
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
Tor Arne Vestbø 2025-08-18 21:23:25 +02:00
parent 24fb55b236
commit 372e11d2ce
1 changed files with 20 additions and 2 deletions

View File

@ -569,8 +569,26 @@ QDebug operator<<(QDebug dbg, const QPixelFormat &f)
if (f.typeInterpretation() != QPixelFormat::UnsignedByte || f.bitsPerPixel() > 8)
dbg << "," << f.byteOrder();
if (f.colorModel() != QPixelFormat::YUV)
dbg << ",ch=" << f.channelCount();
if (f.colorModel() != QPixelFormat::YUV) {
dbg << ",ch=" << f.channelCount() << "[";
const int alphaSize = f.alphaSize();
const int colorChannels = f.channelCount() - (f.alphaSize() ? 1 : 0);
if (alphaSize && f.alphaPosition() == QPixelFormat::AtBeginning)
dbg << alphaSize << "-";
if (colorChannels >= 1)
dbg << f.get(QPixelFormat::FirstField, QPixelFormat::FirstFieldWidth);
if (colorChannels >= 2)
dbg << "-" << f.get(QPixelFormat::SecondField, QPixelFormat::SecondFieldWidth);
if (colorChannels >= 3)
dbg << "-" << f.get(QPixelFormat::ThirdField, QPixelFormat::ThirdFieldWidth);
if (colorChannels >= 4)
dbg << "-" << f.get(QPixelFormat::FourthField, QPixelFormat::FourthFieldWidth);
if (colorChannels >= 5)
dbg << "-" << f.get(QPixelFormat::FifthField, QPixelFormat::FifthFieldWidth);
if (alphaSize && f.alphaPosition() == QPixelFormat::AtEnd)
dbg << "-" << alphaSize;
dbg << "]";
}
if (f.alphaSize() > 0) {
dbg << "," << f.alphaUsage()