aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-08-15 13:15:55 +0000
committerMax Horn2004-08-15 13:15:55 +0000
commite27f2c559243ee316f96d9ee490d4757d981f3a6 (patch)
tree42b837f799fd48f9b67306d6f1cde83052af1243
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
-rw-r--r--gui/console.cpp3
-rw-r--r--gui/newgui.cpp49
-rw-r--r--gui/newgui.h20
3 files changed, 25 insertions, 47 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 433d9f9575..673d3dc83b 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -26,7 +26,8 @@
#include "base/version.h"
#include "graphics/font.h"
-#define kCharWidth g_guifont.getMaxCharWidth()
+
+#define kCharWidth g_gui.getFont().getMaxCharWidth()
namespace GUI {
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);
}
//
diff --git a/gui/newgui.h b/gui/newgui.h
index 13872db69f..8200d9f722 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -28,10 +28,6 @@
#include "common/system.h" // For events
#include "graphics/font.h"
-// Uncomment the following to enable the new font code:
-//#define NEW_FONT_CODE
-
-
namespace GUI {
class Dialog;
@@ -40,12 +36,7 @@ class Dialog;
// Height of a single text line
-#ifdef NEW_FONT_CODE
-#define g_guifont Graphics::g_sysfont
-#else
-#define g_guifont Graphics::g_scummfont
-#endif
-#define kLineHeight (g_guifont.getFontHeight() + 2)
+#define kLineHeight (g_gui.getFont().getFontHeight() + 2)
using Graphics::TextAlignment;
@@ -117,15 +108,19 @@ protected:
void animateCursor();
void updateColors();
+ OverlayColor *getBasePtr(int x, int y);
+
public:
// Theme colors
OverlayColor _color, _shadowcolor;
OverlayColor _bgcolor;
OverlayColor _textcolor;
OverlayColor _textcolorhi;
+
+ // Font
+ const Graphics::Font &getFont() const;
// Drawing primitives
- OverlayColor *getBasePtr(int x, int y);
void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB);
void hLine(int x, int y, int x2, OverlayColor color);
void vLine(int x, int y, int y2, OverlayColor color);
@@ -138,9 +133,6 @@ public:
int getCharWidth(byte c);
void drawString(const String &str, int x, int y, int w, OverlayColor color, Graphics::TextAlignment align = Graphics::kTextAlignLeft, int deltax = 0, bool useEllipsis = true);
- void blitFromBuffer(int x, int y, int w, int h, const byte *buf, int pitch);
- void blitToBuffer(int x, int y, int w, int h, byte *buf, int pitch);
-
void drawBitmap(uint32 *bitmap, int x, int y, OverlayColor color, int h = 8);
void addDirtyRect(int x, int y, int w, int h);