move malloc

This commit is contained in:
camh 2022-02-23 23:56:26 -08:00
parent 167c0f26db
commit 18a363a8e0
3 changed files with 5 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1086,6 +1086,7 @@ void updateBounds(int top, int bottom, int left, int right) {
#ifdef COMMAND_CACHING
int lastCalls = 0;
int currentCalls;
const struct nk_command *lastCmd;
#endif
NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
@ -1136,7 +1137,6 @@ NK_API void nk_quickdraw_render(WindowPtr window, struct nk_context *ctx) {
#endif
#ifdef COMMAND_CACHING
const struct nk_command *lastCmd = malloc(sizeof(struct nk_command));
lastCmd = nk_ptr_add_const(struct nk_command, last, 0);
#endif
@ -1499,6 +1499,10 @@ NK_API struct nk_context* nk_quickdraw_init(unsigned int width, unsigned int hei
NkQuickDrawFont *quickdrawfont = nk_quickdraw_font_create_from_file();
struct nk_user_font *font = &quickdrawfont->nk;
#ifdef COMMAND_CACHING
lastCmd = malloc(sizeof(struct nk_command));
#endif
last = calloc(1, MAX_MEMORY_IN_KB * 1024);
buf = calloc(1, MAX_MEMORY_IN_KB * 1024);
nk_init_fixed(&quickdraw.nuklear_context, buf, MAX_MEMORY_IN_KB * 1024, font);