GRAPHICS: MACGUI: Wrap more relevant code into #ifdef USE_PNG

This commit is contained in:
Eugene Sandulenko 2023-09-17 13:43:47 +02:00
parent 9d908e9a0b
commit 2df56f182d
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 9 additions and 6 deletions

View File

@ -273,8 +273,10 @@ MacText::~MacText() {
delete _cursorSurface;
delete _cursorSurface2;
#ifdef USE_PNG
for (auto &i : _imageCache)
delete i._value;
#endif
delete _imageArchive;
}
@ -2793,6 +2795,11 @@ void MacText::setImageArchive(Common::String fname) {
}
const Surface *MacText::getImageSurface(Common::String &fname) {
#ifndef USE_PNG
warning("MacText::getImageSurface(): PNG support not compiled. Cannot load file %s", fname.c_str());
return nullptr;
#else
if (_imageCache.contains(fname))
return _imageCache[fname]->getSurface();
@ -2808,12 +2815,6 @@ const Surface *MacText::getImageSurface(Common::String &fname) {
return nullptr;
}
#ifndef USE_PNG
warning("MacText::getImageSurface(): PNG support not compiled. Cannot load file %s", fname.c_str());
return nullptr;
#else
_imageCache[fname] = new Image::PNGDecoder();
if (!_imageCache[fname]->loadStream(*stream)) {

View File

@ -395,7 +395,9 @@ private:
MacMenu *_menu;
#ifdef USE_PNG
Common::HashMap<Common::String, Image::PNGDecoder *> _imageCache;
#endif
Common::Archive *_imageArchive = nullptr;
};