(svn r6254) if () cascade -> switch ()
authortron
Thu, 31 Aug 2006 07:13:36 +0000
changeset 4469 224ea00d73af
parent 4468 fb18502e2c12
child 4470 8e66f345f66d
(svn r6254) if () cascade -> switch ()
texteff.c
--- a/texteff.c	Thu Aug 31 07:09:13 2006 +0000
+++ b/texteff.c	Thu Aug 31 07:13:36 2006 +0000
@@ -286,35 +286,32 @@
 
 void DrawTextEffects(DrawPixelInfo *dpi)
 {
-	TextEffect *te;
-
-	if (dpi->zoom < 1) {
-		for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
-			if (te->string_id == INVALID_STRING_ID)
-				continue;
+	const TextEffect* te;
 
-			/* intersection? */
-			if (dpi->left > te->right ||
-					dpi->top > te->bottom ||
-					dpi->left + dpi->width <= te->x ||
-					dpi->top + dpi->height <= te->y)
-						continue;
-			AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
-		}
-	} else if (dpi->zoom == 1) {
-		for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
-			if (te->string_id == INVALID_STRING_ID)
-				continue;
+	switch (dpi->zoom) {
+		case 0:
+			for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
+				if (te->string_id != INVALID_STRING_ID &&
+						dpi->left <= te->right &&
+						dpi->top  <= te->bottom &&
+						dpi->left + dpi->width  > te->x &&
+						dpi->top  + dpi->height > te->y) {
+					AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2, 0);
+				}
+			}
+			break;
 
-			/* intersection? */
-			if (dpi->left > te->right*2 -  te->x ||
-					dpi->top > te->bottom*2 - te->y ||
-					(dpi->left + dpi->width) <= te->x ||
-					(dpi->top + dpi->height) <= te->y)
-						continue;
-			AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2, 0);
-		}
-
+		case 1:
+			for (te = _text_effect_list; te != endof(_text_effect_list); te++) {
+				if (te->string_id != INVALID_STRING_ID &&
+						dpi->left <= te->right  * 2 - te->x &&
+						dpi->top  <= te->bottom * 2 - te->y &&
+						dpi->left + dpi->width  > te->x &&
+						dpi->top  + dpi->height > te->y) {
+					AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2, 0);
+				}
+			}
+			break;
 	}
 }