From 218aab57f115d6ab142c8580f547816f06cf69c9 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 25 Mar 2021 02:05:08 +0000 Subject: [PATCH] Remove the raw pointer ScaleSurfaceToOutput --- SourceX/display.cpp | 19 +++---------------- SourceX/display.h | 4 ---- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/SourceX/display.cpp b/SourceX/display.cpp index 6f46cd304..316f5c49c 100644 --- a/SourceX/display.cpp +++ b/SourceX/display.cpp @@ -304,23 +304,10 @@ SDL_Surface *CreateScaledSurface(SDL_Surface *src) SDLSurfaceUniquePtr ScaleSurfaceToOutput(SDLSurfaceUniquePtr surface) { #ifdef USE_SDL1 - SDL_Surface *ptr = surface.release(); - ScaleSurfaceToOutput(&ptr); - return SDLSurfaceUniquePtr{ptr}; -#else - return surface; -#endif -} - -void ScaleSurfaceToOutput(SDL_Surface **surface) -{ -#ifdef USE_SDL1 - if (!OutputRequiresScaling()) - return; - SDL_Surface *stretched = CreateScaledSurface(*surface); - SDL_FreeSurface((*surface)); - *surface = stretched; + if (OutputRequiresScaling()) + return SDLSurfaceUniquePtr { CreateScaledSurface(surface.get()) }; #endif + return surface; } } // namespace devilution diff --git a/SourceX/display.h b/SourceX/display.h index b5094eb80..ec5d716a0 100644 --- a/SourceX/display.h +++ b/SourceX/display.h @@ -42,10 +42,6 @@ void ScaleOutputRect(SDL_Rect *rect); // If the output requires software scaling, replaces the given surface with a scaled one. SDLSurfaceUniquePtr ScaleSurfaceToOutput(SDLSurfaceUniquePtr surface); -// Prefer the SDLSurfaceUniquePtr version. -// FIXME: Delete this version. -void ScaleSurfaceToOutput(SDL_Surface **surface); - // Convert from output coordinates to logical (resolution-independent) coordinates. template < typename T,