From af0dc52db16a0e1a0d11fcba45e21dfbbedfce5c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 29 Jan 2024 14:30:51 +0100 Subject: Removed remnants of alpha cache in ResourceManager Continuation of 2c51c98625b225cecfb9628c30d62d4e30f7e3e1, which had already removed most of the alpha cache in Image. --- src/gui/gui.cpp | 3 --- src/resources/resourcemanager.cpp | 22 ---------------------- src/resources/resourcemanager.h | 13 ------------- 3 files changed, 38 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index e0487d95..fd8f38ea 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -176,9 +176,6 @@ Gui::~Gui() void Gui::logic() { - ResourceManager *resman = ResourceManager::getInstance(); - resman->clearScheduled(); - // Fade out mouse cursor after extended inactivity if (mMouseInactivityTimer < 100 * 15) { diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index a810a11e..71d9ca1c 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -536,25 +536,3 @@ std::vector ResourceManager::loadTextFile( free(fileContents); return lines; } - -SDL_Surface *ResourceManager::loadSDLSurface(const std::string &filename) -{ - SDL_Surface *surface = nullptr; - if (SDL_RWops *rw = PHYSFSRWOPS_openRead(filename.c_str())) - surface = IMG_Load_RW(rw, 1); - return surface; -} - -void ResourceManager::scheduleDelete(SDL_Surface* surface) -{ - mDeletedSurfaces.insert(surface); -} - -void ResourceManager::clearScheduled() -{ - for (auto mDeletedSurface : mDeletedSurfaces) - { - SDL_FreeSurface(mDeletedSurface); - } - mDeletedSurfaces.clear(); -} diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index a087082d..9a427ba0 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -26,7 +26,6 @@ #include #include #include -#include class Image; class ImageSet; @@ -35,7 +34,6 @@ class Resource; class SoundEffect; class SpriteDef; -struct SDL_Surface; struct SDL_RWops; /** @@ -207,16 +205,6 @@ class ResourceManager */ std::vector loadTextFile(const std::string &fileName); - /** - * Loads the given filename as an SDL surface. The returned surface is - * expected to be freed by the caller using SDL_FreeSurface. - */ - SDL_Surface *loadSDLSurface(const std::string &filename); - - void scheduleDelete(SDL_Surface* surface); - - void clearScheduled(); - /** * Returns an instance of the class, creating one if it does not * already exist. @@ -251,7 +239,6 @@ class ResourceManager static ResourceManager *instance; using Resources = std::map; using ResourceIterator = Resources::iterator; - std::set mDeletedSurfaces; Resources mResources; Resources mOrphanedResources; time_t mOldestOrphan; -- cgit v1.2.3-70-g09d2