Browse Source

Make RendererTextureSurface a SDLSurfaceUniquePtr

pull/2867/head
Vladimir Olteanu 5 years ago committed by Anders Jenbo
parent
commit
4edafd2e37
  1. 6
      Source/dx.cpp
  2. 4
      Source/utils/display.cpp

6
Source/dx.cpp

@ -32,7 +32,7 @@ SDLPaletteUniquePtr Palette;
unsigned int pal_surface_palette_version = 0; unsigned int pal_surface_palette_version = 0;
/** 24-bit renderer texture surface */ /** 24-bit renderer texture surface */
SDL_Surface *renderer_texture_surface = nullptr; SDLSurfaceUniquePtr RendererTextureSurface;
/** 8-bit surface that we render to */ /** 8-bit surface that we render to */
SDL_Surface *pal_surface; SDL_Surface *pal_surface;
@ -105,7 +105,7 @@ void CreatePrimarySurface()
Uint32 format; Uint32 format;
if (SDL_QueryTexture(texture.get(), &format, nullptr, nullptr, nullptr) < 0) if (SDL_QueryTexture(texture.get(), &format, nullptr, nullptr, nullptr) < 0)
ErrSdl(); ErrSdl();
renderer_texture_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format); RendererTextureSurface = SDLWrap::CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format);
} }
#endif #endif
if (GetOutputSurface() == nullptr) { if (GetOutputSurface() == nullptr) {
@ -207,7 +207,7 @@ void dx_cleanup()
SDL_FreeSurface(pal_surface); SDL_FreeSurface(pal_surface);
pal_surface = nullptr; pal_surface = nullptr;
Palette = nullptr; Palette = nullptr;
SDL_FreeSurface(renderer_texture_surface); RendererTextureSurface = nullptr;
#ifndef USE_SDL1 #ifndef USE_SDL1
texture = nullptr; texture = nullptr;
SDL_DestroyRenderer(renderer); SDL_DestroyRenderer(renderer);

4
Source/utils/display.cpp

@ -30,7 +30,7 @@
namespace devilution { namespace devilution {
extern SDL_Surface *renderer_texture_surface; /** defined in dx.cpp */ extern SDLSurfaceUniquePtr RendererTextureSurface; /** defined in dx.cpp */
Uint16 gnScreenWidth; Uint16 gnScreenWidth;
Uint16 gnScreenHeight; Uint16 gnScreenHeight;
@ -260,7 +260,7 @@ SDL_Surface *GetOutputSurface()
return SDL_GetVideoSurface(); return SDL_GetVideoSurface();
#else #else
if (renderer != nullptr) if (renderer != nullptr)
return renderer_texture_surface; return RendererTextureSurface.get();
return SDL_GetWindowSurface(ghMainWnd); return SDL_GetWindowSurface(ghMainWnd);
#endif #endif
} }

Loading…
Cancel
Save