[Scummvm-git-logs] scummvm master -> 70a2b2ac5fe12b985e9ed93d0eceea658615bfc3
sev-
noreply at scummvm.org
Thu Jan 12 22:11:57 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
d54daa0aee GUI: Try loading PNG flag if a vector isn't available
23aa5eeb31 GUI: Align flags using thumbnail size
70a2b2ac5f GUI: Improve comment, typo fix
Commit: d54daa0aee46a4c3e9e605ee2f30c5c8db1e2111
https://github.com/scummvm/scummvm/commit/d54daa0aee46a4c3e9e605ee2f30c5c8db1e2111
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-01-12T23:11:50+01:00
Commit Message:
GUI: Try loading PNG flag if a vector isn't available
Changed paths:
gui/widgets/grid.cpp
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 8d73e11843e..dfb423fb0b9 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -672,8 +672,19 @@ void GridWidget::loadFlagIcons() {
Graphics::ManagedSurface *gfx = loadSurfaceFromFile(path, _flagIconWidth, _flagIconHeight);
if (gfx) {
_languageIcons[l->id] = gfx;
+ continue;
+ } // if no .svg, try .png
+ path = Common::String::format("icons/flags/%s.png", l->code);
+ gfx = loadSurfaceFromFile(path);
+ if (gfx) {
+ const Graphics::ManagedSurface *scGfx = scaleGfx(gfx, _flagIconWidth, _flagIconHeight, true);
+ _languageIcons[l->id] = scGfx;
+ if (gfx != scGfx) {
+ gfx->free();
+ delete gfx;
+ }
} else {
- _languageIcons[l->id] = nullptr;
+ _languageIcons[l->id] = nullptr; // nothing found, set no nullptr
}
}
}
Commit: 23aa5eeb31a69be89d2a36a8f5864c3d5a820b75
https://github.com/scummvm/scummvm/commit/23aa5eeb31a69be89d2a36a8f5864c3d5a820b75
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-01-12T23:11:50+01:00
Commit Message:
GUI: Align flags using thumbnail size
Changed paths:
gui/widgets/grid.cpp
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index dfb423fb0b9..67395d990f0 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -132,7 +132,9 @@ void GridItemWidget::drawWidget() {
// Draw Flag
const Graphics::ManagedSurface *flagGfx = _grid->languageToSurface(_activeEntry->language);
if (flagGfx) {
- Common::Point p(_x + thumbWidth - flagGfx->w - 5, _y + 5);
+ // SVG and PNG can resize differently so it's better to use thumbWidth as reference to
+ // ensure all flags are aligned
+ Common::Point p(_x + thumbWidth - (thumbWidth / 5), _y + 5);
g_gui.theme()->drawSurface(p, *flagGfx, true);
}
Commit: 70a2b2ac5fe12b985e9ed93d0eceea658615bfc3
https://github.com/scummvm/scummvm/commit/70a2b2ac5fe12b985e9ed93d0eceea658615bfc3
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-01-12T23:11:50+01:00
Commit Message:
GUI: Improve comment, typo fix
Changed paths:
gui/widgets/grid.cpp
diff --git a/gui/widgets/grid.cpp b/gui/widgets/grid.cpp
index 67395d990f0..0a51805c852 100644
--- a/gui/widgets/grid.cpp
+++ b/gui/widgets/grid.cpp
@@ -675,7 +675,7 @@ void GridWidget::loadFlagIcons() {
if (gfx) {
_languageIcons[l->id] = gfx;
continue;
- } // if no .svg, try .png
+ } // if no .svg flag is available, search for a .png
path = Common::String::format("icons/flags/%s.png", l->code);
gfx = loadSurfaceFromFile(path);
if (gfx) {
@@ -686,7 +686,7 @@ void GridWidget::loadFlagIcons() {
delete gfx;
}
} else {
- _languageIcons[l->id] = nullptr; // nothing found, set no nullptr
+ _languageIcons[l->id] = nullptr; // nothing found, set to nullptr
}
}
}
More information about the Scummvm-git-logs
mailing list