cogl: improves header and coding style consistency
We've had complaints that our Cogl code/headers are a bit "special" so this is a first pass at tidying things up by giving them some consistency. These changes are all consistent with how new code in Cogl is being written, but the style isn't consistently applied across all code yet. There are two parts to this patch; but since each one required a large amount of effort to maintain tidy indenting it made sense to combine the changes to reduce the time spent re indenting the same lines. The first change is to use a consistent style for declaring function prototypes in headers. Cogl headers now consistently use this style for prototypes: return_type cogl_function_name (CoglType arg0, CoglType arg1); Not everyone likes this style, but it seems that most of the currently active Cogl developers agree on it. The second change is to constrain the use of redundant glib data types in Cogl. Uses of gint, guint, gfloat, glong, gulong and gchar have all been replaced with int, unsigned int, float, long, unsigned long and char respectively. When talking about pixel data; use of guchar has been replaced with guint8, otherwise unsigned char can be used. The glib types that we continue to use for portability are gboolean, gint{8,16,32,64}, guint{8,16,32,64} and gsize. The general intention is that Cogl should look palatable to the widest range of C programmers including those outside the Gnome community so - especially for the public API - we want to minimize the number of foreign looking typedefs.
This commit is contained in:
@ -210,7 +210,7 @@ COGL_HANDLE_DEFINE (VertexBuffer, vertex_buffer);
|
||||
COGL_HANDLE_DEFINE (VertexBufferIndices, vertex_buffer_indices);
|
||||
|
||||
CoglHandle
|
||||
cogl_vertex_buffer_new (guint n_vertices)
|
||||
cogl_vertex_buffer_new (unsigned int n_vertices)
|
||||
{
|
||||
CoglVertexBuffer *buffer = g_slice_alloc (sizeof (CoglVertexBuffer));
|
||||
|
||||
@ -223,7 +223,7 @@ cogl_vertex_buffer_new (guint n_vertices)
|
||||
return _cogl_vertex_buffer_handle_new (buffer);
|
||||
}
|
||||
|
||||
guint
|
||||
unsigned int
|
||||
cogl_vertex_buffer_get_n_vertices (CoglHandle handle)
|
||||
{
|
||||
CoglVertexBuffer *buffer;
|
||||
@ -958,7 +958,7 @@ upload_multipack_vbo_via_map_buffer (CoglVertexBufferVBO *cogl_vbo)
|
||||
{
|
||||
#if HAVE_COGL_GL
|
||||
GList *tmp;
|
||||
guint offset = 0;
|
||||
unsigned int offset = 0;
|
||||
char *buf;
|
||||
gboolean fallback =
|
||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||
@ -1004,7 +1004,7 @@ static void
|
||||
upload_multipack_vbo_via_buffer_sub_data (CoglVertexBufferVBO *cogl_vbo)
|
||||
{
|
||||
GList *tmp;
|
||||
guint offset = 0;
|
||||
unsigned int offset = 0;
|
||||
gboolean fallback =
|
||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||
|
||||
@ -1511,8 +1511,8 @@ enable_state_for_drawing_buffer (CoglVertexBuffer *buffer)
|
||||
#ifdef MAY_HAVE_PROGRAMABLE_GL
|
||||
GLuint generic_index = 0;
|
||||
#endif
|
||||
gulong enable_flags = 0;
|
||||
gint max_texcoord_attrib_unit = -1;
|
||||
unsigned long enable_flags = 0;
|
||||
int max_texcoord_attrib_unit = -1;
|
||||
const GList *layers;
|
||||
guint32 fallback_layers = 0;
|
||||
guint32 disable_layers = ~0;
|
||||
@ -1797,7 +1797,7 @@ cogl_vertex_buffer_indices_new (CoglIndicesType indices_type,
|
||||
{
|
||||
gboolean fallback =
|
||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||
size_t indices_bytes;
|
||||
gsize indices_bytes;
|
||||
CoglVertexBufferIndices *indices;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, 0);
|
||||
@ -1885,7 +1885,7 @@ cogl_vertex_buffer_draw_elements (CoglHandle handle,
|
||||
CoglVertexBuffer *buffer;
|
||||
gboolean fallback =
|
||||
(cogl_get_features () & COGL_FEATURE_VBOS) ? FALSE : TRUE;
|
||||
size_t byte_offset;
|
||||
gsize byte_offset;
|
||||
CoglVertexBufferIndices *indices = NULL;
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
@ -1936,7 +1936,7 @@ _cogl_vertex_buffer_free (CoglVertexBuffer *buffer)
|
||||
}
|
||||
|
||||
CoglHandle
|
||||
cogl_vertex_buffer_indices_get_for_quads (guint n_indices)
|
||||
cogl_vertex_buffer_indices_get_for_quads (unsigned int n_indices)
|
||||
{
|
||||
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
|
||||
|
||||
|
Reference in New Issue
Block a user