[Scummvm-cvs-logs] SF.net SVN: scummvm:[40727] scummvm/trunk/engines/sci/gfx/font.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue May 19 17:59:17 CEST 2009


Revision: 40727
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40727&view=rev
Author:   thebluegr
Date:     2009-05-19 15:59:17 +0000 (Tue, 19 May 2009)

Log Message:
-----------
Removed some redundant variables, and renamed some variables with strange names ("foo"?)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/font.cpp

Modified: scummvm/trunk/engines/sci/gfx/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font.cpp	2009-05-19 12:39:53 UTC (rev 40726)
+++ scummvm/trunk/engines/sci/gfx/font.cpp	2009-05-19 15:59:17 UTC (rev 40727)
@@ -43,42 +43,39 @@
 }
 
 bool gfxr_font_calculate_size(Common::Array<TextFragment> &fragments, gfx_bitmap_font_t *font, int max_width,
-	const char *text, int *width, int *height,
-	int *line_height_p, int *last_offset_p, int flags) {
+	const char *text, int *width, int *height, int *line_height_p, int *last_offset_p, int flags) {
 
-	int lineheight = font->line_height;
-	int maxheight = lineheight;
+	int maxheight = font->line_height;
 	int last_breakpoint = 0;
 	int last_break_width = 0;
-	int max_allowed_width = max_width;
 	int maxwidth = 0, localmaxwidth = 0;
 	const char *breakpoint_ptr = NULL;
-	unsigned char foo;
+	unsigned char curChar;
 
 	if (line_height_p)
-		*line_height_p = lineheight;
+		*line_height_p = font->line_height;
 
 
 	fragments.push_back(TextFragment(text));
 
-	while ((foo = *text++)) {
-		if (foo >= font->chars_nr) {
+	while ((curChar = *text++)) {
+		if (curChar >= font->chars_nr) {
 			error("Invalid char 0x%02x (max. 0x%02x) encountered in text string '%s', font %04x",
-			        foo, font->chars_nr, text, font->ID);
+			        curChar, font->chars_nr, text, font->ID);
 			if (font->chars_nr > ' ')
-				foo = ' ';
+				curChar = ' ';
 			else {
 				return false;
 			}
 		}
 
-		if (((foo == '\n') || (foo == 0x0d)) && !(flags & kFontNoNewlines)) {
+		if (((curChar == '\n') || (curChar == 0x0d)) && !(flags & kFontNoNewlines)) {
 			fragments.back().length = text - 1 - fragments.back().offset;
 
 			if (*text)
-				maxheight += lineheight;
+				maxheight += font->line_height;
 
-			if (foo == 0x0d && *text == '\n')
+			if (curChar == 0x0d && *text == '\n')
 				text++; // Interpret DOS-style CR LF as single NL
 
 			fragments.push_back(TextFragment(text));
@@ -88,16 +85,16 @@
 
 			localmaxwidth = 0;
 
-		} else { // foo != '\n'
-			localmaxwidth += font->widths[foo];
+		} else { // curChar != '\n'
+			localmaxwidth += font->widths[curChar];
 
-			if (localmaxwidth > max_allowed_width) {
+			if (localmaxwidth > max_width) {
 				int blank_break = 1; // break is at a blank char, i.e. not within a word
 
-				maxheight += lineheight;
+				maxheight += font->line_height;
 
 				if (last_breakpoint == 0) { // Text block too long and without whitespace?
-					last_breakpoint = localmaxwidth - font->widths[foo];
+					last_breakpoint = localmaxwidth - font->widths[curChar];
 					last_break_width = 0;
 					--text;
 					blank_break = 0; // non-blank break
@@ -107,7 +104,7 @@
 				}
 
 				if (last_breakpoint == 0) {
-					GFXWARN("Warning: maxsize %d too small for '%s'\n", max_allowed_width, text);
+					GFXWARN("Warning: maxsize %d too small for '%s'\n", max_width, text);
 				}
 
 				if (last_breakpoint > maxwidth)
@@ -123,7 +120,7 @@
 
 			} else if (*text == ' ') {
 				last_breakpoint = localmaxwidth;
-				last_break_width = font->widths[foo];
+				last_break_width = font->widths[curChar];
 				breakpoint_ptr = text;
 			}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list