diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-01-04 11:43:00 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-01-04 11:43:00 +0000 |
commit | de5c84c4536f4d46ad555ec73895c90a2b773b14 (patch) | |
tree | 3ff5bd649f0b0f9a39ee0544d488b0386ee51a03 /cogl | |
parent | c6e20029643f4fb6581c3fe89efb2b676bef982f (diff) | |
download | cogl-de5c84c4536f4d46ad555ec73895c90a2b773b14.tar.gz |
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
Diffstat (limited to 'cogl')
-rw-r--r-- | cogl/cogl-primitives.c | 27 | ||||
-rw-r--r-- | cogl/cogl-texture.h | 6 |
2 files changed, 17 insertions, 16 deletions
diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c index 63bd382c..e4fdf6a9 100644 --- a/cogl/cogl-primitives.c +++ b/cogl/cogl-primitives.c @@ -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, - guint n_vertices, - gboolean use_color) +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,10 +870,10 @@ 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 tex_handle = cogl_material_layer_get_texture (layer); + CoglHandle layer = tmp->data; + CoglHandle tex_handle = cogl_material_layer_get_texture (layer); /* COGL_INVALID_HANDLE textures will be handled in * _cogl_material_flush_layers_gl_state */ @@ -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)); diff --git a/cogl/cogl-texture.h b/cogl/cogl-texture.h index b831d1ae..7859abd1 100644 --- a/cogl/cogl-texture.h +++ b/cogl/cogl-texture.h @@ -466,9 +466,9 @@ void cogl_rectangles (const float *verts, * * Since: 1.0 */ -void cogl_polygon (CoglTextureVertex *vertices, - guint n_vertices, - gboolean use_color); +void cogl_polygon (const CoglTextureVertex *vertices, + guint n_vertices, + gboolean use_color); G_END_DECLS |