mirror of
https://github.com/mintsuki/flanterm
synced 2024-11-30 08:33:21 +03:00
Massively reduce the default size of bump alloc pool
Also limit the resolution of the terminal if necessary and force no-canvas mode if using bump allocator
This commit is contained in:
parent
9b51770c7a
commit
1d6e5855e2
@ -35,7 +35,10 @@ void *memcpy(void *, const void *, size_t);
|
||||
#ifndef FLANTERM_FB_DISABLE_BUMP_ALLOC
|
||||
|
||||
#ifndef FLANTERM_FB_BUMP_ALLOC_POOL_SIZE
|
||||
#define FLANTERM_FB_BUMP_ALLOC_POOL_SIZE (64*1024*1024)
|
||||
#define FLANTERM_FB_BUMP_ALLOC_POOL_SIZE 873000
|
||||
|
||||
#define FLANTERM_FB_WIDTH_LIMIT 1920
|
||||
#define FLANTERM_FB_HEIGHT_LIMIT 1200
|
||||
#endif
|
||||
|
||||
static uint8_t bump_alloc_pool[FLANTERM_FB_BUMP_ALLOC_POOL_SIZE];
|
||||
@ -884,6 +887,17 @@ struct flanterm_context *flanterm_fb_init(
|
||||
) {
|
||||
#ifndef FLANTERM_FB_DISABLE_BUMP_ALLOC
|
||||
size_t orig_bump_alloc_ptr = bump_alloc_ptr;
|
||||
|
||||
// Limit terminal size if needed
|
||||
if (width > FLANTERM_FB_WIDTH_LIMIT || height > FLANTERM_FB_HEIGHT_LIMIT) {
|
||||
size_t width_limit = width > FLANTERM_FB_WIDTH_LIMIT ? FLANTERM_FB_WIDTH_LIMIT : width;
|
||||
size_t height_limit = height > FLANTERM_FB_HEIGHT_LIMIT ? FLANTERM_FB_HEIGHT_LIMIT : height;
|
||||
|
||||
framebuffer = (uint32_t *)((uintptr_t)framebuffer + ((((height / 2) - (height_limit / 2)) * pitch) + (((width / 2) - (width_limit / 2)) * 4)));
|
||||
|
||||
width = width_limit;
|
||||
height = height_limit;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FLANTERM_FB_SUPPORT_BPP
|
||||
|
@ -36,6 +36,10 @@ extern "C" {
|
||||
|
||||
#include "../flanterm.h"
|
||||
|
||||
#ifndef FLANTERM_FB_DISABLE_BUMP_ALLOC
|
||||
# define FLANTERM_FB_DISABLE_CANVAS 1
|
||||
#endif
|
||||
|
||||
#define FLANTERM_FB_FONT_GLYPHS 256
|
||||
|
||||
struct flanterm_fb_char {
|
||||
|
Loading…
Reference in New Issue
Block a user