From 4edafd2e371a8de79d7edcd04becfdcdc2d946ce Mon Sep 17 00:00:00 2001 From: Vladimir Olteanu Date: Sun, 5 Sep 2021 20:12:07 +0300 Subject: [PATCH] Make RendererTextureSurface a SDLSurfaceUniquePtr --- Source/dx.cpp | 6 +++--- Source/utils/display.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/dx.cpp b/Source/dx.cpp index 13bebdbb0..dba3502dd 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -32,7 +32,7 @@ SDLPaletteUniquePtr Palette; unsigned int pal_surface_palette_version = 0; /** 24-bit renderer texture surface */ -SDL_Surface *renderer_texture_surface = nullptr; +SDLSurfaceUniquePtr RendererTextureSurface; /** 8-bit surface that we render to */ SDL_Surface *pal_surface; @@ -105,7 +105,7 @@ void CreatePrimarySurface() Uint32 format; if (SDL_QueryTexture(texture.get(), &format, nullptr, nullptr, nullptr) < 0) ErrSdl(); - renderer_texture_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format); + RendererTextureSurface = SDLWrap::CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format); } #endif if (GetOutputSurface() == nullptr) { @@ -207,7 +207,7 @@ void dx_cleanup() SDL_FreeSurface(pal_surface); pal_surface = nullptr; Palette = nullptr; - SDL_FreeSurface(renderer_texture_surface); + RendererTextureSurface = nullptr; #ifndef USE_SDL1 texture = nullptr; SDL_DestroyRenderer(renderer); diff --git a/Source/utils/display.cpp b/Source/utils/display.cpp index 468062ec8..31e08770a 100644 --- a/Source/utils/display.cpp +++ b/Source/utils/display.cpp @@ -30,7 +30,7 @@ namespace devilution { -extern SDL_Surface *renderer_texture_surface; /** defined in dx.cpp */ +extern SDLSurfaceUniquePtr RendererTextureSurface; /** defined in dx.cpp */ Uint16 gnScreenWidth; Uint16 gnScreenHeight; @@ -260,7 +260,7 @@ SDL_Surface *GetOutputSurface() return SDL_GetVideoSurface(); #else if (renderer != nullptr) - return renderer_texture_surface; + return RendererTextureSurface.get(); return SDL_GetWindowSurface(ghMainWnd); #endif }