r5145 - trunk/misc/ttf2conchars

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Nov 30 16:33:50 EST 2008


Author: div0
Date: 2008-11-30 16:33:50 -0500 (Sun, 30 Nov 2008)
New Revision: 5145

Modified:
   trunk/misc/ttf2conchars/ttf2conchars.c
Log:
make it C++-safe


Modified: trunk/misc/ttf2conchars/ttf2conchars.c
===================================================================
--- trunk/misc/ttf2conchars/ttf2conchars.c	2008-11-30 21:25:42 UTC (rev 5144)
+++ trunk/misc/ttf2conchars/ttf2conchars.c	2008-11-30 21:33:50 UTC (rev 5145)
@@ -191,7 +191,7 @@
 	double r, g, b, a, f;
 	Uint8 pr, pg, pb, pa;
 	int i, j;
-	int imax = BLURFUNCIMAX(A,B);
+	int imax = (int) BLURFUNCIMAX(A,B);
 
 	// 1. calculate blackened blurred image
 	a = 0;
@@ -239,7 +239,7 @@
 	else if(C < 0)
 		r = g = b = MAX(0, 255 + C * a);
 
-	return SDL_MapRGBA(fmt, r, g, b, a);
+	return SDL_MapRGBA(fmt, (unsigned char) r, (unsigned char) g, (unsigned char) b, (unsigned char) a);
 }
 
 void blitfilter(SDL_Surface *src, SDL_Surface *dest, int x0, int y0, double A, double B, double C)
@@ -247,7 +247,7 @@
 	// note: x0, y0 is the origin of the UNFILTERED image; it is "transparently" expanded by a BLURFUNCIMAX.
 	int x, y, d;
 
-	d = BLURFUNCIMAX(A,B);
+	d = (int) BLURFUNCIMAX(A,B);
 	SDL_LockSurface(src);
 	SDL_LockSurface(dest);
 	for(y = -d; y < d + src->h; ++y)
@@ -428,7 +428,7 @@
 					if(j == (toY))
 						inc *= dtoY;
 
-					int iinc = inc * 256;
+					int iinc = (int) (inc * 256);
 
 					r += (pr * iinc);
 					g += (pg * iinc);
@@ -585,7 +585,7 @@
 	char widthfilename[512];
 	snprintf(widthfilename, sizeof(widthfilename), "%.*s.width", (int)strlen(outfilename) - 4, outfilename);
 
-	int border=BLURFUNCIMAX(A, B);
+	int border=(int) BLURFUNCIMAX(A, B);
 
 	fprintf(stderr, "Using %d border pixels\n", border);
 
@@ -749,8 +749,8 @@
 			//   destBottom = referenceBottom / cell * h + y
 
 			dest.x = 0;
-			dest.y = (destBottom * referenceTop - destTop * referenceBottom) / (double) (referenceTop - referenceBottom);
-			dest.h = cell * (destBottom - destTop) / (double) (referenceBottom - referenceTop);
+			dest.y = (int) ((double) (destBottom * referenceTop - destTop * referenceBottom) / (double) (referenceTop - referenceBottom));
+			dest.h = (int) (cell * (double) (destBottom - destTop) / (double) (referenceBottom - referenceTop));
 			dest.w = dest.h;
 
 			/*
@@ -810,7 +810,7 @@
 
 	fprintf(stderr, "Writing...\n");
 
-	Image_WriteTGABGRA(outfilename, conchars->w, conchars->h, conchars->pixels);
+	Image_WriteTGABGRA(outfilename, conchars->w, conchars->h, (unsigned char *) conchars->pixels);
 
 	SDL_FreeSurface(conchars);
 




More information about the nexuiz-commits mailing list