[Scummvm-git-logs] scummvm master -> 10b085ee5fe3edd7ab5ef79bf4df2c4d98a69042
SupSuper
noreply at scummvm.org
Tue Mar 29 04:29:36 UTC 2022
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dd4d8fc859 GUI: Add engine icon fallbacks to GridWidget thumbnails
10b085ee5f GUI: Render grid thumbnails correctly in different pixel formats
Commit: dd4d8fc8596a0b41e667cd40c2a8fb8da1555bbf
https://github.com/scummvm/scummvm/commit/dd4d8fc8596a0b41e667cd40c2a8fb8da1555bbf
Author: SupSuper (supsuper at gmail.com)
Date: 2022-03-29T05:29:11+01:00
Commit Message:
GUI: Add engine icon fallbacks to GridWidget thumbnails
Changed paths:
gui/widgets/grid.cpp
gui/widgets/grid.h
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 50801511f61..619a7f59b53 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -395,12 +395,9 @@ void GridWidget::unloadSurfaces(Common::HashMap<T, const Graphics::ManagedSurfac
}
const Graphics::ManagedSurface *GridWidget::filenameToSurface(const Common::String &name) {
- for (Common::Array<GridItemInfo *>::iterator l = _visibleEntryList.begin(); l != _visibleEntryList.end(); ++l) {
- if ((!(*l)->isHeader) && ((*l)->thumbPath == name)) {
- return _loadedSurfaces[name];
- }
- }
- return nullptr;
+ if (name.empty())
+ return nullptr;
+ return _loadedSurfaces[name];
}
const Graphics::ManagedSurface *GridWidget::languageToSurface(Common::Language languageCode) {
@@ -573,23 +570,30 @@ void GridWidget::setGroupHeaderFormat(const Common::U32String &prefix, const Com
}
void GridWidget::reloadThumbnails() {
- Graphics::ManagedSurface *surf = nullptr;
- Common::String gameid;
- Common::String engineid;
-
for (Common::Array<GridItemInfo *>::iterator iter = _visibleEntryList.begin(); iter != _visibleEntryList.end(); ++iter) {
GridItemInfo *entry = *iter;
- if (!_loadedSurfaces.contains(entry->thumbPath)) {
- surf = loadSurfaceFromFile(entry->thumbPath);
- if (surf) {
- const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, 512, true));
- _loadedSurfaces[entry->thumbPath] = scSurf;
- if (surf != scSurf) {
- surf->free();
- delete surf;
+ if (entry->isHeader)
+ continue;
+ Graphics::ManagedSurface *surf = nullptr;
+ Common::String path = Common::String::format("icons/%s-%s.png", entry->engineid.c_str(), entry->gameid.c_str());
+ if (!_loadedSurfaces.contains(path)) {
+ surf = loadSurfaceFromFile(path);
+ _loadedSurfaces[path] = surf;
+ if (!surf) {
+ path = Common::String::format("icons/%s.png", entry->engineid.c_str());
+ if (!_loadedSurfaces.contains(path)) {
+ surf = loadSurfaceFromFile(path);
+ _loadedSurfaces[path] = surf;
}
- } else {
- _loadedSurfaces[entry->thumbPath] = nullptr;
+ }
+ }
+ if (surf) {
+ const Graphics::ManagedSurface *scSurf(scaleGfx(surf, _thumbnailWidth, 512, true));
+ _loadedSurfaces[path] = scSurf;
+ entry->thumbPath = path;
+ if (surf != scSurf) {
+ surf->free();
+ delete surf;
}
}
}
diff --git a/gui/widgets/grid.h b/gui/widgets/grid.h
index ba9da46a212..f597670a6eb 100644
--- a/gui/widgets/grid.h
+++ b/gui/widgets/grid.h
@@ -63,12 +63,10 @@ struct GridItemInfo {
GridItemInfo(int id, const Common::String &eid, const Common::String &gid
,const Common::String &t, Common::Language l, Common::Platform p)
: entryID(id), gameid(gid), engineid(eid), title(t), language(l), platform(p), isHeader(false) {
- thumbPath = Common::String::format("icons/%s-%s.png", engineid.c_str(), gameid.c_str());
}
GridItemInfo(const Common::String &groupHeader, int groupID) : title(groupHeader), isHeader(true),
entryID(groupID), language(Common::UNK_LANG), platform(Common::kPlatformUnknown) {
- thumbPath = Common::String("");
}
};
Commit: 10b085ee5fe3edd7ab5ef79bf4df2c4d98a69042
https://github.com/scummvm/scummvm/commit/10b085ee5fe3edd7ab5ef79bf4df2c4d98a69042
Author: SupSuper (supsuper at gmail.com)
Date: 2022-03-29T05:29:13+01:00
Commit Message:
GUI: Render grid thumbnails correctly in different pixel formats
Changed paths:
gui/widgets/grid.cpp
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 619a7f59b53..452574762bd 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -304,7 +304,7 @@ Graphics::ManagedSurface *loadSurfaceFromFile(const Common::String &name, int re
if (!srcSurface) {
warning("Failed to load surface : %s", name.c_str());
} else if (srcSurface->format.bytesPerPixel != 1) {
- surf = new Graphics::ManagedSurface(srcSurface->convertTo(g_system->getOverlayFormat()));
+ surf = new Graphics::ManagedSurface(srcSurface);
}
} else {
debug(5, "GridWidget: Cannot read file '%s'", name.c_str());
More information about the Scummvm-git-logs
mailing list