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:
Robert Bragg
2010-02-10 01:57:32 +00:00
parent 10fa7c7ce9
commit 0f5f4e8645
64 changed files with 1491 additions and 1184 deletions

View File

@ -50,7 +50,7 @@ G_BEGIN_DECLS
* Stability: Unstable
*/
CoglHandle
cogl_pixel_buffer_new (guint size);
cogl_pixel_buffer_new (unsigned int size);
/**
* cogl_pixel_buffer_new_for_size:
@ -75,10 +75,10 @@ cogl_pixel_buffer_new (guint size);
* Stability: Unstable
*/
CoglHandle
cogl_pixel_buffer_new_for_size (guint width,
guint height,
cogl_pixel_buffer_new_for_size (unsigned int width,
unsigned int height,
CoglPixelFormat format,
guint *stride);
unsigned int *stride);
/**
* cogl_is_pixel_buffer:
@ -117,13 +117,13 @@ cogl_is_pixel_buffer (CoglHandle handle);
*/
#if 0
gboolean
cogl_pixel_buffer_set_region (CoglHandle buffer,
guchar *data,
guint src_width,
guint src_height,
guint src_rowstride,
guint dst_x,
guint dst_y);
cogl_pixel_buffer_set_region (CoglHandle buffer,
guint8 *data,
unsigned int src_width,
unsigned int src_height,
unsigned int src_rowstride,
unsigned int dst_x,
unsigned int dst_y);
#endif
/* the functions above are experimental, the actual symbols are suffixed by
@ -132,25 +132,25 @@ cogl_pixel_buffer_set_region (CoglHandle buffer,
* above into the real symbols */
CoglHandle
cogl_pixel_buffer_new_EXP (guint size);
cogl_pixel_buffer_new_EXP (unsigned int size);
CoglHandle
cogl_pixel_buffer_new_for_size_EXP (guint width,
guint height,
CoglPixelFormat format,
guint *stride);
cogl_pixel_buffer_new_for_size_EXP (unsigned int width,
unsigned int height,
CoglPixelFormat format,
unsigned int *stride);
gboolean
cogl_is_pixel_buffer_EXP (CoglHandle handle);
#if 0
gboolean
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
guchar *data,
guint src_width,
guint src_height,
guint src_rowstride,
guint dst_x,
guint dst_y);
cogl_pixel_buffer_set_region_EXP (CoglHandle buffer,
guint8 *data,
unsigned int src_width,
unsigned int src_height,
unsigned int src_rowstride,
unsigned int dst_x,
unsigned int dst_y);
#endif
#define cogl_pixel_buffer_new cogl_pixel_buffer_new_EXP