experimental implementation of very unsafe function
this needs to be heavily audieted
This commit is contained in:
@@ -74,6 +74,20 @@ nn_bool_t nn_unsafeReallocateScreenBuffer(nn_screen *screen, int maxWidth, int m
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(nn_size_t y = 0; y < maxHeight; y++) {
|
||||||
|
if(y == screen->maxHeight) break;
|
||||||
|
for(nn_size_t x = 0; x < maxWidth; x++) {
|
||||||
|
if(x == screen->maxWidth) break;
|
||||||
|
|
||||||
|
nn_size_t srcIdx = x + y * screen->maxWidth;
|
||||||
|
nn_size_t destIdx = x + y * maxWidth;
|
||||||
|
|
||||||
|
newBuffer[destIdx] = screen->buffer[srcIdx];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nn_dealloc(alloc, screen->buffer, sizeof(nn_scrchr_t) * screen->maxWidth * screen->maxHeight);
|
||||||
|
|
||||||
screen->buffer = newBuffer;
|
screen->buffer = newBuffer;
|
||||||
screen->maxWidth = maxWidth;
|
screen->maxWidth = maxWidth;
|
||||||
screen->maxHeight = maxHeight;
|
screen->maxHeight = maxHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user