aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorMax Horn2009-12-09 16:44:48 +0000
committerMax Horn2009-12-09 16:44:48 +0000
commitfb5e747565e28a6863190e0e837899d5177244af (patch)
tree664990ab09fb610c55b82661dc223e55f4f2aa74 /graphics
parent421363a13258c149bdf976938e7dc8d8438aa9db (diff)
downloadscummvm-rg350-fb5e747565e28a6863190e0e837899d5177244af.tar.gz
scummvm-rg350-fb5e747565e28a6863190e0e837899d5177244af.tar.bz2
scummvm-rg350-fb5e747565e28a6863190e0e837899d5177244af.zip
GRAPHICS: Change font code to be identical on all platforms
svn-id: r46309
Diffstat (limited to 'graphics')
-rw-r--r--graphics/cursorman.cpp6
-rw-r--r--graphics/font.h6
-rw-r--r--graphics/fontman.cpp39
-rw-r--r--graphics/fontman.h1
-rw-r--r--graphics/fonts/consolefont.cpp4
-rw-r--r--graphics/fonts/newfont.cpp4
-rw-r--r--graphics/fonts/newfont_big.cpp4
7 files changed, 17 insertions, 47 deletions
diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp
index 0834760861..0491081d1a 100644
--- a/graphics/cursorman.cpp
+++ b/graphics/cursorman.cpp
@@ -31,11 +31,11 @@ DECLARE_SINGLETON(Graphics::CursorManager);
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();
}
diff --git a/graphics/font.h b/graphics/font.h
index d0d3459af6..6f7b666485 100644
--- a/graphics/font.h
+++ b/graphics/font.h
@@ -140,17 +140,15 @@ public:
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
diff --git a/graphics/fontman.cpp b/graphics/fontman.cpp
index fea29f4489..05abb4e4c7 100644
--- a/graphics/fontman.cpp
+++ b/graphics/fontman.cpp
@@ -29,26 +29,17 @@ DECLARE_SINGLETON(Graphics::FontManager);
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 @@ void initfonts() {
}
}
-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,16 +63,6 @@ const Font *FontManager::getFontByName(const Common::String &name) const {
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:
@@ -87,7 +71,6 @@ const Font *FontManager::getFontByUsage(FontUsage usage) const {
return g_sysfont;
case kBigGUIFont:
return g_sysfont_big;
-#endif
}
return 0;
diff --git a/graphics/fontman.h b/graphics/fontman.h
index 7121c314cd..9896fad38c 100644
--- a/graphics/fontman.h
+++ b/graphics/fontman.h
@@ -83,6 +83,7 @@ public:
private:
friend class Common::Singleton<SingletonBaseType>;
FontManager();
+ ~FontManager();
Common::HashMap<Common::String, const Font *> _fontMap;
};
diff --git a/graphics/fonts/consolefont.cpp b/graphics/fonts/consolefont.cpp
index 113bf87649..65ccd3ec70 100644
--- a/graphics/fonts/consolefont.cpp
+++ b/graphics/fonts/consolefont.cpp
@@ -5651,10 +5651,6 @@ static const FontDesc desc = {
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
diff --git a/graphics/fonts/newfont.cpp b/graphics/fonts/newfont.cpp
index 8d0e879117..0327c0997a 100644
--- a/graphics/fonts/newfont.cpp
+++ b/graphics/fonts/newfont.cpp
@@ -7435,10 +7435,6 @@ static const FontDesc desc = {
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
diff --git a/graphics/fonts/newfont_big.cpp b/graphics/fonts/newfont_big.cpp
index 45b797a3ae..7b15a6ab38 100644
--- a/graphics/fonts/newfont_big.cpp
+++ b/graphics/fonts/newfont_big.cpp
@@ -5539,10 +5539,6 @@ static const FontDesc desc = {
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