aboutsummaryrefslogtreecommitdiff
path: root/gui/newgui.cpp
diff options
context:
space:
mode:
authorMax Horn2004-08-15 13:15:55 +0000
committerMax Horn2004-08-15 13:15:55 +0000
commite27f2c559243ee316f96d9ee490d4757d981f3a6 (patch)
tree42b837f799fd48f9b67306d6f1cde83052af1243 /gui/newgui.cpp
parent54a5e3612d6f62c1843c60b75f428376fa0de208 (diff)
downloadscummvm-rg350-e27f2c559243ee316f96d9ee490d4757d981f3a6.tar.gz
scummvm-rg350-e27f2c559243ee316f96d9ee490d4757d981f3a6.tar.bz2
scummvm-rg350-e27f2c559243ee316f96d9ee490d4757d981f3a6.zip
Removed some obsolete stuff; made switching to the alt font less intrusive (you only have to recompile a single file now); foundation for future run-time font switching...
svn-id: r14623
Diffstat (limited to 'gui/newgui.cpp')
-rw-r--r--gui/newgui.cpp49
1 files changed, 17 insertions, 32 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 524f029cc2..ed58bda981 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -24,6 +24,11 @@
#include "gui/dialog.h"
+// Uncomment the following to enable the new font code:
+//#define NEW_FONT_CODE
+
+
+
namespace GUI {
/*
@@ -239,6 +244,14 @@ void NewGui::closeTopDialog() {
#pragma mark -
+const Graphics::Font &NewGui::getFont() const {
+#ifdef NEW_FONT_CODE
+ return Graphics::g_sysfont;
+#else
+ return Graphics::g_scummfont;
+#endif
+}
+
OverlayColor *NewGui::getBasePtr(int x, int y) {
return (OverlayColor *)((byte *)_screen.pixels + x * _screen.bytesPerPixel + y * _screen.pitch);
}
@@ -361,47 +374,19 @@ void NewGui::addDirtyRect(int x, int y, int w, int h) {
}
void NewGui::drawChar(byte chr, int xx, int yy, OverlayColor color) {
- g_guifont.drawChar(&_screen, chr, xx, yy, color);
+ getFont().drawChar(&_screen, chr, xx, yy, color);
}
int NewGui::getStringWidth(const String &str) {
- return g_guifont.getStringWidth(str);
+ return getFont().getStringWidth(str);
}
int NewGui::getCharWidth(byte c) {
- return g_guifont.getCharWidth(c);
+ return getFont().getCharWidth(c);
}
void NewGui::drawString(const String &s, int x, int y, int w, OverlayColor color, TextAlignment align, int deltax, bool useEllipsis) {
- g_guifont.drawString(&_screen, s, x, y, w, color, align, deltax, useEllipsis);
-}
-
-//
-// Blit from a buffer to the display
-//
-void NewGui::blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch) {
- OverlayColor *ptr = getBasePtr(x, y);
-
- assert(buf);
- while (h--) {
- memcpy(ptr, buf, w*2);
- ptr += _screenPitch;
- buf += pitch;
- }
-}
-
-//
-// Blit from the display to a buffer
-//
-void NewGui::blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch) {
- OverlayColor *ptr = getBasePtr(x, y);
-
- assert(buf);
- while (h--) {
- memcpy(buf, ptr, w * 2);
- ptr += _screenPitch;
- buf += pitch;
- }
+ getFont().drawString(&_screen, s, x, y, w, color, align, deltax, useEllipsis);
}
//