Fix compiler warnings

The maintainer-flags option discovered the usual amount of
collisions and compiler warnings we have to fix in order to
get distcheck to pass.
This commit is contained in:
Emmanuele Bassi 2009-01-23 13:08:46 +00:00
parent 20b5eecbd9
commit 726ee43761
2 changed files with 180 additions and 167 deletions

View File

@ -166,13 +166,13 @@ cogl_path_new (void)
} }
void void
cogl_path_line (float x1, cogl_path_line (float x_1,
float y1, float y_1,
float x2, float x_2,
float y2) float y_2)
{ {
cogl_path_move_to (x1, y1); cogl_path_move_to (x_1, y_1);
cogl_path_line_to (x2, y2); cogl_path_line_to (x_2, y_2);
} }
void void
@ -474,12 +474,12 @@ _cogl_path_bezier3_sub (CoglBezCubic *cubic)
} }
void void
cogl_path_curve_to (float x1, cogl_path_curve_to (float x_1,
float y1, float y_1,
float x2, float x_2,
float y2, float y_2,
float x3, float x_3,
float y3) float y_3)
{ {
CoglBezCubic cubic; CoglBezCubic cubic;
@ -487,12 +487,12 @@ cogl_path_curve_to (float x1,
/* Prepare cubic curve */ /* Prepare cubic curve */
cubic.p1 = ctx->path_pen; cubic.p1 = ctx->path_pen;
cubic.p2.x = x1; cubic.p2.x = x_1;
cubic.p2.y = y1; cubic.p2.y = y_1;
cubic.p3.x = x2; cubic.p3.x = x_2;
cubic.p3.y = y2; cubic.p3.y = y_2;
cubic.p4.x = x3; cubic.p4.x = x_3;
cubic.p4.y = y3; cubic.p4.y = y_3;
/* Run subdivision */ /* Run subdivision */
_cogl_path_bezier3_sub (&cubic); _cogl_path_bezier3_sub (&cubic);
@ -503,21 +503,21 @@ cogl_path_curve_to (float x1,
} }
void void
cogl_path_rel_curve_to (float x1, cogl_path_rel_curve_to (float x_1,
float y1, float y_1,
float x2, float x_2,
float y2, float y_2,
float x3, float x_3,
float y3) float y_3)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_curve_to (ctx->path_pen.x + x1, cogl_path_curve_to (ctx->path_pen.x + x_1,
ctx->path_pen.y + y1, ctx->path_pen.y + y_1,
ctx->path_pen.x + x2, ctx->path_pen.x + x_2,
ctx->path_pen.y + y2, ctx->path_pen.y + y_2,
ctx->path_pen.x + x3, ctx->path_pen.x + x_3,
ctx->path_pen.y + y3); ctx->path_pen.y + y_3);
} }
@ -593,10 +593,10 @@ _cogl_path_bezier2_sub (CoglBezQuad *quad)
} }
void void
cogl_path_curve2_to (float x1, cogl_path_curve2_to (float x_1,
float y1, float y_1,
float x2, float x_2,
float y2) float y_2)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -604,10 +604,10 @@ cogl_path_curve2_to (float x1,
/* Prepare quadratic curve */ /* Prepare quadratic curve */
quad.p1 = ctx->path_pen; quad.p1 = ctx->path_pen;
quad.p2.x = x1; quad.p2.x = x_1;
quad.p2.y = y1; quad.p2.y = y_1;
quad.p3.x = x2; quad.p3.x = x_2;
quad.p3.y = y2; quad.p3.y = y_2;
/* Run subdivision */ /* Run subdivision */
_cogl_path_bezier2_sub (&quad); _cogl_path_bezier2_sub (&quad);
@ -618,16 +618,16 @@ cogl_path_curve2_to (float x1,
} }
void void
cogl_rel_curve2_to (float x1, cogl_rel_curve2_to (float x_1,
float y1, float y_1,
float x2, float x_2,
float y2) float y_2)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
cogl_path_curve2_to (ctx->path_pen.x + x1, cogl_path_curve2_to (ctx->path_pen.x + x_1,
ctx->path_pen.y + y2, ctx->path_pen.y + y_1,
ctx->path_pen.x + x2, ctx->path_pen.x + x_2,
ctx->path_pen.y + y2); ctx->path_pen.y + y_2);
} }
#endif #endif

View File

