about summary refs log tree commit diff
path: root/src/engine/client/ec_gfx.c
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-12 12:08:26 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2008-01-12 12:08:26 +0000
commit1c1677f02300e5ab10bca9c74ce7f49d4605b9d6 (patch)
tree1601d291fd6c531d5b8dcb6f0ca95829c31b0c76 /src/engine/client/ec_gfx.c
parent24e17b41a8a5d600e0f116bc059ba121ac21bad5 (diff)
downloadzcatch-1c1677f02300e5ab10bca9c74ce7f49d4605b9d6.tar.gz
zcatch-1c1677f02300e5ab10bca9c74ce7f49d4605b9d6.zip
merged 0.3.3 changes over to trunk
Diffstat (limited to 'src/engine/client/ec_gfx.c')
-rw-r--r--src/engine/client/ec_gfx.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c
index 0562a24f..70712ded 100644
--- a/src/engine/client/ec_gfx.c
+++ b/src/engine/client/ec_gfx.c
@@ -489,20 +489,22 @@ int gfx_load_texture_raw(int w, int h, int format, const void *data, int store_f
 	gluBuild2DMipmaps(GL_TEXTURE_2D, store_oglformat, w, h, oglformat, GL_UNSIGNED_BYTE, texdata);
 	
 	/* calculate memory usage */
-	int pixel_size = 4;
-	if(store_format == IMG_RGB)
-		pixel_size = 3;
-	else if(store_format == IMG_ALPHA)
-		pixel_size = 1;
-
-	textures[tex].memsize = w*h*pixel_size;
-	if(mipmap)
 	{
-		while(w > 2 && h > 2)
+		int pixel_size = 4;
+		if(store_format == IMG_RGB)
+			pixel_size = 3;
+		else if(store_format == IMG_ALPHA)
+			pixel_size = 1;
+
+		textures[tex].memsize = w*h*pixel_size;
+		if(mipmap)
 		{
-			w>>=1;
-			h>>=1;
-			textures[tex].memsize += w*h*pixel_size;
+			while(w > 2 && h > 2)
+			{
+				w>>=1;
+				h>>=1;
+				textures[tex].memsize += w*h*pixel_size;
+			}
 		}
 	}
 	
@@ -544,7 +546,9 @@ int gfx_load_mip_texture_raw(int w, int h, int format, const void *data)
 int gfx_load_texture(const char *filename, int store_format)
 {
 	int l = strlen(filename);
+	int id;
 	IMAGE_INFO img;
+	
 	if(l < 3)
 		return 0;
 	if(gfx_load_png(&img, filename))
@@ -552,7 +556,7 @@ int gfx_load_texture(const char *filename, int store_format)
 		if (store_format == IMG_AUTO)
 			store_format = img.format;
 
-		int id = gfx_load_texture_raw(img.width, img.height, img.format, img.data, store_format);
+		id = gfx_load_texture_raw(img.width, img.height, img.format, img.data, store_format);
 		mem_free(img.data);
 		return id;
 	}
@@ -1101,7 +1105,7 @@ void gfx_pretty_text(float x, float y, float size, const char *text, int max_wid
 float gfx_pretty_text_width(float size, const char *text_, int length)
 {
     return gfx_text_width(gfx_font_set, size, text_, length);
-
+	/*
 	const float spacing = 0.05f;
 	float w = 0.0f;
 	const unsigned char *text = (unsigned char *)text_;
@@ -1126,7 +1130,7 @@ float gfx_pretty_text_width(float size, const char *text_, int length)
 		text++;
 	}
 
-	return w;
+	return w;*/
 }