aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/font.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-03-20 14:55:41 -0400
committerPaul Gilbert2016-03-20 14:55:41 -0400
commit3c852cc240221785598023de56e5a71a0d8806fa (patch)
treec2a64b811586e4e9d8a4d5baa04d5c4f9d23bd08 /engines/mads/font.cpp
parentea54e6244e75c609e6886ba210f80fb22c479d3f (diff)
parent509a00109e79156e91c062f145ac3aa86ec8584e (diff)
downloadscummvm-rg350-3c852cc240221785598023de56e5a71a0d8806fa.tar.gz
scummvm-rg350-3c852cc240221785598023de56e5a71a0d8806fa.tar.bz2
scummvm-rg350-3c852cc240221785598023de56e5a71a0d8806fa.zip
Merge branch 'master' into titanic
Diffstat (limited to 'engines/mads/font.cpp')
-rw-r--r--engines/mads/font.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/engines/mads/font.cpp b/engines/mads/font.cpp
index 3e6d23fe6f..3828c3df8e 100644
--- a/engines/mads/font.cpp
+++ b/engines/mads/font.cpp
@@ -167,16 +167,13 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common
return x;
int bottom = y + height - 1;
- if (bottom > surface->getHeight() - 1) {
- height -= MIN(height, bottom - (surface->getHeight() - 1));
+ if (bottom > surface->h - 1) {
+ height -= MIN(height, bottom - (surface->h - 1));
}
if (height <= 0)
return x;
- byte *destPtr = surface->getBasePtr(x, y);
- uint8 *oldDestPtr = destPtr;
-
int xPos = x;
const char *text = msg.c_str();
@@ -185,10 +182,11 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common
int charWidth = _charWidths[(byte)theChar];
if (charWidth > 0) {
-
if (xPos + charWidth > xEnd)
return xPos;
+ Graphics::Surface dest = surface->getSubArea(
+ Common::Rect(xPos, y, xPos + charWidth, y + height));
uint8 *charData = &_charData[_charOffs[(byte)theChar]];
int bpp = getBpp(charWidth);
@@ -196,6 +194,8 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common
charData += bpp * skipY;
for (int i = 0; i < height; i++) {
+ byte *destPtr = (byte *)dest.getBasePtr(0, i);
+
for (int j = 0; j < bpp; j++) {
if (*charData & 0xc0)
*destPtr = _fontColors[(*charData & 0xc0) >> 6];
@@ -211,22 +211,13 @@ int Font::writeString(MSurface *surface, const Common::String &msg, const Common
destPtr++;
charData++;
}
-
- destPtr += surface->getWidth() - bpp * 4;
-
}
-
- destPtr = oldDestPtr + charWidth + spaceWidth;
- oldDestPtr = destPtr;
-
}
xPos += charWidth + spaceWidth;
-
}
return xPos;
-
}
int Font::getWidth(const Common::String &msg, int spaceWidth) {