changes
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
nn_screen *nn_newScreen(nn_Context *context, int maxWidth, int maxHeight, int maxDepth, int editableColors, int paletteColors) {
|
||||
nn_Alloc *alloc = &context->allocator;
|
||||
// TODO: handle OOMs
|
||||
nn_screen *screen = nn_alloc(alloc, sizeof(nn_screen));
|
||||
screen->ctx = *context;
|
||||
screen->buffer = nn_alloc(alloc, sizeof(nn_scrchr_t) * maxWidth * maxHeight);
|
||||
@@ -65,6 +66,20 @@ void nn_setResolution(nn_screen *screen, int width, int height) {
|
||||
screen->height = height;
|
||||
}
|
||||
|
||||
nn_bool_t nn_unsafeReallocateScreenBuffer(nn_screen *screen, int maxWidth, int maxHeight) {
|
||||
nn_Alloc *alloc = &screen->ctx.allocator;
|
||||
|
||||
nn_scrchr_t *newBuffer = nn_alloc(alloc, sizeof(nn_scrchr_t) * maxWidth * maxHeight);
|
||||
if(newBuffer == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
screen->buffer = newBuffer;
|
||||
screen->maxWidth = maxWidth;
|
||||
screen->maxHeight = maxHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
void nn_getViewport(nn_screen *screen, int *width, int *height) {
|
||||
*width = screen->viewportWidth;
|
||||
*height = screen->viewportHeight;
|
||||
|
||||
@@ -111,7 +111,7 @@ nn_size_t nn_vf_spaceUsedByNode(nn_vfnode *node) {
|
||||
if(node->isDirectory) {
|
||||
nn_size_t sum = 0;
|
||||
for(nn_size_t i = 0; i < node->len; i++) {
|
||||
sum = nn_vf_spaceUsedByNode(node->entries[i]);
|
||||
sum += nn_vf_spaceUsedByNode(node->entries[i]);
|
||||
}
|
||||
return sum;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user