summaryrefslogtreecommitdiff
path: root/cogl/cogl-pixel-buffer.c
diff options
context:
space:
mode:
authorRobert Bragg <robert@linux.intel.com>2010-02-10 01:57:32 +0000
committerRobert Bragg <robert@linux.intel.com>2010-02-12 14:05:00 +0000
commit0f5f4e8645d12eb6c5ff99c13503f2380740bb10 (patch)
tree608ac1afdc5924f097bd6e140c6fc887070eb533 /cogl/cogl-pixel-buffer.c
parent10fa7c7ce9a69b733e4652a51e101a98911d5bb8 (diff)
downloadcogl-0f5f4e8645d12eb6c5ff99c13503f2380740bb10.tar.gz
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.
Diffstat (limited to 'cogl/cogl-pixel-buffer.c')
-rw-r--r--cogl/cogl-pixel-buffer.c53
1 files changed, 28 insertions, 25 deletions
diff --git a/cogl/cogl-pixel-buffer.c b/cogl/cogl-pixel-buffer.c
index 4ee73981..9c4f029d 100644
--- a/cogl/cogl-pixel-buffer.c
+++ b/cogl/cogl-pixel-buffer.c
@@ -76,12 +76,15 @@
#endif
-static void _cogl_pixel_buffer_free (CoglPixelBuffer *buffer);
+static void
+_cogl_pixel_buffer_free (CoglPixelBuffer *buffer);
#if !defined (COGL_HAS_GLES)
-static const CoglBufferVtable cogl_pixel_buffer_vtable;
+static const CoglBufferVtable
+cogl_pixel_buffer_vtable;
#endif
-static const CoglBufferVtable cogl_malloc_pixel_buffer_vtable;
+static const CoglBufferVtable
+cogl_malloc_pixel_buffer_vtable;
/* we don't want to use the stock COGL_HANDLE_DEFINE * for 2 reasons:
* - it defines already deprecated symbols
@@ -138,7 +141,7 @@ cogl_is_##type_name##_EXP (CoglHandle handle) \
COGL_HANDLE_DEFINE_EXP(PixelBuffer, pixel_buffer)
CoglHandle
-cogl_pixel_buffer_new_EXP (guint size)
+cogl_pixel_buffer_new_EXP (unsigned int size)
{
CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer);
CoglBuffer *buffer = COGL_BUFFER (pixel_buffer);
@@ -179,14 +182,14 @@ cogl_pixel_buffer_new_EXP (guint size)
}
CoglHandle
-cogl_pixel_buffer_new_for_size_EXP (guint width,
- guint height,
- CoglPixelFormat format,
- guint *rowstride)
+cogl_pixel_buffer_new_for_size_EXP (unsigned int width,
+ unsigned int height,
+ CoglPixelFormat format,
+ unsigned int *rowstride)
{
CoglHandle buffer;
CoglPixelBuffer *pixel_buffer;
- guint stride;
+ unsigned int stride;
/* creating a buffer to store "any" format does not make sense */
if (G_UNLIKELY (format == COGL_PIXEL_FORMAT_ANY))
@@ -225,13 +228,13 @@ _cogl_pixel_buffer_free (CoglPixelBuffer *buffer)
}
#if !defined (COGL_HAS_GLES)
-static guchar *
+static guint8 *
_cogl_pixel_buffer_map (CoglBuffer *buffer,
CoglBufferAccess access)
{
CoglPixelBuffer *pixel_buffer = COGL_PIXEL_BUFFER (buffer);
GLenum gl_target;
- guchar *data;
+ guint8 *data;
_COGL_GET_CONTEXT (ctx, NULL);
@@ -281,9 +284,9 @@ _cogl_pixel_buffer_unmap (CoglBuffer *buffer)
static gboolean
_cogl_pixel_buffer_set_data (CoglBuffer *buffer,
- guint offset,
- const guchar *data,
- guint size)
+ unsigned int offset,
+ const guint8 *data,
+ unsigned int size)
{
CoglPixelBuffer *pixel_buffer = COGL_PIXEL_BUFFER (buffer);
@@ -315,13 +318,13 @@ _cogl_pixel_buffer_set_data (CoglBuffer *buffer,
#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)
{
if (!cogl_is_pixel_buffer (buffer))
return FALSE;
@@ -342,7 +345,7 @@ static const CoglBufferVtable cogl_pixel_buffer_vtable =
* Fallback path, buffer->data points to a malloc'ed buffer.
*/
-static guchar *
+static guint8 *
_cogl_malloc_pixel_buffer_map (CoglBuffer *buffer,
CoglBufferAccess access)
{
@@ -358,9 +361,9 @@ _cogl_malloc_pixel_buffer_unmap (CoglBuffer *buffer)
static gboolean
_cogl_malloc_pixel_buffer_set_data (CoglBuffer *buffer,
- guint offset,
- const guchar *data,
- guint size)
+ unsigned int offset,
+ const guint8 *data,
+ unsigned int size)
{
memcpy (buffer->data + offset, data, size);
return TRUE;