[Scummvm-git-logs] scummvm master -> e7476495aba91cf699437458d4d99efbab94e9a5
athrxx
athrxx at scummvm.org
Sat Oct 31 19:47:22 UTC 2020
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:
e7476495ab GUI: prevent unloading of extra font on refresh
Commit: e7476495aba91cf699437458d4d99efbab94e9a5
https://github.com/scummvm/scummvm/commit/e7476495aba91cf699437458d4d99efbab94e9a5
Author: athrxx (athrxx at scummvm.org)
Date: 2020-10-31T20:47:02+01:00
Commit Message:
GUI: prevent unloading of extra font on refresh
When hitting pause in a CJK SCUMM game and then switching to fullscreen the call to ThemeEngine::refresh() would kill the required extra font.
Changed paths:
gui/ThemeEngine.cpp
gui/ThemeEngine.h
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 1d00401769..739b3870d8 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -242,6 +242,7 @@ ThemeEngine::~ThemeEngine() {
_backBuffer.free();
unloadTheme();
+ unloadExtraFont();
// Release all graphics surfaces
for (ImagesMap::iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i) {
@@ -829,6 +830,9 @@ void ThemeEngine::unloadTheme() {
}
for (int i = 0; i < kTextDataMAX; ++i) {
+ // Don't unload the language specific extra font here or it will be lost after a refresh() call.
+ if (i == kTextDataExtraLang)
+ continue;
delete _texts[i];
_texts[i] = nullptr;
}
@@ -842,6 +846,11 @@ void ThemeEngine::unloadTheme() {
_themeOk = false;
}
+void ThemeEngine::unloadExtraFont() {
+ delete _texts[kTextDataExtraLang];
+ _texts[kTextDataExtraLang] = nullptr;
+}
+
bool ThemeEngine::loadDefaultXML() {
// The default XML theme is included on runtime from a pregenerated
diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h
index 761068d174..f7a1d71228 100644
--- a/gui/ThemeEngine.h
+++ b/gui/ThemeEngine.h
@@ -686,6 +686,11 @@ protected:
*/
void unloadTheme();
+ /**
+ * Unload the language specific font loaded via loadExtraFont()
+ */
+ void unloadExtraFont();
+
const Graphics::Font *loadScalableFont(const Common::String &filename, const Common::String &charset, const int pointsize, Common::String &name);
const Graphics::Font *loadFont(const Common::String &filename, Common::String &name);
Common::String genCacheFilename(const Common::String &filename) const;
More information about the Scummvm-git-logs
mailing list