cogl: Const-ify vertices in cogl_polygon()

The CoglTextureVertex array passed to cogl_polygon() is a pure
in-argument and should be const-ified.

http://bugzilla.openedhand.com/show_bug.cgi?id=1917
This commit is contained in:
Emmanuele Bassi 2010-01-04 11:43:00 +00:00
parent c6e2002964
commit de5c84c453
2 changed files with 17 additions and 16 deletions

View File

@ -61,7 +61,7 @@ typedef struct _TextureSlicedQuadState
typedef struct _TextureSlicedPolygonState
{
CoglTextureVertex *vertices;
const CoglTextureVertex *vertices;
int n_vertices;
int stride;
} TextureSlicedPolygonState;
@ -709,7 +709,7 @@ draw_polygon_sub_texture_cb (CoglHandle tex_handle,
/* handles 2d-sliced textures with > 1 slice */
static void
_cogl_texture_polygon_multiple_primitives (CoglTextureVertex *vertices,
_cogl_texture_polygon_multiple_primitives (const CoglTextureVertex *vertices,
unsigned int n_vertices,
unsigned int stride,
gboolean use_color)
@ -762,7 +762,7 @@ _cogl_texture_polygon_multiple_primitives (CoglTextureVertex *vertices,
}
static void
_cogl_multitexture_polygon_single_primitive (CoglTextureVertex *vertices,
_cogl_multitexture_polygon_single_primitive (const CoglTextureVertex *vertices,
guint n_vertices,
guint n_layers,
guint stride,
@ -841,14 +841,13 @@ _cogl_multitexture_polygon_single_primitive (CoglTextureVertex *vertices,
}
void
cogl_polygon (CoglTextureVertex *vertices,
cogl_polygon (const CoglTextureVertex *vertices,
guint n_vertices,
gboolean use_color)
{
CoglHandle material;
const GList *layers;
const GList *layers, *tmp;
int n_layers;
GList *tmp;
gboolean use_sliced_polygon_fallback = FALSE;
guint32 fallback_layers = 0;
int i;
@ -871,9 +870,9 @@ cogl_polygon (CoglTextureVertex *vertices,
layers = cogl_material_get_layers (ctx->source_material);
n_layers = g_list_length ((GList *)layers);
for (tmp = (GList *)layers, i = 0; tmp != NULL; tmp = tmp->next, i++)
for (tmp = layers, i = 0; tmp != NULL; tmp = tmp->next, i++)
{
CoglHandle layer = (CoglHandle)tmp->data;
CoglHandle layer = tmp->data;
CoglHandle tex_handle = cogl_material_layer_get_texture (layer);
/* COGL_INVALID_HANDLE textures will be handled in
@ -904,6 +903,7 @@ cogl_polygon (CoglTextureVertex *vertices,
warning_seen = TRUE;
}
}
use_sliced_polygon_fallback = TRUE;
n_layers = 1;
@ -990,9 +990,10 @@ cogl_polygon (CoglTextureVertex *vertices,
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
v + 3 + 2 * i));
}
prev_n_texcoord_arrays_enabled =
ctx->n_texcoord_arrays_enabled;
prev_n_texcoord_arrays_enabled = ctx->n_texcoord_arrays_enabled;
ctx->n_texcoord_arrays_enabled = n_layers;
for (; i < prev_n_texcoord_arrays_enabled; i++)
{
GE (glClientActiveTexture (GL_TEXTURE0 + i));

View File

@ -466,7 +466,7 @@ void cogl_rectangles (const float *verts,
*
* Since: 1.0
*/
void cogl_polygon (CoglTextureVertex *vertices,
void cogl_polygon (const CoglTextureVertex *vertices,
guint n_vertices,
gboolean use_color);