From 76998a72347fe472c51c01e54d5b484f8bd5ea87 Mon Sep 17 00:00:00 2001 From: xtreme8000 Date: Wed, 8 Feb 2023 00:23:19 +0100 Subject: [PATCH] Displaylist: decrease memory waste factor 1.25 instead of 2 --- source/platform/graphics/displaylist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/platform/graphics/displaylist.c b/source/platform/graphics/displaylist.c index dc0a711..357e634 100644 --- a/source/platform/graphics/displaylist.c +++ b/source/platform/graphics/displaylist.c @@ -80,7 +80,8 @@ void displaylist_pos(struct displaylist* l, int16_t x, int16_t y, int16_t z) { } if(l->index + 9 > l->length) { - l->length *= 2; + l->length = (l->length * 5 / 4 + 9 + DISPLAYLIST_CLL - 1) + / DISPLAYLIST_CLL * DISPLAYLIST_CLL; l->data = realloc(l->data, l->length + DISPLAYLIST_CLL); assert(l->data); }