mirror of
https://github.com/seekrs/MacroLibX.git
synced 2026-01-11 06:33:35 +00:00
fixing error message (#119)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <Core/SDLManager.h>
|
||||
#include <Renderer/RenderCore.h>
|
||||
#include <mlx.h>
|
||||
#include <mlx_extended.h>
|
||||
#include <Core/Memory.h>
|
||||
#include <Core/Handles.h>
|
||||
|
||||
@@ -224,17 +225,17 @@ extern "C"
|
||||
MLX_CHECK_APPLICATION_POINTER(mlx);
|
||||
if (filename == nullptr)
|
||||
{
|
||||
mlx::Error("PNG loader: filename is NULL");
|
||||
mlx::Error("Image loader: filename is NULL");
|
||||
return nullptr;
|
||||
}
|
||||
std::filesystem::path file(filename);
|
||||
if( file.extension() != ".png" &&
|
||||
if(file.extension() != ".png" &&
|
||||
file.extension() != ".jpg" &&
|
||||
file.extension() != ".jpeg" &&
|
||||
file.extension() != ".bmp" &&
|
||||
file.extension() != ".dib")
|
||||
{
|
||||
mlx::Error("PNG loader: not a valid file format '%'", filename);
|
||||
mlx::Error("Image loader: not a valid file format '%'", filename);
|
||||
return nullptr;
|
||||
}
|
||||
return mlx->app->NewStbTexture(filename, width, height);
|
||||
|
||||
@@ -21,14 +21,14 @@ namespace mlx
|
||||
|
||||
void* MemManager::AlignedMalloc(std::size_t alignment, std::size_t size)
|
||||
{
|
||||
if(alignment < sizeof(void*))
|
||||
alignment = sizeof(void*);
|
||||
if(size % alignment != 0)
|
||||
size += alignment - (size % alignment);
|
||||
|
||||
#ifdef MLX_COMPILER_MSVC
|
||||
void* ptr = _aligned_malloc(alignment, size);
|
||||
void* ptr = _aligned_malloc(size, alignment);
|
||||
#else
|
||||
if(alignment < sizeof(void*))
|
||||
alignment = sizeof(void*);
|
||||
if(size % alignment != 0)
|
||||
size += alignment - (size % alignment);
|
||||
|
||||
void* ptr = std::aligned_alloc(alignment, size);
|
||||
#endif
|
||||
if(ptr != nullptr)
|
||||
@@ -67,7 +67,7 @@ namespace mlx
|
||||
auto it = std::find_if(s_blocks.begin(), s_blocks.end(), [=](const Descriptor& rhs){ return ptr == rhs.ptr; });
|
||||
|
||||
#ifdef MLX_COMPILER_MSVC
|
||||
void* ptr2 = _aligned_realloc(ptr, alignment, size);
|
||||
void* ptr2 = _aligned_realloc(ptr, size, alignment);
|
||||
if(it != s_blocks.end())
|
||||
s_blocks.erase(it);
|
||||
#else
|
||||
|
||||
@@ -392,12 +392,12 @@ namespace mlx
|
||||
|
||||
if(!std::filesystem::exists(file))
|
||||
{
|
||||
Error("Image: file not found %", file);
|
||||
Error("Image loader: file not found %", file);
|
||||
return nullptr;
|
||||
}
|
||||
if(stbi_is_hdr(filename.c_str()))
|
||||
{
|
||||
Error("Texture: unsupported image format from % (HDR image)", file);
|
||||
Error("Image loader: unsupported image format from % (HDR image)", file);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user