(svn r15803) -Codechange: use the new text drawing API for multicenter

-Fix (r15800): off-by-one w.r.t. offsets
This commit is contained in:
rubidium
2009-03-22 09:34:06 +00:00
parent fc24b775bb
commit 31a5457c03
9 changed files with 40 additions and 69 deletions

View File

@@ -637,7 +637,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
total_height = (num + 1) * mt;
}
int y = (align == SA_CENTER) ? (bottom + top - num * mt) / 2 : top;
int y = (align == SA_CENTER) ? (bottom + top - total_height + 1) / 2 : top;
const char *src = buffer;
for (;;) {
@@ -652,7 +652,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
y += mt;
if (--num < 0) {
_cur_fontsize = FS_NORMAL;
return y + mt;
return y;
}
break;
} else if (c == SCC_SETX) {
@@ -664,16 +664,6 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, StringID str,
}
}
/** Draw a given string with the centre around the given (x,y) coordinates
* @param x Centre the string around this pixel width
* @param y Centre the string around this pixel height
* @param str String to draw
* @param maxw Maximum width the string can have before it is wrapped */
void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
{
DrawStringMultiLine(x - maxw / 2, x + maxw / 2, y - 1024, y + 1024, str, SA_CENTER);
}
/** Return the string dimension in pixels. The height and width are returned
* in a single Dimension value. TINYFONT, BIGFONT modifiers are only
* supported as the first character of the string. The returned dimensions