changeset 129:975725e3126d

Cleanup some prototyping code.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 04 Oct 2012 09:39:01 +0300
parents afa28947e400
children 1d7dc7c8745c
files dmtext_bm.c
diffstat 1 files changed, 7 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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