Utility: Fix STBLoader
This commit is contained in:
parent
fbdc1faf8c
commit
5cb50928f7
|
|
@ -47,10 +47,14 @@ namespace Nz
|
||||||
|
|
||||||
Result<std::shared_ptr<Image>, ResourceLoadingError> LoadSTB(Stream& stream, const ImageParams& parameters)
|
Result<std::shared_ptr<Image>, ResourceLoadingError> LoadSTB(Stream& stream, const ImageParams& parameters)
|
||||||
{
|
{
|
||||||
|
UInt64 streamPos = stream.GetCursorPos();
|
||||||
|
|
||||||
int width, height, bpp;
|
int width, height, bpp;
|
||||||
if (!stbi_info_from_callbacks(&s_stbiCallbacks, &stream, &width, &height, &bpp))
|
if (!stbi_info_from_callbacks(&s_stbiCallbacks, &stream, &width, &height, &bpp))
|
||||||
return Err(ResourceLoadingError::Unrecognized);
|
return Err(ResourceLoadingError::Unrecognized);
|
||||||
|
|
||||||
|
stream.SetCursorPos(streamPos);
|
||||||
|
|
||||||
// Load everything as RGBA8 and then convert using the Image::Convert method
|
// Load everything as RGBA8 and then convert using the Image::Convert method
|
||||||
// This is because of a STB bug when loading some JPG images with default settings
|
// This is because of a STB bug when loading some JPG images with default settings
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue