[quake3-commits] r2237 - trunk/code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Apr 6 22:53:42 EDT 2012


Author: ztm
Date: 2012-04-06 22:53:42 -0400 (Fri, 06 Apr 2012)
New Revision: 2237

Modified:
   trunk/code/renderer/tr_font.c
Log:
Fixed some issues found using clang static analyzer.

Modified: trunk/code/renderer/tr_font.c
===================================================================
--- trunk/code/renderer/tr_font.c	2012-04-05 22:43:32 UTC (rev 2236)
+++ trunk/code/renderer/tr_font.c	2012-04-07 02:53:42 UTC (rev 2237)
@@ -290,11 +290,11 @@
 		glyph.t2 = glyph.t + (float)scaled_height / 256;
 
 		*xOut += scaled_width + 1;
+
+		ri.Free(bitmap->buffer);
+		ri.Free(bitmap);
 	}
 
-	ri.Free(bitmap->buffer);
-	ri.Free(bitmap);
-
 	return &glyph;
 }
 #endif
@@ -340,14 +340,13 @@
 	image_t *image;
 	qhandle_t h;
 	float max;
+	float glyphScale;
 #endif
 	void *faceData;
 	int i, len;
 	char name[1024];
-	float dpi = 72;											//
-	float glyphScale =  72.0f / dpi; 		// change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 )
+	float dpi = 72;
 
-
 	if (!fontName) {
 		ri.Printf(PRINT_ALL, "RE_RegisterFont: called with empty name\n");
 		return;
@@ -356,8 +355,6 @@
 	if (pointSize <= 0) {
 		pointSize = 12;
 	}
-	// we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font
-	glyphScale *= 48.0f / pointSize;
 
 	// make sure the render thread is stopped
 	R_SyncRenderThread();
@@ -449,7 +446,7 @@
 	maxHeight = 0;
 
 	for (i = GLYPH_START; i < GLYPH_END; i++) {
-		glyph = RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue);
+		RE_ConstructGlyphInfo(out, &xOut, &yOut, &maxHeight, face, (unsigned char)i, qtrue);
 	}
 
 	xOut = 0;
@@ -514,6 +511,12 @@
 		}
 	}
 
+	// change the scale to be relative to 1 based on 72 dpi ( so dpi of 144 means a scale of .5 )
+	glyphScale = 72.0f / dpi;
+
+	// we also need to adjust the scale based on point size relative to 48 points as the ui scaling is based on a 48 point font
+	glyphScale *= 48.0f / pointSize;
+
 	registeredFont[registeredFontCount].glyphScale = glyphScale;
 	font->glyphScale = glyphScale;
 	Com_Memcpy(&registeredFont[registeredFontCount++], font, sizeof(fontInfo_t));



More information about the quake3-commits mailing list