Cogs.Foundation
Loading...
Searching...
No Matches
Namespaces | Macros | Functions
StbAllocator.h File Reference
#include "../FoundationBase.h"

Go to the source code of this file.

Namespaces

namespace  Cogs
 Main Cogs namespace.
 

Macros

#define STBI_MALLOC(size)   Cogs::stbAlloc(size)
 Include this header file before defining STB_IMAGE_IMPLEMENTATION, STB_IMAGE_WRITE_IMPLEMENTATION, or STB_TRUETYPE_IMPLEMENTATION (and before including the accompanying STB header file) to override the default STB memory allocation macros with these alternatives.
 
#define STBI_REALLOC_SIZED(oldPtr, oldSize, newSize)   Cogs::stbRealloc(oldPtr, oldSize, newSize)
 
#define STBI_FREE(ptr)   Cogs::stbFree(ptr)
 
#define STBIW_MALLOC(size)   Cogs::stbAlloc(size)
 
#define STBIW_REALLOC_SIZED(oldPtr, oldSize, newSize)   Cogs::stbRealloc(oldPtr, oldSize, newSize)
 
#define STBIW_FREE(ptr)   Cogs::stbFree(ptr)
 
#define STBTT_malloc(size, userData)   Cogs::stbAlloc(size, userData)
 
#define STBTT_free(ptr, userData)   Cogs::stbFree(ptr, userData)
 

Functions

COGSFOUNDATION_API void * Cogs::stbAlloc (size_t size, void *userData=nullptr)
 
COGSFOUNDATION_API void * Cogs::stbRealloc (void *ptr, size_t oldSize, size_t newSize)
 
COGSFOUNDATION_API void Cogs::stbFree (void *ptr, void *userData=nullptr)
 

Macro Definition Documentation

◆ STBI_FREE

#define STBI_FREE (   ptr)    Cogs::stbFree(ptr)

◆ STBI_MALLOC

#define STBI_MALLOC (   size)    Cogs::stbAlloc(size)

Include this header file before defining STB_IMAGE_IMPLEMENTATION, STB_IMAGE_WRITE_IMPLEMENTATION, or STB_TRUETYPE_IMPLEMENTATION (and before including the accompanying STB header file) to override the default STB memory allocation macros with these alternatives.

These replacements will call the Cogs functions below to allocate memory on behalf of the STB library using new and delete which will, in turn, allow STB memory allocations to be tracked by the Oso Memory Profiler. (Or any other profiler that can track C++ memory allocations.)

◆ STBI_REALLOC_SIZED

#define STBI_REALLOC_SIZED (   oldPtr,
  oldSize,
  newSize 
)    Cogs::stbRealloc(oldPtr, oldSize, newSize)

◆ STBIW_FREE

#define STBIW_FREE (   ptr)    Cogs::stbFree(ptr)

◆ STBIW_MALLOC

#define STBIW_MALLOC (   size)    Cogs::stbAlloc(size)

◆ STBIW_REALLOC_SIZED

#define STBIW_REALLOC_SIZED (   oldPtr,
  oldSize,
  newSize 
)    Cogs::stbRealloc(oldPtr, oldSize, newSize)

◆ STBTT_free

#define STBTT_free (   ptr,
  userData 
)    Cogs::stbFree(ptr, userData)

◆ STBTT_malloc

#define STBTT_malloc (   size,
  userData 
)    Cogs::stbAlloc(size, userData)