mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
Fix Non-square Radiance/RGBE/.hdr images failing to load
The HDR QImageIOHandler plugin only supports the default image orientation (-Y +X) in .hdr files. It mixes up the width and height however, resulting in non-square images not loading. This fix adds a check for the standard image orientation in the file and returns false (with error message) if that fails. If it succeeds, it takes the height from the -Y component, and the width from the +X component, resulting in successful loading of the image. Add autotest images for landscape and portrait HDR (Radiance RGBE) loader BUGS: 433877
This commit is contained in:
parent
511a22f0b4
commit
503b3eee2b
BIN
autotests/read/hdr/rgb-landscape.hdr
Executable file
BIN
autotests/read/hdr/rgb-landscape.hdr
Executable file
Binary file not shown.
BIN
autotests/read/hdr/rgb-landscape.png
Executable file
BIN
autotests/read/hdr/rgb-landscape.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
autotests/read/hdr/rgb-portrait.hdr
Executable file
BIN
autotests/read/hdr/rgb-portrait.hdr
Executable file
Binary file not shown.
BIN
autotests/read/hdr/rgb-portrait.png
Normal file
BIN
autotests/read/hdr/rgb-portrait.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
@ -227,8 +227,15 @@ bool HDRHandler::read(QImage *outImage)
|
||||
qCDebug(HDRPLUGIN) << "Invalid HDR file, the first line after the header didn't have the expected format:" << line;
|
||||
return false;
|
||||
}
|
||||
const int width = match.captured(2).toInt();
|
||||
const int height = match.captured(4).toInt();
|
||||
|
||||
if ( (match.captured(1).at(1) != u'Y') ||
|
||||
(match.captured(3).at(1) != u'X') ) {
|
||||
qCDebug(HDRPLUGIN) << "Unsupported image orientation in HDR file.";
|
||||
return false;
|
||||
}
|
||||
|
||||
const int width = match.captured(4).toInt();
|
||||
const int height = match.captured(2).toInt();
|
||||
|
||||
QDataStream s(device());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user