change signature
This commit is contained in:
@@ -31,7 +31,7 @@ namespace OpenVulkano::Image
|
||||
return loadJpeg(buffer.data(), buffer.size());
|
||||
}
|
||||
|
||||
bool ImageLoaderJpeg::GetImageDimensions(const std::string& filename, int& width, int& height)
|
||||
Math::Vector2i ImageLoaderJpeg::GetImageDimensions(const std::string& filename)
|
||||
{
|
||||
#if __has_include("turbojpeg.h")
|
||||
auto image = Utils::ReadFile(filename);
|
||||
@@ -39,21 +39,22 @@ namespace OpenVulkano::Image
|
||||
if (!jpegDecompressor)
|
||||
{
|
||||
Logger::FILESYS->error("Failed to read jpeg header. Error: {}", tjGetErrorStr());
|
||||
return false;
|
||||
return Math::Vector2i { -1, -1 };
|
||||
}
|
||||
Math::Vector2i res = {};
|
||||
int size = 0, jpegSubsamp = 0;
|
||||
int status = tjDecompressHeader2(jpegDecompressor, reinterpret_cast<unsigned char*>(image.Data()), image.Size(),
|
||||
&width, &height, &jpegSubsamp);
|
||||
&res.x, &res.y, &jpegSubsamp);
|
||||
if (status != 0)
|
||||
{
|
||||
Logger::FILESYS->error("Failed to read jpeg header. Error: {}", tjGetErrorStr());
|
||||
tjDestroy(jpegDecompressor);
|
||||
return false;
|
||||
return Math::Vector2i { -1, -1 };
|
||||
}
|
||||
tjDestroy(jpegDecompressor);
|
||||
return true;
|
||||
return res;
|
||||
#else
|
||||
return IImageLoader::GetDimensionsInternal(filename, width, height);
|
||||
return IImageLoader::GetDimensionsInternal(filename);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user