summaryrefslogtreecommitdiffstats
path: root/src/gui/image/qpnghandler.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-09 15:51:54 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-11 21:30:08 +0000
commitde2c3ccd49cb89e0c6912da3b03705a36ef03946 (patch)
treed97f377b1b51cb5c61037ee168abb0f8e34e5ebb /src/gui/image/qpnghandler.cpp
parenta0524a8443b153ca36b069f6f49551b1b5df7808 (diff)
Fix reading gamma from PNGs without ICC profile
The decoding of PNG_INFO_gAMA to QColorSpace was incorrect, the PNG gamma is the inverse of the gamma value we use. We revert it everywhere else, just not here. Pick-to: 6.2 5.15 Change-Id: Ic0ae1963b2dde3004cac8a6430ddaf99e7096915 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/image/qpnghandler.cpp')
-rw-r--r--src/gui/image/qpnghandler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 9943e7261a..c013a06813 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -627,10 +627,10 @@ bool QPngHandlerPrivate::readPngHeader()
}
if (primaries.areValid()) {
colorSpace = QColorSpace(primaries.whitePoint, primaries.redPoint, primaries.greenPoint, primaries.bluePoint,
- QColorSpace::TransferFunction::Gamma, fileGamma);
+ QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma);
} else {
colorSpace = QColorSpace(QColorSpace::Primaries::SRgb,
- QColorSpace::TransferFunction::Gamma, fileGamma);
+ QColorSpace::TransferFunction::Gamma, 1.0f / fileGamma);
}
colorSpaceState = GammaChrm;
}