From 4fae197c67b8cecf5a674c710530c44f5cef814e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 6 Jan 2005 19:09:34 +0000 Subject: Patch #1092994 (Selfscaling GUI) svn-id: r16455 --- graphics/scummfont.cpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'graphics/scummfont.cpp') 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); -- cgit v1.2.3