aboutsummaryrefslogtreecommitdiff
path: root/graphics/fonts
diff options
context:
space:
mode:
authorEugene Sandulenko2017-01-26 11:07:23 +0100
committerEugene Sandulenko2017-01-26 18:08:03 +0100
commitf7ada97cf84b519935dde4890d9507cc06e5723e (patch)
treed8be89c42d2f981c9b999c0a2c2748001b8d3e8b /graphics/fonts
parentacc9773a3df68ffa806cbc52ed7c7b5fa83bb197 (diff)
downloadscummvm-rg350-f7ada97cf84b519935dde4890d9507cc06e5723e.tar.gz
scummvm-rg350-f7ada97cf84b519935dde4890d9507cc06e5723e.tar.bz2
scummvm-rg350-f7ada97cf84b519935dde4890d9507cc06e5723e.zip
GRAPHICS: Fixes to MacFont scaling
Diffstat (limited to 'graphics/fonts')
-rw-r--r--graphics/fonts/macfont.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/graphics/fonts/macfont.cpp b/graphics/fonts/macfont.cpp
index 882e841aa0..820936ca07 100644
--- a/graphics/fonts/macfont.cpp
+++ b/graphics/fonts/macfont.cpp
@@ -440,7 +440,7 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize) {
glyph->bitmapWidth = (int)((float)srcglyph->bitmapWidth * scale);
glyph->bitmapOffset = newBitmapWidth;
- newBitmapWidth += ((glyph->bitmapWidth + 7) / 8);
+ newBitmapWidth += (glyph->bitmapWidth + 7) & ~0x7;
}
data._rowWords = newBitmapWidth;
@@ -454,15 +454,15 @@ MacFONTFont *MacFONTFont::scaleFont(const MacFONTFont *src, int newSize) {
for (uint i = 0; i < src->_data._glyphs.size() + 1; i++) {
const MacGlyph *srcglyph = (i == src->_data._glyphs.size()) ? &src->_data._defaultChar : &src->_data._glyphs[i];
MacGlyph *glyph = (i == src->_data._glyphs.size()) ? &data._defaultChar : &data._glyphs[i];
- byte *ptr = &data._bitImage[glyph->bitmapOffset];
+ byte *ptr = &data._bitImage[glyph->bitmapOffset / 8];
for (int y = 0; y < data._fRectHeight; y++) {
- const byte *srcd = (const byte *)&src->_data._bitImage[((int)((float)y / scale)) * srcPitch + srcglyph->bitmapOffset];
+ const byte *srcd = (const byte *)&src->_data._bitImage[((int)((float)y / scale)) * srcPitch];
byte *dst = ptr;
byte b = 0;
for (int x = 0; x < glyph->width; x++) {
- int sx = (int)((float)x / scale);
+ int sx = (int)((float)x / scale) + srcglyph->bitmapOffset;
if (srcd[sx / 8] & (0x80 >> (sx % 8)))
b |= 1;