mirror of
https://github.com/Ed94/VEFontCache-Odin.git
synced 2025-08-06 06:52:44 -07:00
using zpl for stb_truetype allocation extension instead of gb.h (trying to gamble a build with mac)
This commit is contained in:
BIN
thirdparty/stb/lib/stb_truetype.lib
vendored
BIN
thirdparty/stb/lib/stb_truetype.lib
vendored
Binary file not shown.
10827
thirdparty/stb/src/gb/gb.h
vendored
10827
thirdparty/stb/src/gb/gb.h
vendored
File diff suppressed because it is too large
Load Diff
14
thirdparty/stb/src/stb_truetype.h
vendored
14
thirdparty/stb/src/stb_truetype.h
vendored
@@ -415,9 +415,9 @@ int main(int arg, char **argv)
|
|||||||
#pragma region ODIN: CUSTOM ALLOCATOR
|
#pragma region ODIN: CUSTOM ALLOCATOR
|
||||||
|
|
||||||
#ifdef STB_TRUETYPE_IMPLEMENTATION
|
#ifdef STB_TRUETYPE_IMPLEMENTATION
|
||||||
#define GB_IMPLEMENTATION
|
#define ZPL_IMPLEMENTATION
|
||||||
#endif
|
#endif
|
||||||
#include "gb/gb.h"
|
#include "zpl/zpl.h"
|
||||||
|
|
||||||
#ifdef STBTT_STATIC
|
#ifdef STBTT_STATIC
|
||||||
#define STBTT_DEF static
|
#define STBTT_DEF static
|
||||||
@@ -429,21 +429,21 @@ int main(int arg, char **argv)
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
STBTT_DEF void stbtt_SetAllocator( gbAllocator allocator );
|
STBTT_DEF void stbtt_SetAllocator( zpl_allocator allocator );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef STBTT_malloc
|
#ifndef STBTT_malloc
|
||||||
#define STBTT_malloc(x,u) ((void)(u), gb_alloc(stbtt__allocator, x))
|
#define STBTT_malloc(x,u) ((void)(u), zpl_alloc(stbtt__allocator, x))
|
||||||
#define STBTT_free(x,u) ((void)(u), gb_free(stbtt__allocator, x))
|
#define STBTT_free(x,u) ((void)(u), zpl_free(stbtt__allocator, x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef STB_TRUETYPE_IMPLEMENTATION
|
#ifdef STB_TRUETYPE_IMPLEMENTATION
|
||||||
gb_global gbAllocator stbtt__allocator = { gb_heap_allocator_proc, NULL };
|
zpl_global zpl_allocator stbtt__allocator = { zpl_heap_allocator_proc, NULL };
|
||||||
|
|
||||||
STBTT_DEF void stbtt_SetAllocator( gbAllocator allocator ) {
|
STBTT_DEF void stbtt_SetAllocator( zpl_allocator allocator ) {
|
||||||
stbtt__allocator = allocator;
|
stbtt__allocator = allocator;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
19055
thirdparty/stb/src/zpl/zpl.h
vendored
Normal file
19055
thirdparty/stb/src/zpl/zpl.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
thirdparty/stb/truetype/stb_truetype.odin
vendored
10
thirdparty/stb/truetype/stb_truetype.odin
vendored
@@ -40,27 +40,27 @@ when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 {
|
|||||||
// CUSTOM: ODIN COMPATIBLE ALLOCATOR
|
// CUSTOM: ODIN COMPATIBLE ALLOCATOR
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
gbAllocationType :: enum(i32) {
|
zpl_allocator_type :: enum(i32) {
|
||||||
Alloc,
|
Alloc,
|
||||||
Free,
|
Free,
|
||||||
FreeAll,
|
FreeAll,
|
||||||
Resize,
|
Resize,
|
||||||
}
|
}
|
||||||
|
|
||||||
gbAllocatorProc :: #type proc(allocator_data: rawptr, type: gbAllocationType,
|
zpl_allocator_proc :: #type proc(allocator_data: rawptr, type: zpl_allocator_type,
|
||||||
size: c.ssize_t, alignment: c.ssize_t,
|
size: c.ssize_t, alignment: c.ssize_t,
|
||||||
old_memory: rawptr, old_size: c.ssize_t,
|
old_memory: rawptr, old_size: c.ssize_t,
|
||||||
flags : c.ulonglong
|
flags : c.ulonglong
|
||||||
) -> rawptr
|
) -> rawptr
|
||||||
|
|
||||||
gbAllocator :: struct {
|
zpl_allocator :: struct {
|
||||||
procedure: gbAllocatorProc,
|
procedure: zpl_allocator_proc,
|
||||||
data: rawptr,
|
data: rawptr,
|
||||||
}
|
}
|
||||||
|
|
||||||
@(default_calling_convention="c", link_prefix="stbtt_")
|
@(default_calling_convention="c", link_prefix="stbtt_")
|
||||||
foreign stbtt {
|
foreign stbtt {
|
||||||
SetAllocator :: proc(allocator : gbAllocator) ---
|
SetAllocator :: proc(allocator : zpl_allocator) ---
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@@ -61,7 +61,7 @@ Parser_Context :: struct {
|
|||||||
|
|
||||||
parser_stbtt_allocator_proc :: proc(
|
parser_stbtt_allocator_proc :: proc(
|
||||||
allocator_data : rawptr,
|
allocator_data : rawptr,
|
||||||
type : stbtt.gbAllocationType,
|
type : stbtt.zpl_allocator_type,
|
||||||
size : c.ssize_t,
|
size : c.ssize_t,
|
||||||
alignment : c.ssize_t,
|
alignment : c.ssize_t,
|
||||||
old_memory : rawptr,
|
old_memory : rawptr,
|
||||||
@@ -86,13 +86,13 @@ parser_init :: proc( ctx : ^Parser_Context, kind : Parser_Kind, allocator := con
|
|||||||
ctx.kind = kind
|
ctx.kind = kind
|
||||||
ctx.lib_backing = allocator
|
ctx.lib_backing = allocator
|
||||||
|
|
||||||
stbtt_allocator := stbtt.gbAllocator { parser_stbtt_allocator_proc, & ctx.lib_backing }
|
stbtt_allocator := stbtt.zpl_allocator { parser_stbtt_allocator_proc, & ctx.lib_backing }
|
||||||
stbtt.SetAllocator( stbtt_allocator )
|
stbtt.SetAllocator( stbtt_allocator )
|
||||||
}
|
}
|
||||||
|
|
||||||
parser_reload :: proc( ctx : ^Parser_Context, allocator := context.allocator) {
|
parser_reload :: proc( ctx : ^Parser_Context, allocator := context.allocator) {
|
||||||
ctx.lib_backing = allocator
|
ctx.lib_backing = allocator
|
||||||
stbtt_allocator := stbtt.gbAllocator { parser_stbtt_allocator_proc, & ctx.lib_backing }
|
stbtt_allocator := stbtt.zpl_allocator { parser_stbtt_allocator_proc, & ctx.lib_backing }
|
||||||
stbtt.SetAllocator( stbtt_allocator )
|
stbtt.SetAllocator( stbtt_allocator )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user