Skip to content

Commit

Permalink
qicc: avoid double lookup
Browse files Browse the repository at this point in the history
Change-Id: I9da3b37927650ab9dee928156f907ea5c58fc500
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
  • Loading branch information
antkudr committed Apr 17, 2024
1 parent 7febd6d commit a868c69
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/gui/painting/qicc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,8 +1345,8 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
} else {
Q_UNREACHABLE();
}
if (tagIndex.contains(Tag::chad)) {
if (!parseChad(data, tagIndex[Tag::chad], colorspaceDPtr))
if (auto it = tagIndex.constFind(Tag::chad); it != tagIndex.constEnd()) {
if (!parseChad(data, it.value(), colorspaceDPtr))
return false;
} else {
colorspaceDPtr->chad = QColorMatrix::chromaticAdaptation(colorspaceDPtr->whitePoint);
Expand All @@ -1371,19 +1371,19 @@ bool fromIccProfile(const QByteArray &data, QColorSpace *colorSpace)
// Only parse the default perceptual transform for now
if (!parseA2B(data, tagIndex[Tag::A2B0], colorspaceDPtr, true))
return false;
if (tagIndex.contains(Tag::B2A0)) {
if (!parseA2B(data, tagIndex[Tag::B2A0], colorspaceDPtr, false))
if (auto it = tagIndex.constFind(Tag::B2A0); it != tagIndex.constEnd()) {
if (!parseA2B(data, it.value(), colorspaceDPtr, false))
return false;
}

if (tagIndex.contains(Tag::wtpt)) {
if (!parseXyzData(data, tagIndex[Tag::wtpt], colorspaceDPtr->whitePoint))
if (auto it = tagIndex.constFind(Tag::wtpt); it != tagIndex.constEnd()) {
if (!parseXyzData(data, it.value(), colorspaceDPtr->whitePoint))
return false;
}
}

if (tagIndex.contains(Tag::desc)) {
if (!parseDesc(data, tagIndex[Tag::desc], colorspaceDPtr->description))
if (auto it = tagIndex.constFind(Tag::desc); it != tagIndex.constEnd()) {
if (!parseDesc(data, it.value(), colorspaceDPtr->description))
qCWarning(lcIcc) << "fromIccProfile: Failed to parse description";
else
qCDebug(lcIcc) << "fromIccProfile: Description" << colorspaceDPtr->description;
Expand Down

0 comments on commit a868c69

Please sign in to comment.