[Scummvm-git-logs] scummvm master -> 6e4860343c50d787832bfecfc840befe31a06023

sev- noreply at scummvm.org
Fri Sep 2 12:59:50 UTC 2022


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:
6e4860343c GUI: Avoid dupicate icon loading


Commit: 6e4860343c50d787832bfecfc840befe31a06023
    https://github.com/scummvm/scummvm/commit/6e4860343c50d787832bfecfc840befe31a06023
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-09-02T14:59:29+02:00

Commit Message:
GUI: Avoid dupicate icon loading

Changed paths:
    gui/widgets/grid.cpp


diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 482748b432c..b576d4bad94 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -639,12 +639,22 @@ void GridWidget::reloadThumbnails() {
 			Graphics::ManagedSurface *surf = loadSurfaceFromFile(path);
 			if (!surf) {
 				path = Common::String::format("icons/%s.png", entry->engineid.c_str());
-				surf = loadSurfaceFromFile(path);
+				if (!_loadedSurfaces.contains(path)) {
+					surf = loadSurfaceFromFile(path);
+				} else {
+					continue;
+				}
+
 			}
 
 			if (surf) {
 				const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, _thumbnailHeight, true));
 				_loadedSurfaces[entry->thumbPath] = scSurf;
+
+				if (path != entry->thumbPath) {
+					_loadedSurfaces[path] = new Graphics::ManagedSurface(*scSurf);
+				}
+
 				if (surf != scSurf) {
 					surf->free();
 					delete surf;
@@ -699,7 +709,6 @@ void GridWidget::loadExtraIcons() {  // for now only the demo icon is available
 	} else {
 		_extraIcons[0] = nullptr;
 	}
-	
 }
 
 void GridWidget::destroyItems() {




More information about the Scummvm-git-logs mailing list