Reduce warnings from ICC parsing

Messages about Qt deficiencies reduced to info, and info set as the
default message level.

Pick-to: 6.1 6.0 5.15
Fixes: QTBUG-91401
Change-Id: Ia97438f08de5e0383e77631dca9b253b47ef8167
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2021-02-25 12:49:07 +01:00
parent b7e08599cc
commit 6315257184
2 changed files with 11 additions and 9 deletions

View File

@ -500,7 +500,7 @@ static void read_image_scaled(QImage *outImage, png_structp png_ptr, png_infop i
extern "C" { extern "C" {
static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message) static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
{ {
qCWarning(lcImageIo, "libpng warning: %s", message); qCInfo(lcImageIo, "libpng warning: %s", message);
} }
} }
@ -590,7 +590,7 @@ bool QPngHandlerPrivate::readPngHeader()
png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen); png_get_iCCP(png_ptr, info_ptr, &name, &compressionType, &profileData, &profLen);
colorSpace = QColorSpace::fromIccProfile(QByteArray((const char *)profileData, profLen)); colorSpace = QColorSpace::fromIccProfile(QByteArray((const char *)profileData, profLen));
if (!colorSpace.isValid()) { if (!colorSpace.isValid()) {
qCWarning(lcImageIo) << "QPngHandler: Failed to parse ICC profile"; qCDebug(lcImageIo) << "QPngHandler: Failed to parse ICC profile";
} else { } else {
QColorSpacePrivate *csD = QColorSpacePrivate::get(colorSpace); QColorSpacePrivate *csD = QColorSpacePrivate::get(colorSpace);
if (csD->description.isEmpty()) if (csD->description.isEmpty())

View File

@ -52,7 +52,7 @@
#include <array> #include <array>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcIcc, "qt.gui.icc") Q_LOGGING_CATEGORY(lcIcc, "qt.gui.icc", QtWarningMsg)
struct ICCProfileHeader struct ICCProfileHeader
{ {
@ -237,18 +237,20 @@ static bool isValidIccProfile(const ICCProfileHeader &header)
} }
if (header.profileClass != uint(ProfileClass::Input) if (header.profileClass != uint(ProfileClass::Input)
&& header.profileClass != uint(ProfileClass::Display)) { && header.profileClass != uint(ProfileClass::Display)
qCWarning(lcIcc, "Unsupported ICC profile class %x", quint32(header.profileClass)); && (header.profileClass != uint(ProfileClass::Output)
|| header.inputColorSpace != uint(ColorSpaceType::Gray))) {
qCInfo(lcIcc, "Unsupported ICC profile class 0x%x", quint32(header.profileClass));
return false; return false;
} }
if (header.inputColorSpace != uint(ColorSpaceType::Rgb) if (header.inputColorSpace != uint(ColorSpaceType::Rgb)
&& header.inputColorSpace != uint(ColorSpaceType::Gray)) { && header.inputColorSpace != uint(ColorSpaceType::Gray)) {
qCWarning(lcIcc, "Unsupported ICC input color space %x", quint32(header.inputColorSpace)); qCInfo(lcIcc, "Unsupported ICC input color space 0x%x", quint32(header.inputColorSpace));
return false; return false;
} }
if (header.pcs != 0x58595a20 /* 'XYZ '*/) { if (header.pcs != 0x58595a20 /* 'XYZ '*/) {
// ### support PCSLAB // ### support PCSLAB
qCWarning(lcIcc, "Unsupported ICC profile connection space %x", quint32(header.pcs)); qCInfo(lcIcc, "Unsupported ICC profile connection space 0x%x", quint32(header.pcs));
return false; return false;
} }
@ -702,7 +704,7 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
if (!tagIndex.contains(Tag::rXYZ) || !tagIndex.contains(Tag::gXYZ) || !tagIndex.contains(Tag::bXYZ) || if (!tagIndex.contains(Tag::rXYZ) || !tagIndex.contains(Tag::gXYZ) || !tagIndex.contains(Tag::bXYZ) ||
!tagIndex.contains(Tag::rTRC) || !tagIndex.contains(Tag::gTRC) || !tagIndex.contains(Tag::bTRC) || !tagIndex.contains(Tag::rTRC) || !tagIndex.contains(Tag::gTRC) || !tagIndex.contains(Tag::bTRC) ||
!tagIndex.contains(Tag::wtpt)) { !tagIndex.contains(Tag::wtpt)) {
qCWarning(lcIcc) << "fromIccProfile: Unsupported ICC profile - not three component matrix based"; qCInfo(lcIcc) << "fromIccProfile: Unsupported ICC profile - not three component matrix based";
return false; return false;
} }
} else { } else {
@ -762,7 +764,7 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
QColorSpacePrimaries primaries(QColorSpace::Primaries::SRgb); QColorSpacePrimaries primaries(QColorSpace::Primaries::SRgb);
primaries.whitePoint = QPointF(x,y); primaries.whitePoint = QPointF(x,y);
if (!primaries.areValid()) { if (!primaries.areValid()) {
qCWarning(lcIcc) << "fromIccProfile: Invalid ICC profile - invalid white-point"; qCWarning(lcIcc, "fromIccProfile: Invalid ICC profile - invalid white-point(%f, %f)", x, y);
return false; return false;
} }
colorspaceDPtr->toXyz = primaries.toXyzMatrix(); colorspaceDPtr->toXyz = primaries.toXyzMatrix();