@ -1979,10 +1979,14 @@ _cogl_texture_flush_vertices (void)
} }
static void static void
_cogl_texture_add_quad_vertices (GLfloat x1, GLfloat y1, _cogl_texture_add_quad_vertices (GLfloat x_1,
GLfloat x2, GLfloat y2, GLfloat y_1,
GLfloat tx1, GLfloat ty1, GLfloat x_2,
GLfloat tx2, GLfloat ty2) GLfloat y_2,
GLfloat tx_1,
GLfloat ty_1,
GLfloat tx_2,
GLfloat ty_2)
{ {
CoglTextureGLVertex *p; CoglTextureGLVertex *p;
GLushort first_vert; GLushort first_vert;
@ -1995,30 +1999,30 @@ _cogl_texture_add_quad_vertices (GLfloat x1, GLfloat y1,
g_array_set_size (ctx->texture_vertices, first_vert + 4); g_array_set_size (ctx->texture_vertices, first_vert + 4);
p = &g_array_index (ctx->texture_vertices, CoglTextureGLVertex, first_vert); p = &g_array_index (ctx->texture_vertices, CoglTextureGLVertex, first_vert);
p->v[0] = x1; p->v[1] = y1; p->v[0] = x_1; p->v[1] = y_1;
p->t[0] = tx1; p->t[1] = ty1; p->t[0] = tx_1; p->t[1] = ty_1;
p++; p++;
p->v[0] = x1; p->v[1] = y2; p->v[0] = x_1; p->v[1] = y_2;
p->t[0] = tx1; p->t[1] = ty2; p->t[0] = tx_1; p->t[1] = ty_2;
p++; p++;
p->v[0] = x2; p->v[1] = y2; p->v[0] = x_2; p->v[1] = y_2;
p->t[0] = tx2; p->t[1] = ty2; p->t[0] = tx_2; p->t[1] = ty_2;
p++; p++;
p->v[0] = x2; p->v[1] = y1; p->v[0] = x_2; p->v[1] = y_1;
p->t[0] = tx2; p->t[1] = ty1; p->t[0] = tx_2; p->t[1] = ty_1;
p++; p++;
} }
static void static void
_cogl_texture_quad_sw (CoglTexture *tex, _cogl_texture_quad_sw (CoglTexture *tex,
float x1, float x_1,
float y1, float y_1,
float x2, float x_2,
float y2, float y_2,
float tx1, float tx_1,
float ty1, float ty_1,
float tx2, float tx_2,
float ty2) float ty_2)
{ {
CoglSpanIter iter_x , iter_y; CoglSpanIter iter_x , iter_y;
float tw , th; float tw , th;
@ -2041,7 +2045,10 @@ _cogl_texture_quad_sw (CoglTexture *tex,
otherwise it might pull in edge pixels from the other side */ otherwise it might pull in edge pixels from the other side */
if (ctx->texture_vertices->len > 0 if (ctx->texture_vertices->len > 0
&& ctx->texture_wrap_mode != GL_CLAMP_TO_EDGE) && ctx->texture_wrap_mode != GL_CLAMP_TO_EDGE)
{
_cogl_texture_flush_vertices (); _cogl_texture_flush_vertices ();
}
_cogl_texture_set_wrap_mode_parameter (tex, GL_CLAMP_TO_EDGE); _cogl_texture_set_wrap_mode_parameter (tex, GL_CLAMP_TO_EDGE);
ctx->texture_wrap_mode = GL_CLAMP_TO_EDGE; ctx->texture_wrap_mode = GL_CLAMP_TO_EDGE;
@ -2049,52 +2056,55 @@ _cogl_texture_quad_sw (CoglTexture *tex,
geometry and texture coordinates so that the texture will be geometry and texture coordinates so that the texture will be
flipped but we can still use the same algorithm to iterate the flipped but we can still use the same algorithm to iterate the
slices */ slices */
if (tx2 < tx1) if (tx_2 < tx_1)
{ {
float temp = x1; float temp = x_1;
x1 = x2;
x2 = temp; x_1 = x_2;
temp = tx1; x_2 = temp;
tx1 = tx2; temp = tx_1;
tx2 = temp; tx_1 = tx_2;
tx_2 = temp;
} }
if (ty2 < ty1)
if (ty_2 < ty_1)
{ {
float temp = y1; float temp = y_1;
y1 = y2;
y2 = temp; y_1 = y_2;
temp = ty1; y_2 = temp;
ty1 = ty2; temp = ty_1;
ty2 = temp; ty_1 = ty_2;
ty_2 = temp;
} }
/* Scale ratio from texture to quad widths */ /* Scale ratio from texture to quad widths */
tw = (float) (tex->bitmap.width); tw = (float) (tex->bitmap.width);
th = (float) (tex->bitmap.height); th = (float) (tex->bitmap.height);
tqx = (x2 - x1) / (tw * (tx2 - tx1)); tqx = (x_2 - x_1) / (tw * (tx_2 - tx_1));
tqy = (y2 - y1) / (th * (ty2 - ty1)); tqy = (y_2 - y_1) / (th * (ty_2 - ty_1));
/* Integral texture coordinate for first tile */ /* Integral texture coordinate for first tile */
first_tx = (float)(floorf (tx1)); first_tx = (float)(floorf (tx_1));
first_ty = (float)(floorf (ty1)); first_ty = (float)(floorf (ty_1));
/* Denormalize texture coordinates */ /* Denormalize texture coordinates */
first_tx = (first_tx * tw); first_tx = (first_tx * tw);
first_ty = (first_ty * th); first_ty = (first_ty * th);
tx1 = (tx1 * tw); tx_1 = (tx_1 * tw);
ty1 = (ty1 * th); ty_1 = (ty_1 * th);
tx2 = (tx2 * tw); tx_2 = (tx_2 * tw);
ty2 = (ty2 * th); ty_2 = (ty_2 * th);
/* Quad coordinate of the first tile */ /* Quad coordinate of the first tile */
first_qx = x1 - (tx1 - first_tx) * tqx; first_qx = x_1 - (tx_1 - first_tx) * tqx;
first_qy = y1 - (ty1 - first_ty) * tqy; first_qy = y_1 - (ty_1 - first_ty) * tqy;
/* Iterate until whole quad height covered */ /* Iterate until whole quad height covered */
for (_cogl_span_iter_begin (&iter_y, tex->slice_y_spans, for (_cogl_span_iter_begin (&iter_y, tex->slice_y_spans,
first_ty, ty1, ty2) ; first_ty, ty_1, ty_2) ;
!_cogl_span_iter_end (&iter_y) ; !_cogl_span_iter_end (&iter_y) ;
_cogl_span_iter_next (&iter_y) ) _cogl_span_iter_next (&iter_y) )
{ {
@ -2120,7 +2130,7 @@ _cogl_texture_quad_sw (CoglTexture *tex,
/* Iterate until whole quad width covered */ /* Iterate until whole quad width covered */
for (_cogl_span_iter_begin (&iter_x, tex->slice_x_spans, for (_cogl_span_iter_begin (&iter_x, tex->slice_x_spans,
first_tx, tx1, tx2) ; first_tx, tx_1, tx_2) ;
!_cogl_span_iter_end (&iter_x) ; !_cogl_span_iter_end (&iter_x) ;
_cogl_span_iter_next (&iter_x) ) _cogl_span_iter_next (&iter_x) )
{ {
@ -2165,7 +2175,10 @@ _cogl_texture_quad_sw (CoglTexture *tex,
then flush the vertices */ then flush the vertices */
if (ctx->texture_vertices->len > 0 if (ctx->texture_vertices->len > 0
&& gl_handle != ctx->texture_current) && gl_handle != ctx->texture_current)
{
_cogl_texture_flush_vertices (); _cogl_texture_flush_vertices ();
}
ctx->texture_target = tex->gl_target; ctx->texture_target = tex->gl_target;
ctx->texture_current = gl_handle; ctx->texture_current = gl_handle;
@ -2183,14 +2196,14 @@ _cogl_texture_quad_sw (CoglTexture *tex,
static void static void
_cogl_texture_quad_hw (CoglTexture *tex, _cogl_texture_quad_hw (CoglTexture *tex,
float x1, float x_1,
float y1, float y_1,
float x2, float x_2,
float y2, float y_2,
float tx1, float tx_1,
float ty1, float ty_1,
float tx2, float tx_2,
float ty2) float ty_2)
{ {
GLuint gl_handle; GLuint gl_handle;
CoglTexSliceSpan *x_span; CoglTexSliceSpan *x_span;
@ -2206,11 +2219,13 @@ _cogl_texture_quad_hw (CoglTexture *tex,
/* If the texture coords are all in the range [0,1] then we want to /* If the texture coords are all in the range [0,1] then we want to
clamp the coords to the edge otherwise it can pull in edge pixels clamp the coords to the edge otherwise it can pull in edge pixels
from the wrong side when scaled */ from the wrong side when scaled */
if (tx1 >= 0 && tx1 <= 1.0 if (tx_1 >= 0 && tx_1 <= 1.0 &&
&& tx2 >= 0 && tx2 <= 1.0 tx_2 >= 0 && tx_2 <= 1.0 &&
&& ty1 >= 0 && ty1 <= 1.0 ty_1 >= 0 && ty_1 <= 1.0 &&
&& ty2 >= 0 && ty2 <= 1.0) ty_2 >= 0 && ty_2 <= 1.0)
{
wrap_mode = GL_CLAMP_TO_EDGE; wrap_mode = GL_CLAMP_TO_EDGE;
}
else else
wrap_mode = GL_REPEAT; wrap_mode = GL_REPEAT;
@ -2219,10 +2234,13 @@ _cogl_texture_quad_hw (CoglTexture *tex,
/* If we're using a different texture from the one already queued /* If we're using a different texture from the one already queued
then flush the vertices */ then flush the vertices */
if (ctx->texture_vertices->len > 0 if (ctx->texture_vertices->len > 0 &&
&& (gl_handle != ctx->texture_current (gl_handle != ctx->texture_current ||
|| ctx->texture_wrap_mode != wrap_mode)) ctx->texture_wrap_mode != wrap_mode))
{
_cogl_texture_flush_vertices (); _cogl_texture_flush_vertices ();
}
ctx->texture_target = tex->gl_target; ctx->texture_target = tex->gl_target;
ctx->texture_current = gl_handle; ctx->texture_current = gl_handle;
ctx->texture_wrap_mode = wrap_mode; ctx->texture_wrap_mode = wrap_mode;
@ -2234,28 +2252,24 @@ _cogl_texture_quad_hw (CoglTexture *tex,
y_span = &g_array_index (tex->slice_y_spans, CoglTexSliceSpan, 0); y_span = &g_array_index (tex->slice_y_spans, CoglTexSliceSpan, 0);
/* Don't include the waste in the texture coordinates */ /* Don't include the waste in the texture coordinates */
tx1 = tx1 * (x_span->size - x_span->waste) / x_span->size; tx_1 = tx_1 * (x_span->size - x_span->waste) / x_span->size;
tx2 = tx2 * (x_span->size - x_span->waste) / x_span->size; tx_2 = tx_2 * (x_span->size - x_span->waste) / x_span->size;
ty1 = ty1 * (y_span->size - y_span->waste) / y_span->size; ty_1 = ty_1 * (y_span->size - y_span->waste) / y_span->size;
ty2 = ty2 * (y_span->size - y_span->waste) / y_span->size; ty_2 = ty_2 * (y_span->size - y_span->waste) / y_span->size;
/* Denormalize texture coordinates for rectangle textures */ /* Denormalize texture coordinates for rectangle textures */
if (tex->gl_target == GL_TEXTURE_RECTANGLE_ARB) if (tex->gl_target == GL_TEXTURE_RECTANGLE_ARB)
{ {
tx1 *= x_span->size; tx_1 *= x_span->size;
tx2 *= x_span->size; tx_2 *= x_span->size;
ty1 *= y_span->size; ty_1 *= y_span->size;
ty2 *= y_span->size; ty_2 *= y_span->size;
} }
_cogl_texture_add_quad_vertices ( (x1), _cogl_texture_add_quad_vertices (x_1, y_1,
(y1), x_2, y_2,
(x2), tx_1, ty_1,
(y2), tx_2, ty_2);
(tx1),
(ty1),
(tx2),
(ty2));
} }
void void
@ -2264,8 +2278,8 @@ cogl_texture_multiple_rectangles (CoglHandle handle,
guint n_rects) guint n_rects)
{ {
CoglTexture *tex; CoglTexture *tex;
gulong enable_flags = (COGL_ENABLE_VERTEX_ARRAY gulong enable_flags = (COGL_ENABLE_VERTEX_ARRAY |
| COGL_ENABLE_TEXCOORD_ARRAY); COGL_ENABLE_TEXCOORD_ARRAY);
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
@ -2290,8 +2304,7 @@ cogl_texture_multiple_rectangles (CoglHandle handle,
else else
enable_flags |= COGL_ENABLE_TEXTURE_2D; enable_flags |= COGL_ENABLE_TEXTURE_2D;
if (ctx->color_alpha < 255 if (ctx->color_alpha < 255 || tex->bitmap.format & COGL_A_BIT)
|| tex->bitmap.format & COGL_A_BIT)
enable_flags |= COGL_ENABLE_BLEND; enable_flags |= COGL_ENABLE_BLEND;
if (ctx->enable_backface_culling) if (ctx->enable_backface_culling)
@ -2330,25 +2343,25 @@ cogl_texture_multiple_rectangles (CoglHandle handle,
void void
cogl_texture_rectangle (CoglHandle handle, cogl_texture_rectangle (CoglHandle handle,
float x1, float x_1,
float y1, float y_1,
float x2, float x_2,
float y2, float y_2,
float tx1, float tx_1,
float ty1, float ty_1,
float tx2, float tx_2,
float ty2) float ty_2)
{ {
float verts[8]; float verts[8];
verts[0] = x1; verts[0] = x_1;
verts[1] = y1; verts[1] = y_1;
verts[2] = x2; verts[2] = x_2;
verts[3] = y2; verts[3] = y_2;
verts[4] = tx1; verts[4] = tx_1;
verts[5] = ty1; verts[5] = ty_1;
verts[6] = tx2; verts[6] = tx_2;
verts[7] = ty2; verts[7] = ty_2;
cogl_texture_multiple_rectangles (handle, verts, 1); cogl_texture_multiple_rectangles (handle, verts, 1);
} }