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:
parent
c6e2002964
commit
de5c84c453
@ -61,7 +61,7 @@ typedef struct _TextureSlicedQuadState
|
|||||||
|
|
||||||
typedef struct _TextureSlicedPolygonState
|
typedef struct _TextureSlicedPolygonState
|
||||||
{
|
{
|
||||||
CoglTextureVertex *vertices;
|
const CoglTextureVertex *vertices;
|
||||||
int n_vertices;
|
int n_vertices;
|
||||||
int stride;
|
int stride;
|
||||||
} TextureSlicedPolygonState;
|
} TextureSlicedPolygonState;
|
||||||
@ -709,7 +709,7 @@ draw_polygon_sub_texture_cb (CoglHandle tex_handle,
|
|||||||
|
|
||||||
/* handles 2d-sliced textures with > 1 slice */
|
/* handles 2d-sliced textures with > 1 slice */
|
||||||
static void
|
static void
|
||||||
_cogl_texture_polygon_multiple_primitives (CoglTextureVertex *vertices,
|
_cogl_texture_polygon_multiple_primitives (const CoglTextureVertex *vertices,
|
||||||
unsigned int n_vertices,
|
unsigned int n_vertices,
|
||||||
unsigned int stride,
|
unsigned int stride,
|
||||||
gboolean use_color)
|
gboolean use_color)
|
||||||
@ -762,7 +762,7 @@ _cogl_texture_polygon_multiple_primitives (CoglTextureVertex *vertices,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_multitexture_polygon_single_primitive (CoglTextureVertex *vertices,
|
_cogl_multitexture_polygon_single_primitive (const CoglTextureVertex *vertices,
|
||||||
guint n_vertices,
|
guint n_vertices,
|
||||||
guint n_layers,
|
guint n_layers,
|
||||||
guint stride,
|
guint stride,
|
||||||
@ -841,14 +841,13 @@ _cogl_multitexture_polygon_single_primitive (CoglTextureVertex *vertices,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_polygon (CoglTextureVertex *vertices,
|
cogl_polygon (const CoglTextureVertex *vertices,
|
||||||
guint n_vertices,
|
guint n_vertices,
|
||||||
gboolean use_color)
|
gboolean use_color)
|
||||||
{
|
{
|
||||||
CoglHandle material;
|
CoglHandle material;
|
||||||
const GList *layers;
|
const GList *layers, *tmp;
|
||||||
int n_layers;
|
int n_layers;
|
||||||
GList *tmp;
|
|
||||||
gboolean use_sliced_polygon_fallback = FALSE;
|
gboolean use_sliced_polygon_fallback = FALSE;
|
||||||
guint32 fallback_layers = 0;
|
guint32 fallback_layers = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -871,10 +870,10 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
layers = cogl_material_get_layers (ctx->source_material);
|
layers = cogl_material_get_layers (ctx->source_material);
|
||||||
n_layers = g_list_length ((GList *)layers);
|
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);
|
CoglHandle tex_handle = cogl_material_layer_get_texture (layer);
|
||||||
|
|
||||||
/* COGL_INVALID_HANDLE textures will be handled in
|
/* COGL_INVALID_HANDLE textures will be handled in
|
||||||
* _cogl_material_flush_layers_gl_state */
|
* _cogl_material_flush_layers_gl_state */
|
||||||
@ -904,6 +903,7 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
warning_seen = TRUE;
|
warning_seen = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
use_sliced_polygon_fallback = TRUE;
|
use_sliced_polygon_fallback = TRUE;
|
||||||
n_layers = 1;
|
n_layers = 1;
|
||||||
|
|
||||||
@ -990,9 +990,10 @@ cogl_polygon (CoglTextureVertex *vertices,
|
|||||||
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
/* NB: [X,Y,Z,TX,TY...,R,G,B,A,...] */
|
||||||
v + 3 + 2 * i));
|
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;
|
ctx->n_texcoord_arrays_enabled = n_layers;
|
||||||
|
|
||||||
for (; i < prev_n_texcoord_arrays_enabled; i++)
|
for (; i < prev_n_texcoord_arrays_enabled; i++)
|
||||||
{
|
{
|
||||||
GE (glClientActiveTexture (GL_TEXTURE0 + i));
|
GE (glClientActiveTexture (GL_TEXTURE0 + i));
|
||||||
|
@ -466,9 +466,9 @@ void cogl_rectangles (const float *verts,
|
|||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
void cogl_polygon (CoglTextureVertex *vertices,
|
void cogl_polygon (const CoglTextureVertex *vertices,
|
||||||
guint n_vertices,
|
guint n_vertices,
|
||||||
gboolean use_color);
|
gboolean use_color);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user