code review changes and fixes
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "ImageLoaderJpeg.hpp"
|
||||
#include "Base/Utils.hpp"
|
||||
#include <Data/Containers/Array.hpp>
|
||||
#include <fstream>
|
||||
#include <cstring>
|
||||
@@ -20,10 +21,8 @@ namespace OpenVulkano::Image
|
||||
{
|
||||
std::unique_ptr<Image> ImageLoaderJpeg::loadFromFile(const std::string& filePath)
|
||||
{
|
||||
std::ifstream file(filePath, std::ios::binary);
|
||||
if (!file) { throw std::runtime_error("Could not open file: " + filePath); }
|
||||
std::vector<uint8_t> buffer((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
return loadJpeg(buffer.data(), buffer.size());
|
||||
Array<char> buffer = OpenVulkano::Utils::ReadFile(filePath);
|
||||
return loadJpeg(reinterpret_cast<uint8_t*>(buffer.Data()), buffer.Size());
|
||||
}
|
||||
|
||||
std::unique_ptr<Image> ImageLoaderJpeg::loadFromMemory(const std::vector<uint8_t>& buffer)
|
||||
@@ -59,7 +58,7 @@ namespace OpenVulkano::Image
|
||||
}
|
||||
#else
|
||||
{
|
||||
return loadData(data, static_cast<int>(size), 3);
|
||||
return loadData(data, static_cast<int>(size));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user