ImageData:encode now supports saving exr image files.

Also add support for loading uint exr image files, and fix a memory leak in the exr loading code.

Resolves #1813.
This commit is contained in:
slime
2022-09-10 23:17:42 -03:00
parent 9be43d671c
commit 9c46b75138
9 changed files with 236 additions and 27 deletions
+3 -2
View File
@@ -206,12 +206,12 @@ love::filesystem::FileData *ImageData::encode(FormatHandler::EncodedFormat encod
}
catch (love::Exception &)
{
encoder->freeRawPixels(encodedimage.data);
encoder->freeEncodedImage(encodedimage.data);
throw;
}
memcpy(filedata->getData(), encodedimage.data, encodedimage.size);
encoder->freeRawPixels(encodedimage.data);
encoder->freeEncodedImage(encodedimage.data);
if (writefile)
{
@@ -859,6 +859,7 @@ StringMap<FormatHandler::EncodedFormat, FormatHandler::ENCODED_MAX_ENUM>::Entry
{
{"tga", FormatHandler::ENCODED_TGA},
{"png", FormatHandler::ENCODED_PNG},
{"exr", FormatHandler::ENCODED_EXR},
};
StringMap<FormatHandler::EncodedFormat, FormatHandler::ENCODED_MAX_ENUM> ImageData::encodedFormats(ImageData::encodedFormatEntries, sizeof(ImageData::encodedFormatEntries));