# HG changeset patch # User Matti Hamalainen # Date 1349332741 -10800 # Node ID 975725e3126dc30edb9be4af2ec592aa54fda893 # Parent afa28947e4004783202e27f419def73d22728f04 Cleanup some prototyping code. diff -r afa28947e400 -r 975725e3126d dmtext_bm.c --- a/dmtext_bm.c Thu Oct 04 09:32:07 2012 +0300 +++ b/dmtext_bm.c Thu Oct 04 09:39:01 2012 +0300 @@ -11,35 +11,19 @@ void dmDrawBMTextConst(SDL_Surface *screen, DMBitmapFont *font, int mode, int xc, int yc, const char *fmt) { const char *ptr = fmt; - DMScaledBlitFunc blit = dmGetScaledBlitFunc(font->glyphs[0]->format, screen->format, mode); + DMUnscaledBlitFunc blit = NULL; while (*ptr) { + int ch = *ptr++; SDL_Surface *glyph; - int pos; - int ch = *ptr++; - if (ch == '_') + if (ch >= 0 && ch < font->nglyphs && (glyph = font->glyphs[ch]) != NULL) { - xc += 4; - continue; - } - else - if (ch >= 'A' && ch <= 'Z') - pos = ch - 'A' + 256 + 1; - else - if (ch >= 'a' && ch <= 'z') - pos = ch - 'a' + 1; - else - if (ch >= '0' && ch <= '9') - pos = ch - '0' + 48; - else - pos = ch; - - if (pos >= 0 && pos < font->nglyphs) - { - glyph = font->glyphs[pos]; - blit(glyph, xc, yc, glyph->w, glyph->h, screen); + if (blit == NULL) + blit = dmGetUnscaledBlitFunc(glyph->format, screen->format, mode); + + blit(glyph, xc, yc, screen); xc += glyph->w; } else