Fix some warnings

This commit is contained in:
Bart van Strien
2011-12-27 21:25:06 +01:00
parent a855a01f02
commit 864c800e10
11 changed files with 49 additions and 25 deletions
+3 -3
View File
@@ -267,11 +267,11 @@ namespace opengl
// on wordwrap, push line to line buffer and clear string builder
if (width >= wrap && oldwidth > 0)
{
int realw = width;
int realw = (int) width;
lines_to_draw.push_back( string_builder.str() );
string_builder.str( "" );
width = static_cast<float>(getWidth( word ));
realw -= width;
realw -= (int) width;
if (realw > maxw)
maxw = realw;
}
@@ -281,7 +281,7 @@ namespace opengl
}
// push last line
if (width > maxw)
maxw = width;
maxw = (int) width;
lines_to_draw.push_back( string_builder.str() );
}
+5 -5
View File
@@ -775,10 +775,10 @@ namespace opengl
if (overdraw_top && overdraw_bottom)
{
overdraw_top[pos] = vertices[pos];
overdraw_top[pos+1] = vertices[pos] * halo + q * (1. - halo);
overdraw_top[pos+1] = vertices[pos] * halo + q * (1.f - halo);
overdraw_bottom[pos] = vertices[pos+1];
overdraw_bottom[pos+1] = vertices[pos+1] * halo + q * (1. - halo);
overdraw_bottom[pos+1] = vertices[pos+1] * halo + q * (1.f - halo);
}
}
@@ -800,7 +800,7 @@ namespace opengl
// get line vertex boundaries
// if not looping, extend the line at the beginning, else use last point as `p'
float halfwidth = lineWidth/2.0f;
float halo = 1. + 1./halfwidth; // XXX: customizable?
float halo = 1.f + 1.f/halfwidth; // XXX: customizable?
r = Vector(coords[0], coords[1]);
if (!looping)
q = r * 2 - Vector(coords[2], coords[3]);
@@ -837,10 +837,10 @@ namespace opengl
// odd indices point to outer vertices => alpha = 0.
Colorf tmp;
glGetFloatv(GL_CURRENT_COLOR, (GLfloat*)(&tmp));
Color color(tmp.r * 255.0f, tmp.g * 255.0f, tmp.b * 255.0f, tmp.a * 255.0f);
Color color((unsigned char) (tmp.r * 255.0f), (unsigned char) (tmp.g * 255.0f), (unsigned char) (tmp.b * 255.0f), (unsigned char) (tmp.a * 255.0f));
Color *colors = new Color[count];
for (int i = 0; i < count; ++i)
for (unsigned int i = 0; i < count; ++i)
{
colors[i] = color;
colors[i].a *= int(i%2 == 0); // avoids branching. equiv to colors[i].a *= (i%2==0) ? 1 : 0;
+1 -1
View File
@@ -389,7 +389,7 @@ namespace opengl
bool Image::hasNpot()
{
return GLEE_ARB_texture_non_power_of_two;
return GLEE_ARB_texture_non_power_of_two != 0;
}
} // opengl
+2 -2
View File
@@ -108,9 +108,9 @@ namespace opengl
for (size_t i = 0; i < NUM_VERTICES; ++i)
{
if (x)
vertices[i].s = 1.0 - vertices[i].s;
vertices[i].s = 1.0f - vertices[i].s;
if (y)
vertices[i].t = 1.0 - vertices[i].t;
vertices[i].t = 1.0f - vertices[i].t;
}
}
@@ -1019,7 +1019,7 @@ namespace opengl
float radius = (float)luaL_checknumber(L, 4);
int points;
if (lua_isnoneornil(L, 5))
points = radius > 10 ? radius : 10;
points = radius > 10 ? (int) (radius) : 10;
else
points = luaL_checkint(L, 5);
@@ -1041,7 +1041,7 @@ namespace opengl
float angle2 = (float)luaL_checknumber(L, 6);
int points;
if (lua_isnoneornil(L, 7))
points = radius > 10 ? radius : 10;
points = radius > 10 ? (int) (radius) : 10;
else
points = luaL_checkint(L, 7);