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