mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-11-22 10:02:43 -05:00
Fixed wrong plugin options behaviour
While working on MR !230 I noticed that the options read I entered into several plugins could not be read after reading the image. **The patch fixes problems reading options in plugins and adds option checking in the readtest.cpp.** In particular, the reading test does the following additional actions: - reads options before reading the image; - compare the options read with the options returned by the reader after reading the image; - compares the format and size of the returned image with the format and size returned by the reader.
This commit is contained in:
committed by
Albert Astals Cid
parent
81b7263d73
commit
b849e48ef4
@ -269,13 +269,13 @@ bool HDRHandler::read(QImage *outImage)
|
||||
{
|
||||
QDataStream s(device());
|
||||
|
||||
QSize size = readHeaderSize(s.device());
|
||||
if (!size.isValid()) {
|
||||
m_imageSize = readHeaderSize(s.device());
|
||||
if (!m_imageSize.isValid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
QImage img;
|
||||
if (!LoadHDR(s, size.width(), size.height(), img)) {
|
||||
if (!LoadHDR(s, m_imageSize.width(), m_imageSize.height(), img)) {
|
||||
// qDebug() << "Error loading HDR file.";
|
||||
return false;
|
||||
}
|
||||
@ -303,7 +303,9 @@ QVariant HDRHandler::option(ImageOption option) const
|
||||
QVariant v;
|
||||
|
||||
if (option == QImageIOHandler::Size) {
|
||||
if (auto d = device()) {
|
||||
if (!m_imageSize.isEmpty()) {
|
||||
v = QVariant::fromValue(m_imageSize);
|
||||
} else if (auto d = device()) {
|
||||
// transactions works on both random and sequential devices
|
||||
d->startTransaction();
|
||||
auto size = readHeaderSize(d);
|
||||
|
||||
Reference in New Issue
Block a user