[Scummvm-cvs-logs] SF.net SVN: scummvm:[46309] scummvm/trunk/graphics
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Wed Dec 9 17:44:48 CET 2009
Revision: 46309
http://scummvm.svn.sourceforge.net/scummvm/?rev=46309&view=rev
Author: fingolfin
Date: 2009-12-09 16:44:48 +0000 (Wed, 09 Dec 2009)
Log Message:
-----------
GRAPHICS: Change font code to be identical on all platforms
Modified Paths:
--------------
scummvm/trunk/graphics/cursorman.cpp
scummvm/trunk/graphics/font.h
scummvm/trunk/graphics/fontman.cpp
scummvm/trunk/graphics/fontman.h
scummvm/trunk/graphics/fonts/consolefont.cpp
scummvm/trunk/graphics/fonts/newfont.cpp
scummvm/trunk/graphics/fonts/newfont_big.cpp
Modified: scummvm/trunk/graphics/cursorman.cpp
===================================================================
--- scummvm/trunk/graphics/cursorman.cpp 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/cursorman.cpp 2009-12-09 16:44:48 UTC (rev 46309)
@@ -31,11 +31,11 @@
namespace Graphics {
-static bool g_initialized = false;
+static bool s_initialized = false;
CursorManager::CursorManager() {
- if (!g_initialized) {
- g_initialized = true;
+ if (!s_initialized) {
+ s_initialized = true;
_cursorStack.clear();
_cursorPaletteStack.clear();
}
Modified: scummvm/trunk/graphics/font.h
===================================================================
--- scummvm/trunk/graphics/font.h 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/font.h 2009-12-09 16:44:48 UTC (rev 46309)
@@ -140,17 +140,15 @@
static NewFont *loadFromCache(Common::SeekableReadStream &stream);
};
-#if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
-# define DEFINE_FONT(n) \
+#define DEFINE_FONT(n) \
const NewFont *n; \
void create_##n() { \
n = new NewFont(desc); \
}
-# define INIT_FONT(n) \
+#define INIT_FONT(n) \
extern void create_##n(); \
create_##n();
-#endif
} // End of namespace Graphics
Modified: scummvm/trunk/graphics/fontman.cpp
===================================================================
--- scummvm/trunk/graphics/fontman.cpp 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/fontman.cpp 2009-12-09 16:44:48 UTC (rev 46309)
@@ -29,26 +29,17 @@
namespace Graphics {
-#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
-const ScummFont g_scummfont;
-extern const NewFont g_sysfont;
-extern const NewFont g_sysfont_big;
-extern const NewFont g_consolefont;
-
-FontManager::FontManager() {
-}
-
-#else
const ScummFont *g_scummfont;
extern const NewFont *g_sysfont;
extern const NewFont *g_sysfont_big;
extern const NewFont *g_consolefont;
-static bool g_initialized = false;
-void initfonts() {
- if (!g_initialized) {
+static bool s_initialized = false;
+
+FontManager::FontManager() {
+ if (!s_initialized) {
// FIXME : this need to be freed
- g_initialized = true;
+ s_initialized = true;
g_scummfont = new ScummFont;
INIT_FONT(g_sysfont)
INIT_FONT(g_sysfont_big)
@@ -56,10 +47,13 @@
}
}
-FontManager::FontManager() {
- initfonts();
+FontManager::~FontManager() {
+ s_initialized = false;
+ delete g_scummfont;
+ delete g_sysfont;
+ delete g_sysfont_big;
+ delete g_consolefont;
}
-#endif
const Font *FontManager::getFontByName(const Common::String &name) const {
if (!_fontMap.contains(name))
@@ -69,17 +63,7 @@
const Font *FontManager::getFontByUsage(FontUsage usage) const {
switch (usage) {
-#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
case kOSDFont:
- return &g_scummfont;
- case kConsoleFont:
- return &g_consolefont;
- case kGUIFont:
- return &g_sysfont;
- case kBigGUIFont:
- return &g_sysfont_big;
-#else
- case kOSDFont:
return g_scummfont;
case kConsoleFont:
return g_consolefont;
@@ -87,7 +71,6 @@
return g_sysfont;
case kBigGUIFont:
return g_sysfont_big;
-#endif
}
return 0;
Modified: scummvm/trunk/graphics/fontman.h
===================================================================
--- scummvm/trunk/graphics/fontman.h 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/fontman.h 2009-12-09 16:44:48 UTC (rev 46309)
@@ -83,6 +83,7 @@
private:
friend class Common::Singleton<SingletonBaseType>;
FontManager();
+ ~FontManager();
Common::HashMap<Common::String, const Font *> _fontMap;
};
Modified: scummvm/trunk/graphics/fonts/consolefont.cpp
===================================================================
--- scummvm/trunk/graphics/fonts/consolefont.cpp 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/fonts/consolefont.cpp 2009-12-09 16:44:48 UTC (rev 46309)
@@ -5651,10 +5651,6 @@
sizeof(_font_bits)/sizeof(bitmap_t)
};
-#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
-extern const NewFont g_consolefont(desc);
-#else
DEFINE_FONT(g_consolefont)
-#endif
} // End of namespace Graphics
Modified: scummvm/trunk/graphics/fonts/newfont.cpp
===================================================================
--- scummvm/trunk/graphics/fonts/newfont.cpp 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/fonts/newfont.cpp 2009-12-09 16:44:48 UTC (rev 46309)
@@ -7435,10 +7435,6 @@
sizeof(_font_bits)/sizeof(bitmap_t)
};
-#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
-extern const NewFont g_sysfont(desc);
-#else
DEFINE_FONT(g_sysfont)
-#endif
} // End of namespace Graphics
Modified: scummvm/trunk/graphics/fonts/newfont_big.cpp
===================================================================
--- scummvm/trunk/graphics/fonts/newfont_big.cpp 2009-12-09 16:41:08 UTC (rev 46308)
+++ scummvm/trunk/graphics/fonts/newfont_big.cpp 2009-12-09 16:44:48 UTC (rev 46309)
@@ -5539,10 +5539,6 @@
sizeof(_font_bits)/sizeof(bitmap_t)
};
-#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
-extern const NewFont g_sysfont_big(desc);
-#else
DEFINE_FONT(g_sysfont_big)
-#endif
} // End of namespace Graphics
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list