[Scummvm-cvs-logs] CVS: scummvm/graphics consolefont.cpp,1.1,1.2 font.h,1.10,1.11 fontman.cpp,1.6,1.7 newfont.cpp,1.5,1.6 newfont_big.cpp,1.4,1.5

Chris Apers chrilith at users.sourceforge.net
Sat Oct 8 14:12:36 CEST 2005


Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21820

Modified Files:
	consolefont.cpp font.h fontman.cpp newfont.cpp newfont_big.cpp 
Log Message:
PalmOS : very bad hack to fix global constructor problem with ARM

Index: consolefont.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/consolefont.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- consolefont.cpp	6 Feb 2005 18:12:29 -0000	1.1
+++ consolefont.cpp	8 Oct 2005 21:11:44 -0000	1.2
@@ -4777,6 +4777,10 @@
 	sizeof(_font_bits)/sizeof(bitmap_t)
 };
 
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
 extern const NewFont g_consolefont(desc);
+#else
+DEFINE_FONT(g_consolefont)
+#endif
 
 } // End of namespace Graphics

Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/font.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- font.h	30 Jul 2005 21:11:00 -0000	1.10
+++ font.h	8 Oct 2005 21:11:45 -0000	1.11
@@ -116,6 +116,18 @@
 	virtual void drawChar(Surface *dst, byte chr, int x, int y, uint32 color) const;
 };
 
+#if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
+#	define DEFINE_FONT(n) \
+		const NewFont *n;	\
+		void create_##n() {	\
+			n = new NewFont(desc);	\
+		}
+
+#	define INIT_FONT(n) \
+		extern void create_##n(); \
+		create_##n();
+#endif
+
 } // End of namespace Graphics
 
 #endif

Index: fontman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/fontman.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- fontman.cpp	6 Feb 2005 18:12:29 -0000	1.6
+++ fontman.cpp	8 Oct 2005 21:11:45 -0000	1.7
@@ -25,20 +25,44 @@
 
 namespace Graphics {
 
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
 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) {
+		// FIXME : this need to be freed
+		g_initialized = true;
+		g_scummfont = new ScummFont;
+		INIT_FONT(g_sysfont)
+		INIT_FONT(g_sysfont_big)
+		INIT_FONT(g_consolefont)
+	}
+}
 
 FontManager::FontManager() {
+	initfonts();
 }
+#endif
 
 //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))
 	case kOSDFont:
 		return &g_scummfont;
 	case kConsoleFont:
@@ -47,7 +71,18 @@
 		return &g_sysfont;
 	case kBigGUIFont:
 		return &g_sysfont_big;
+#else
+	case kOSDFont:
+		return g_scummfont;
+	case kConsoleFont:
+		return g_consolefont;
+	case kGUIFont:
+		return g_sysfont;
+	case kBigGUIFont:
+		return g_sysfont_big;
+#endif
 	}
+
 	return 0;
 }
 

Index: newfont.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/newfont.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- newfont.cpp	6 Jan 2005 22:38:58 -0000	1.5
+++ newfont.cpp	8 Oct 2005 21:11:45 -0000	1.6
@@ -2533,6 +2533,10 @@
 	sizeof(_font_bits)/sizeof(bitmap_t)
 };
 
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
 extern const NewFont g_sysfont(desc);
+#else
+DEFINE_FONT(g_sysfont);
+#endif
 
 } // End of namespace Graphics

Index: newfont_big.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/newfont_big.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- newfont_big.cpp	17 May 2005 22:43:50 -0000	1.4
+++ newfont_big.cpp	8 Oct 2005 21:11:45 -0000	1.5
@@ -6987,6 +6987,11 @@
 	sizeof(_font_bits)/sizeof(bitmap_t)
 };
 
+#if !(defined(PALMOS_ARM) || defined(PALMOS_DEBUG))
 extern const NewFont g_sysfont_big(desc);
+#else
+DEFINE_FONT(g_sysfont_big)
+#endif
+
 
 } // End of namespace Graphics





More information about the Scummvm-git-logs mailing list