From 94fb80f021b8a691e1eae66fa6e2fdc592c80b96 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Thu, 29 Mar 2012 05:15:46 +0000 Subject: [PATCH] Fixed possibly placing a font glyph (at the beginning of a row) past the bottom of a font cache image. --- code/renderer/tr_font.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/code/renderer/tr_font.c b/code/renderer/tr_font.c index 6a1c72fb..330760bb 100644 --- a/code/renderer/tr_font.c +++ b/code/renderer/tr_font.c @@ -233,17 +233,11 @@ static glyphInfo_t *RE_ConstructGlyphInfo(unsigned char *imageOut, int *xOut, in // we need to make sure we fit if (*xOut + scaled_width + 1 >= 255) { - if (*yOut + *maxHeight + 1 >= 255) { - *yOut = -1; - *xOut = -1; - ri.Free(bitmap->buffer); - ri.Free(bitmap); - return &glyph; - } else { - *xOut = 0; - *yOut += *maxHeight + 1; - } - } else if (*yOut + *maxHeight + 1 >= 255) { + *xOut = 0; + *yOut += *maxHeight + 1; + } + + if (*yOut + *maxHeight + 1 >= 255) { *yOut = -1; *xOut = -1; ri.Free(bitmap->buffer);