Minor improvements to EXR decoding. (#177)
See also #176. This closes #166.
This commit is contained in:
@@ -576,11 +576,13 @@ LinearImage EXRDecoder::decode() {
|
||||
int ret = LoadEXRFromMemory(&rgba, &width, &height, src.data(), src.size(), &error);
|
||||
if (ret != TINYEXR_SUCCESS) {
|
||||
std::cerr << "Could not decode OpenEXR: " << error << std::endl;
|
||||
FreeEXRErrorMessage(error);
|
||||
mStream.seekg(mStreamStartPos);
|
||||
return LinearImage();
|
||||
}
|
||||
|
||||
src.resize(0);
|
||||
src.clear();
|
||||
src.shrink_to_fit();
|
||||
|
||||
LinearImage image(width, height, 3);
|
||||
|
||||
@@ -596,6 +598,8 @@ LinearImage EXRDecoder::decode() {
|
||||
}
|
||||
}
|
||||
|
||||
free(rgba);
|
||||
|
||||
return image;
|
||||
} catch(std::runtime_error& e) {
|
||||
// reset the stream, like we found it
|
||||
|
||||
Reference in New Issue
Block a user