update swClose

This commit is contained in:
Bigfoot71 2025-05-17 16:18:13 +02:00
parent 9d49dbcb8d
commit 5b46c6e66f

19
src/external/rlsw.h vendored
View File

@ -3879,6 +3879,7 @@ bool swInit(int w, int h)
RLSW.loadedTextures[0].tWrap = SW_REPEAT;
RLSW.loadedTextures[0].tx = 0.5f;
RLSW.loadedTextures[0].ty = 0.5f;
RLSW.loadedTextures[0].copy = false;
RLSW.loadedTextureCount = 1;
@ -3887,21 +3888,17 @@ bool swInit(int w, int h)
void swClose(void)
{
if (RLSW.framebuffer.color != NULL) {
for (int i = 1; i < RLSW.loadedTextureCount; i++) {
sw_texture_t* texture = &RLSW.loadedTextures[i];
if (sw_is_texture_valid(i) && texture->copy) {
SW_FREE(texture->pixels.ptr);
}
}
SW_FREE(RLSW.framebuffer.color);
}
if (RLSW.framebuffer.depth != NULL) {
SW_FREE(RLSW.framebuffer.depth);
}
if (RLSW.loadedTextures != NULL) {
SW_FREE(RLSW.loadedTextures);
}
if (RLSW.freeTextureIds != NULL) {
SW_FREE(RLSW.freeTextureIds);
}
RLSW = (sw_context_t) { 0 };
}