From 3366fd4e1b11e3278095045547d67dfaaf801add Mon Sep 17 00:00:00 2001
From: Andre <maan@p133.(none)>
Date: Sun, 2 Jul 2006 18:48:52 +0200
Subject: [PATCH] Trivial SFont cleanup

---
 SFont.c | 47 ++++++++++++++++-------------------------------
 1 file changed, 16 insertions(+), 31 deletions(-)

diff --git a/SFont.c b/SFont.c
index 8a078c9f..daed6b51 100644
--- a/SFont.c
+++ b/SFont.c
@@ -24,7 +24,7 @@
 #include <string.h> /* strlen */
 SFont_FontInfo InternalFont;
 
-Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
+static Uint32 GetPixel(SDL_Surface *Surface, Sint32 X, Sint32 Y)
 {
 
 	Uint8 *bits;
@@ -45,8 +45,7 @@ Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
 		return *((Uint8 *) Surface->pixels + Y * Surface->pitch + X);
 		break;
 	case 2:
-		return *((Uint16 *) Surface->pixels + Y * Surface->pitch / 2 +
-			 X);
+		return *((Uint16 *) Surface->pixels + Y * Surface->pitch / 2 + X);
 		break;
 	case 3:{	/* Format/endian independent  */
 			Uint8 r, g, b;
@@ -57,8 +56,7 @@ Uint32 GetPixel(SDL_Surface * Surface, Sint32 X, Sint32 Y)
 		}
 		break;
 	case 4:
-		return *((Uint32 *) Surface->pixels + Y * Surface->pitch / 4 +
-			 X);
+		return *((Uint32 *) Surface->pixels + Y * Surface->pitch / 4 + X);
 		break;
 	}
 
@@ -79,12 +77,11 @@ void InitFont2(SFont_FontInfo * Font)
 
 	while (x < Font->Surface->w) {
 		if (GetPixel(Font->Surface, x, 0) ==
-		    SDL_MapRGB(Font->Surface->format, 255, 0, 255)) {
+			SDL_MapRGB(Font->Surface->format, 255, 0, 255)) {
 			Font->CharPos[i++] = x;
-			while ((x < Font->Surface->w - 1)
-			       && (GetPixel(Font->Surface, x, 0) ==
-				   SDL_MapRGB(Font->Surface->format, 255, 0,
-					      255)))
+			while ((x < Font->Surface->w - 1) &&
+				(GetPixel(Font->Surface, x, 0) ==
+				SDL_MapRGB(Font->Surface->format, 255, 0, 255)))
 				x++;
 			Font->CharPos[i++] = x;
 		}
@@ -98,17 +95,6 @@ void InitFont2(SFont_FontInfo * Font)
 			GetPixel(Font->Surface, 0, Font->Surface->h - 1));
 }
 
-#if 0
-void InitFont(SDL_Surface * Font)
-{
-	InternalFont.Surface = Font;
-	InitFont2(&InternalFont);
-}
-
-#endif
-
-
-
 void PutString2(SDL_Surface * Surface, SFont_FontInfo * Font, int x, int y,
 		const char *text)
 {
@@ -124,15 +110,14 @@ void PutString2(SDL_Surface * Surface, SFont_FontInfo * Font, int x, int y,
 			ofs = ((unsigned char) text[i] - 33) * 2 + 1;
 			srcrect.w = dstrect.w = (Font->CharPos[ofs + 2]
 				+ Font->CharPos[ofs + 1]) / 2
-				- (Font->CharPos[ofs] + Font->CharPos[ofs - 1])
-					 / 2;
+				- (Font->CharPos[ofs]
+				+ Font->CharPos[ofs - 1]) / 2;
 			srcrect.h = dstrect.h = Font->Surface->h - 1;
-			srcrect.x =
-			    (Font->CharPos[ofs] + Font->CharPos[ofs - 1]) / 2;
+			srcrect.x = (Font->CharPos[ofs]
+				+ Font->CharPos[ofs - 1]) / 2;
 			srcrect.y = 1;
-			dstrect.x =
-			    x - (float) (Font->CharPos[ofs] -
-					 Font->CharPos[ofs - 1]) / 2;
+			dstrect.x = x - (float) (Font->CharPos[ofs]
+				- Font->CharPos[ofs - 1]) / 2;
 			dstrect.y = y;
 			SDL_BlitSurface(Font->Surface, &srcrect, Surface,
 					&dstrect);
@@ -160,7 +145,7 @@ int TextWidth2(SFont_FontInfo * Font, char *text)
 	return x;
 }
 
-void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
+static void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
 		int y, int PixelWidth, char *text)
 {
 	SDL_Event event;
@@ -208,7 +193,7 @@ void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
 			blinktimer = SDL_GetTicks() + 500;
 			if (blink) {
 				PutString2(Dest, Font,
-					   x + TextWidth2(Font, text), y, "|");
+					x + TextWidth2(Font, text), y, "|");
 				SDL_UpdateRects(Dest, 1, &rect);
 			} else {
 				SDL_BlitSurface(Back, NULL, Dest, &rect);
@@ -226,7 +211,7 @@ void SFont_InternalInput(SDL_Surface * Dest, SFont_FontInfo * Font, int x,
 }
 
 void SFont_Input2(SDL_Surface * Dest, SFont_FontInfo * Font, int x, int y,
-		  int PixelWidth, char *text)
+		int PixelWidth, char *text)
 {
 	SFont_InternalInput(Dest, Font, x, y, PixelWidth, text);
 }
-- 
2.39.5