aboutsummaryrefslogtreecommitdiff
path: root/graphics/scummfont.cpp
diff options
context:
space:
mode:
authorMax Horn2005-01-06 19:09:34 +0000
committerMax Horn2005-01-06 19:09:34 +0000
commit4fae197c67b8cecf5a674c710530c44f5cef814e (patch)
treed9b403db62fe8864c8aab2a026466eb16d64d391 /graphics/scummfont.cpp
parent5d88c3954968b8eccb86363055bda55300ac2586 (diff)
downloadscummvm-rg350-4fae197c67b8cecf5a674c710530c44f5cef814e.tar.gz
scummvm-rg350-4fae197c67b8cecf5a674c710530c44f5cef814e.tar.bz2
scummvm-rg350-4fae197c67b8cecf5a674c710530c44f5cef814e.zip
Patch #1092994 (Selfscaling GUI)
svn-id: r16455
Diffstat (limited to 'graphics/scummfont.cpp')
-rw-r--r--graphics/scummfont.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/graphics/scummfont.cpp b/graphics/scummfont.cpp
index bf48e95c62..6c66137e9f 100644
--- a/graphics/scummfont.cpp
+++ b/graphics/scummfont.cpp
@@ -20,6 +20,7 @@
#include "stdafx.h"
#include "graphics/font.h"
+#include "gui/newgui.h"
namespace Graphics {
@@ -62,24 +63,36 @@ int ScummFont::getCharWidth(byte chr) const {
}
//void ScummFont::drawChar(byte chr, int xx, int yy, OverlayColor color) {
-void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color) const {
+void ScummFont::drawChar(const Surface *dst, byte chr, int tx, int ty, uint32 color, bool scale) const {
assert(dst != 0);
+ const int scaleFactor = scale ? g_gui.getScaleFactor() : 1;
+ tx *= scaleFactor; ty *= scaleFactor;
+
byte *ptr = (byte *)dst->getBasePtr(tx, ty);
const byte *tmp = guifont + 6 + guifont[4] + chr * 8;
uint buffer = 0;
uint mask = 0;
- for (int y = 0; y < 8; y++) {
+ for (int y = 0; y < 8 * scaleFactor; y++) {
if (ty + y < 0 || ty + y >= dst->h)
continue;
- for (int x = 0; x < 8; x++) {
+ for (int x = 0; x < 8 * scaleFactor; x++) {
+ if(scaleFactor != 1 && !(x % 2))
+ mask >>= 1;
+ else if(scaleFactor == 1)
+ mask >>= 1;
+
if (tx + x < 0 || tx + x >= dst->w)
continue;
unsigned char c;
- mask >>= 1;
+
if (mask == 0) {
- buffer = *tmp++;
+ if(scaleFactor != 1 && !(y % 2))
+ buffer = *tmp++;
+ else if(scaleFactor == 1)
+ buffer = *tmp++;
+
mask = 0x80;
}
c = ((buffer & mask) != 0);