ref: 81eb438482f176526e7d4e0de6d21be49580a27a
parent: a679373c14df49ec7fe3b0ce7377290556667112
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Jul 15 20:15:20 EDT 2019
Fixes and tweaks
--- a/src/Backends/Rendering/SDLTexture.cpp
+++ b/src/Backends/Rendering/SDLTexture.cpp
@@ -86,6 +86,7 @@
void Backend_Deinit(void)
{
+ SDL_DestroyTexture(screen_texture);
SDL_DestroyRenderer(renderer);
}
@@ -126,9 +127,10 @@
surface->needs_syncing = FALSE;
surface->next = surface_list_head;
+ surface->prev = NULL;
+ surface_list_head = surface;
if (surface->next)
surface->next->prev = surface;
- surface_list_head = surface;
return surface;
}
--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -130,6 +130,12 @@
rect_clamped.bottom -= overflow;
}
+ if (rect_clamped.bottom - rect_clamped.top <= 0)
+ return;
+
+ if (rect_clamped.right - rect_clamped.left <= 0)
+ return;
+
// Do the actual blitting
if (colour_key)
{
@@ -204,6 +210,12 @@
{
rect_clamped.bottom -= overflow;
}
+
+ if (rect_clamped.bottom - rect_clamped.top <= 0)
+ return;
+
+ if (rect_clamped.right - rect_clamped.left <= 0)
+ return;
for (long j = 0; j < rect_clamped.bottom - rect_clamped.top; ++j)
{
--- a/src/Draw.cpp
+++ b/src/Draw.cpp
@@ -92,24 +92,24 @@
break;
}
+ rgb24_pixel_format = SDL_AllocFormat(SDL_PIXELFORMAT_RGB24);
+
// Create renderer
if (!Backend_Init(gWindow))
return FALSE;
- rgb24_pixel_format = SDL_AllocFormat(SDL_PIXELFORMAT_RGB24);
-
return TRUE;
}
void EndDirectDraw()
{
- SDL_FreeFormat(rgb24_pixel_format);
-
// Release all surfaces
for (int i = 0; i < SURFACE_ID_MAX; i++)
ReleaseSurface(i);
Backend_Deinit();
+
+ SDL_FreeFormat(rgb24_pixel_format);
}
static BOOL IsEnableBitmap(SDL_RWops *fp)
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -298,7 +298,6 @@
StartDirectDraw(2, colourDepth);
- fullscreen = TRUE;
SDL_ShowCursor(0);
break;
}