Closed dsafa22 closed 4 years ago
我在使用image_decode.cpp中的imageParse方法解析png图片遇到问题。 问题原因:
image_decode.cpp
imageParse
ImageContainer* input = imageParseDds (_allocator, _data, _size, _err) ; input = NULL == input ? imageParseKtx (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParsePvr3 (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseGnf (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseLodePng (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseTinyExr (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseJpeg (_allocator, _data, _size, _err) : input; input = NULL == input ? imageParseStbImage(_allocator, _data, _size, _err) : input;
在执行imageParseLodePng方法前,_err因为不是其他格式被设置错误
imageParseLodePng
_err
BX_ERROR_SET(_err, BIMG_ERROR, "Invalid header magic.");
imageParseLodePng执行完之后,_err还是存在,没有被重置,导致错误。
--- Google translate ---
I'm having trouble parsing png images using the imageParse method in image_decode.cpp. problem causes:
ImageContainer * input = imageParseDds (_allocator, _data, _size, _err); input = NULL == input? imageParseKtx (_allocator, _data, _size, _err): input; input = NULL == input? imageParsePvr3 (_allocator, _data, _size, _err): input; input = NULL == input? imageParseGnf (_allocator, _data, _size, _err): input; input = NULL == input? imageParseLodePng (_allocator, _data, _size, _err): input; input = NULL == input? imageParseTinyExr (_allocator, _data, _size, _err): input; input = NULL == input? imageParseJpeg (_allocator, _data, _size, _err): input; input = NULL == input? imageParseStbImage (_allocator, _data, _size, _err): input;
Before executing the imageParseLodePng method, _err was set incorrectly because it is not in another format
BX_ERROR_SET (_err, BIMG_ERROR, "Invalid header magic.");
After imageParseLodePng is executed, _err still exists and has not been reset, resulting in an error.
This issue was fixed, grab latest...
High efficiency!
我在使用
image_decode.cpp
中的imageParse
方法解析png图片遇到问题。 问题原因:在执行
imageParseLodePng
方法前,_err
因为不是其他格式被设置错误BX_ERROR_SET(_err, BIMG_ERROR, "Invalid header magic.");
imageParseLodePng
执行完之后,_err还是存在,没有被重置,导致错误。--- Google translate ---
I'm having trouble parsing png images using the imageParse method in image_decode.cpp. problem causes:
ImageContainer * input = imageParseDds (_allocator, _data, _size, _err); input = NULL == input? imageParseKtx (_allocator, _data, _size, _err): input; input = NULL == input? imageParsePvr3 (_allocator, _data, _size, _err): input; input = NULL == input? imageParseGnf (_allocator, _data, _size, _err): input; input = NULL == input? imageParseLodePng (_allocator, _data, _size, _err): input; input = NULL == input? imageParseTinyExr (_allocator, _data, _size, _err): input; input = NULL == input? imageParseJpeg (_allocator, _data, _size, _err): input; input = NULL == input? imageParseStbImage (_allocator, _data, _size, _err): input;
Before executing the imageParseLodePng method, _err was set incorrectly because it is not in another format
BX_ERROR_SET (_err, BIMG_ERROR, "Invalid header magic.");
After imageParseLodePng is executed, _err still exists and has not been reset, resulting in an error.