[Scummvm-git-logs] scummvm master -> 2df56f182df3df54ae9bc8d75acf895e5f607592

sev- noreply at scummvm.org
Sun Sep 17 11:44:14 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
2df56f182d GRAPHICS: MACGUI: Wrap more relevant code into #ifdef USE_PNG


Commit: 2df56f182df3df54ae9bc8d75acf895e5f607592
    https://github.com/scummvm/scummvm/commit/2df56f182df3df54ae9bc8d75acf895e5f607592
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-09-17T13:43:47+02:00

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

Changed paths:
    graphics/macgui/mactext.cpp
    graphics/macgui/mactext.h


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 4dcaffe67fd..3ec6b6241b6 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -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)) {
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 542aa9e880f..8ac847fecc2 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -395,7 +395,9 @@ private:
 
 	MacMenu *_menu;
 
+#ifdef USE_PNG
 	Common::HashMap<Common::String, Image::PNGDecoder *> _imageCache;
+#endif
 	Common::Archive *_imageArchive = nullptr;
 };
 




More information about the Scummvm-git-logs mailing list