cogl: Drop _COGL_RETURN_VAL_IF_FAIL macro

This was introduced when the Cogl maintainers tried to move away from
GLib. Since we always require it, we can just use
`g_return_val_if_fail()` immediately.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/629
This commit is contained in:
Niels De Graef 2019-06-17 23:42:01 +02:00
parent 576330edce
commit 769a02b630
47 changed files with 207 additions and 211 deletions

View File

@ -94,7 +94,7 @@ cogl_pango_font_map_new (void)
PangoContext * PangoContext *
cogl_pango_font_map_create_context (CoglPangoFontMap *fm) cogl_pango_font_map_create_context (CoglPangoFontMap *fm)
{ {
_COGL_RETURN_VAL_IF_FAIL (COGL_PANGO_IS_FONT_MAP (fm), NULL); g_return_val_if_fail (COGL_PANGO_IS_FONT_MAP (fm), NULL);
#if PANGO_VERSION_CHECK (1, 22, 0) #if PANGO_VERSION_CHECK (1, 22, 0)
/* We can just directly use the pango context from the Cairo font /* We can just directly use the pango context from the Cairo font

View File

@ -162,7 +162,7 @@ cogl2_path_set_fill_rule (CoglPath *path,
CoglPathFillRule CoglPathFillRule
cogl2_path_get_fill_rule (CoglPath *path) cogl2_path_get_fill_rule (CoglPath *path)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO); g_return_val_if_fail (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO);
return path->data->fill_rule; return path->data->fill_rule;
} }
@ -932,7 +932,7 @@ cogl_path_copy (CoglPath *old_path)
{ {
CoglPath *new_path; CoglPath *new_path;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_path (old_path), NULL); g_return_val_if_fail (cogl_is_path (old_path), NULL);
new_path = g_slice_new (CoglPath); new_path = g_slice_new (CoglPath);
new_path->data = old_path->data; new_path->data = old_path->data;

View File

@ -694,7 +694,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
/* We can't atlas zero-sized textures because it breaks the atlas /* We can't atlas zero-sized textures because it breaks the atlas
* data structure */ * data structure */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_SIZED;
@ -831,7 +831,7 @@ allocate_from_bitmap (CoglAtlasTexture *atlas_tex,
CoglPixelFormat internal_format; CoglPixelFormat internal_format;
CoglBitmap *upload_bmp; CoglBitmap *upload_bmp;
_COGL_RETURN_VAL_IF_FAIL (atlas_tex->atlas == NULL, FALSE); g_return_val_if_fail (atlas_tex->atlas == NULL, FALSE);
internal_format = _cogl_texture_determine_internal_format (tex, bmp_format); internal_format = _cogl_texture_determine_internal_format (tex, bmp_format);
@ -885,7 +885,7 @@ _cogl_atlas_texture_allocate (CoglTexture *tex,
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex); CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
CoglTextureLoader *loader = tex->loader; CoglTextureLoader *loader = tex->loader;
_COGL_RETURN_VAL_IF_FAIL (loader, FALSE); g_return_val_if_fail (loader, FALSE);
switch (loader->src_type) switch (loader->src_type)
{ {
@ -906,7 +906,7 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
{ {
CoglTextureLoader *loader; CoglTextureLoader *loader;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); g_return_val_if_fail (cogl_is_bitmap (bmp), NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP;
@ -938,8 +938,8 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex; CoglAtlasTexture *atlas_tex;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
@ -974,7 +974,7 @@ cogl_atlas_texture_new_from_file (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex = NULL; CoglAtlasTexture *atlas_tex = NULL;
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = cogl_bitmap_new_from_file (filename, error); bmp = cogl_bitmap_new_from_file (filename, error);
if (bmp == NULL) if (bmp == NULL)

View File

@ -309,7 +309,7 @@ _cogl_attribute_new_const (CoglContext *context,
/* FIXME: Up until GL[ES] 3 only square matrices were supported /* FIXME: Up until GL[ES] 3 only square matrices were supported
* and we don't currently expose non-square matrices in Cogl. * and we don't currently expose non-square matrices in Cogl.
*/ */
_COGL_RETURN_VAL_IF_FAIL (n_columns == n_components, NULL); g_return_val_if_fail (n_columns == n_components, NULL);
_cogl_boxed_value_set_matrix (&attribute->d.constant.boxed, _cogl_boxed_value_set_matrix (&attribute->d.constant.boxed,
n_columns, n_columns,
1, 1,
@ -469,7 +469,7 @@ cogl_attribute_new_const_4x4fv (CoglContext *context,
gboolean gboolean
cogl_attribute_get_normalized (CoglAttribute *attribute) cogl_attribute_get_normalized (CoglAttribute *attribute)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), FALSE); g_return_val_if_fail (cogl_is_attribute (attribute), FALSE);
return attribute->normalized; return attribute->normalized;
} }
@ -501,8 +501,8 @@ cogl_attribute_set_normalized (CoglAttribute *attribute,
CoglAttributeBuffer * CoglAttributeBuffer *
cogl_attribute_get_buffer (CoglAttribute *attribute) cogl_attribute_get_buffer (CoglAttribute *attribute)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
_COGL_RETURN_VAL_IF_FAIL (attribute->is_buffered, NULL); g_return_val_if_fail (attribute->is_buffered, NULL);
return attribute->d.buffered.attribute_buffer; return attribute->d.buffered.attribute_buffer;
} }
@ -528,7 +528,7 @@ _cogl_attribute_immutable_ref (CoglAttribute *attribute)
{ {
CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer); CoglBuffer *buffer = COGL_BUFFER (attribute->d.buffered.attribute_buffer);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
attribute->immutable_ref++; attribute->immutable_ref++;
_cogl_buffer_immutable_ref (buffer); _cogl_buffer_immutable_ref (buffer);

View File

@ -384,8 +384,8 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
width = cogl_bitmap_get_width (src_bmp); width = cogl_bitmap_get_width (src_bmp);
height = cogl_bitmap_get_height (src_bmp); height = cogl_bitmap_get_height (src_bmp);
_COGL_RETURN_VAL_IF_FAIL (width == cogl_bitmap_get_width (dst_bmp), FALSE); g_return_val_if_fail (width == cogl_bitmap_get_width (dst_bmp), FALSE);
_COGL_RETURN_VAL_IF_FAIL (height == cogl_bitmap_get_height (dst_bmp), FALSE); g_return_val_if_fail (height == cogl_bitmap_get_height (dst_bmp), FALSE);
need_premult need_premult
= ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) && = ((src_format & COGL_PREMULT_BIT) != (dst_format & COGL_PREMULT_BIT) &&
@ -553,7 +553,7 @@ _cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp); CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
CoglBitmap *dst_bmp; CoglBitmap *dst_bmp;
_COGL_RETURN_VAL_IF_FAIL (internal_format != COGL_PIXEL_FORMAT_ANY, NULL); g_return_val_if_fail (internal_format != COGL_PIXEL_FORMAT_ANY, NULL);
/* OpenGL supports specifying a different format for the internal /* OpenGL supports specifying a different format for the internal
format when uploading texture data. We should use this to convert format when uploading texture data. We should use this to convert

View File

@ -45,7 +45,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
int *width, int *width,
int *height) int *height)
{ {
_COGL_RETURN_VAL_IF_FAIL (filename != NULL, FALSE); g_return_val_if_fail (filename != NULL, FALSE);
if (gdk_pixbuf_get_file_info (filename, width, height) != NULL) if (gdk_pixbuf_get_file_info (filename, width, height) != NULL)
return TRUE; return TRUE;

View File

@ -133,9 +133,9 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
gboolean succeeded = FALSE; gboolean succeeded = FALSE;
/* Intended only for fast copies when format is equal! */ /* Intended only for fast copies when format is equal! */
_COGL_RETURN_VAL_IF_FAIL ((src->format & ~COGL_PREMULT_BIT) == g_return_val_if_fail ((src->format & ~COGL_PREMULT_BIT) ==
(dst->format & ~COGL_PREMULT_BIT), (dst->format & ~COGL_PREMULT_BIT),
FALSE); FALSE);
bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format); bpp = _cogl_pixel_format_get_bytes_per_pixel (src->format);
@ -265,8 +265,8 @@ cogl_bitmap_new_from_file (const char *filename,
{ {
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (filename != NULL, NULL); g_return_val_if_fail (filename != NULL, NULL);
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return _cogl_bitmap_from_file (ctx, filename, error); return _cogl_bitmap_from_file (ctx, filename, error);
} }
@ -281,7 +281,7 @@ cogl_bitmap_new_from_buffer (CoglBuffer *buffer,
{ {
CoglBitmap *bmp; CoglBitmap *bmp;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
bmp = cogl_bitmap_new_for_data (buffer->context, bmp = cogl_bitmap_new_for_data (buffer->context,
width, height, width, height,
@ -306,7 +306,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
unsigned int rowstride; unsigned int rowstride;
/* creating a buffer to store "any" format does not make sense */ /* creating a buffer to store "any" format does not make sense */
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
/* for now we fallback to cogl_pixel_buffer_new, later, we could ask /* for now we fallback to cogl_pixel_buffer_new, later, we could ask
* libdrm a tiled buffer for instance */ * libdrm a tiled buffer for instance */
@ -317,7 +317,7 @@ cogl_bitmap_new_with_size (CoglContext *context,
height * rowstride, height * rowstride,
NULL); /* data */ NULL); /* data */
_COGL_RETURN_VAL_IF_FAIL (pixel_buffer != NULL, NULL); g_return_val_if_fail (pixel_buffer != NULL, NULL);
bitmap = cogl_bitmap_new_from_buffer (COGL_BUFFER (pixel_buffer), bitmap = cogl_bitmap_new_from_buffer (COGL_BUFFER (pixel_buffer),
format, format,
@ -450,7 +450,7 @@ _cogl_bitmap_gl_bind (CoglBitmap *bitmap,
if (bitmap->shared_bmp) if (bitmap->shared_bmp)
return _cogl_bitmap_gl_bind (bitmap->shared_bmp, access, hints, error); return _cogl_bitmap_gl_bind (bitmap->shared_bmp, access, hints, error);
_COGL_RETURN_VAL_IF_FAIL (!bitmap->bound, NULL); g_return_val_if_fail (!bitmap->bound, NULL);
/* If the bitmap wasn't created from a buffer then the /* If the bitmap wasn't created from a buffer then the
implementation of bind is the same as map */ implementation of bind is the same as map */

View File

@ -225,7 +225,7 @@ _cogl_buffer_map (CoglBuffer *buffer,
CoglBufferMapHint hints, CoglBufferMapHint hints,
CoglError **error) CoglError **error)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
return cogl_buffer_map_range (buffer, 0, buffer->size, access, hints, error); return cogl_buffer_map_range (buffer, 0, buffer->size, access, hints, error);
} }
@ -252,8 +252,8 @@ cogl_buffer_map_range (CoglBuffer *buffer,
CoglBufferMapHint hints, CoglBufferMapHint hints,
CoglError **error) CoglError **error)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
_COGL_RETURN_VAL_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL); g_return_val_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL);
if (G_UNLIKELY (buffer->immutable_ref)) if (G_UNLIKELY (buffer->immutable_ref))
warn_about_midscene_changes (); warn_about_midscene_changes ();
@ -295,7 +295,7 @@ _cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer,
void *ret; void *ret;
CoglError *ignore_error = NULL; CoglError *ignore_error = NULL;
_COGL_RETURN_VAL_IF_FAIL (!ctx->buffer_map_fallback_in_use, NULL); g_return_val_if_fail (!ctx->buffer_map_fallback_in_use, NULL);
ctx->buffer_map_fallback_in_use = TRUE; ctx->buffer_map_fallback_in_use = TRUE;
@ -366,8 +366,8 @@ _cogl_buffer_set_data (CoglBuffer *buffer,
size_t size, size_t size,
CoglError **error) CoglError **error)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), FALSE); g_return_val_if_fail (cogl_is_buffer (buffer), FALSE);
_COGL_RETURN_VAL_IF_FAIL ((offset + size) <= buffer->size, FALSE); g_return_val_if_fail ((offset + size) <= buffer->size, FALSE);
if (G_UNLIKELY (buffer->immutable_ref)) if (G_UNLIKELY (buffer->immutable_ref))
warn_about_midscene_changes (); warn_about_midscene_changes ();
@ -392,7 +392,7 @@ cogl_buffer_set_data (CoglBuffer *buffer,
CoglBuffer * CoglBuffer *
_cogl_buffer_immutable_ref (CoglBuffer *buffer) _cogl_buffer_immutable_ref (CoglBuffer *buffer)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL); g_return_val_if_fail (cogl_is_buffer (buffer), NULL);
buffer->immutable_ref++; buffer->immutable_ref++;
return buffer; return buffer;

View File

@ -350,7 +350,7 @@ _cogl_clip_stack_pop (CoglClipStack *stack)
{ {
CoglClipStack *new_top; CoglClipStack *new_top;
_COGL_RETURN_VAL_IF_FAIL (stack != NULL, NULL); g_return_val_if_fail (stack != NULL, NULL);
/* To pop we are moving the top of the stack to the old top's parent /* To pop we are moving the top of the stack to the old top's parent
node. The stack always needs to have a reference to the top entry node. The stack always needs to have a reference to the top entry

View File

@ -305,8 +305,8 @@ cogl_color_equal (const void *v1, const void *v2)
{ {
const uint32_t *c1 = v1, *c2 = v2; const uint32_t *c1 = v1, *c2 = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); g_return_val_if_fail (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); g_return_val_if_fail (v2 != NULL, FALSE);
/* XXX: We don't compare the padding */ /* XXX: We don't compare the padding */
return *c1 == *c2 ? TRUE : FALSE; return *c1 == *c2 ? TRUE : FALSE;

View File

@ -59,7 +59,7 @@ cogl_depth_state_set_test_enabled (CoglDepthState *state,
gboolean gboolean
cogl_depth_state_get_test_enabled (CoglDepthState *state) cogl_depth_state_get_test_enabled (CoglDepthState *state)
{ {
_COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->test_enabled; return state->test_enabled;
} }
@ -74,7 +74,7 @@ cogl_depth_state_set_write_enabled (CoglDepthState *state,
gboolean gboolean
cogl_depth_state_get_write_enabled (CoglDepthState *state) cogl_depth_state_get_write_enabled (CoglDepthState *state)
{ {
_COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->write_enabled; return state->write_enabled;
} }
@ -89,7 +89,7 @@ cogl_depth_state_set_test_function (CoglDepthState *state,
CoglDepthTestFunction CoglDepthTestFunction
cogl_depth_state_get_test_function (CoglDepthState *state) cogl_depth_state_get_test_function (CoglDepthState *state)
{ {
_COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->test_function; return state->test_function;
} }

View File

@ -164,8 +164,8 @@ cogl_euler_equal (const void *v1, const void *v2)
const CoglEuler *a = v1; const CoglEuler *a = v1;
const CoglEuler *b = v2; const CoglEuler *b = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); g_return_val_if_fail (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); g_return_val_if_fail (v2 != NULL, FALSE);
if (v1 == v2) if (v1 == v2)
return TRUE; return TRUE;

View File

@ -618,7 +618,7 @@ _cogl_offscreen_new_with_texture_full (CoglTexture *texture,
CoglFramebuffer *fb; CoglFramebuffer *fb;
CoglOffscreen *ret; CoglOffscreen *ret;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_texture (texture), NULL); g_return_val_if_fail (cogl_is_texture (texture), NULL);
offscreen = g_new0 (CoglOffscreen, 1); offscreen = g_new0 (CoglOffscreen, 1);
offscreen->texture = cogl_object_ref (texture); offscreen->texture = cogl_object_ref (texture);
@ -1087,7 +1087,7 @@ cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer)
if (!cogl_framebuffer_allocate (framebuffer, NULL)) if (!cogl_framebuffer_allocate (framebuffer, NULL))
return NULL; return NULL;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_offscreen (framebuffer), NULL); g_return_val_if_fail (cogl_is_offscreen (framebuffer), NULL);
return COGL_OFFSCREEN(framebuffer)->depth_texture; return COGL_OFFSCREEN(framebuffer)->depth_texture;
} }
@ -1158,7 +1158,7 @@ cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer,
CoglContext * CoglContext *
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer) cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
{ {
_COGL_RETURN_VAL_IF_FAIL (framebuffer != NULL, NULL); g_return_val_if_fail (framebuffer != NULL, NULL);
return framebuffer->context; return framebuffer->context;
} }
@ -1254,8 +1254,8 @@ _cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer,
int width; int width;
int height; int height;
_COGL_RETURN_VAL_IF_FAIL (source & COGL_READ_PIXELS_COLOR_BUFFER, FALSE); g_return_val_if_fail (source & COGL_READ_PIXELS_COLOR_BUFFER, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_framebuffer (framebuffer), FALSE); g_return_val_if_fail (cogl_is_framebuffer (framebuffer), FALSE);
if (!cogl_framebuffer_allocate (framebuffer, error)) if (!cogl_framebuffer_allocate (framebuffer, error))
return FALSE; return FALSE;

View File

@ -1786,7 +1786,7 @@ cogl_push_gles2_context (CoglContext *ctx,
const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable; const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable;
CoglError *internal_error = NULL; CoglError *internal_error = NULL;
_COGL_RETURN_VAL_IF_FAIL (gles2_ctx != NULL, FALSE); g_return_val_if_fail (gles2_ctx != NULL, FALSE);
/* The read/write buffers are properties of the gles2 context and we /* The read/write buffers are properties of the gles2 context and we
* don't currently track the read/write buffers as part of the stack * don't currently track the read/write buffers as part of the stack

View File

@ -120,15 +120,15 @@ cogl_indices_get_buffer (CoglIndices *indices)
CoglIndicesType CoglIndicesType
cogl_indices_get_type (CoglIndices *indices) cogl_indices_get_type (CoglIndices *indices)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), g_return_val_if_fail (cogl_is_indices (indices),
COGL_INDICES_TYPE_UNSIGNED_BYTE); COGL_INDICES_TYPE_UNSIGNED_BYTE);
return indices->type; return indices->type;
} }
size_t size_t
cogl_indices_get_offset (CoglIndices *indices) cogl_indices_get_offset (CoglIndices *indices)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), 0); g_return_val_if_fail (cogl_is_indices (indices), 0);
return indices->offset; return indices->offset;
} }
@ -167,7 +167,7 @@ _cogl_indices_free (CoglIndices *indices)
CoglIndices * CoglIndices *
_cogl_indices_immutable_ref (CoglIndices *indices) _cogl_indices_immutable_ref (CoglIndices *indices)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), NULL); g_return_val_if_fail (cogl_is_indices (indices), NULL);
indices->immutable_ref++; indices->immutable_ref++;
_cogl_buffer_immutable_ref (COGL_BUFFER (indices->buffer)); _cogl_buffer_immutable_ref (COGL_BUFFER (indices->buffer));

View File

@ -1942,8 +1942,8 @@ cogl_matrix_equal (const void *v1, const void *v2)
const CoglMatrix *a = v1; const CoglMatrix *a = v1;
const CoglMatrix *b = v2; const CoglMatrix *b = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); g_return_val_if_fail (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); g_return_val_if_fail (v2 != NULL, FALSE);
/* We want to avoid having a fuzzy _equal() function (e.g. that uses /* We want to avoid having a fuzzy _equal() function (e.g. that uses
* an arbitrary epsilon value) since this function noteably conforms * an arbitrary epsilon value) since this function noteably conforms

View File

@ -46,7 +46,7 @@ cogl_object_ref (void *object)
{ {
CoglObject *obj = object; CoglObject *obj = object;
_COGL_RETURN_VAL_IF_FAIL (object != NULL, NULL); g_return_val_if_fail (object != NULL, NULL);
obj->ref_count++; obj->ref_count++;
return object; return object;

View File

@ -402,7 +402,7 @@ cogl_onscreen_get_buffer_age (CoglOnscreen *onscreen)
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
const CoglWinsysVtable *winsys; const CoglWinsysVtable *winsys;
_COGL_RETURN_VAL_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0); g_return_val_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0);
winsys = _cogl_framebuffer_get_winsys (framebuffer); winsys = _cogl_framebuffer_get_winsys (framebuffer);
@ -440,7 +440,7 @@ cogl_x11_onscreen_get_window_xid (CoglOnscreen *onscreen)
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
/* This should only be called for x11 onscreens */ /* This should only be called for x11 onscreens */
_COGL_RETURN_VAL_IF_FAIL (winsys->onscreen_x11_get_window_xid != NULL, 0); g_return_val_if_fail (winsys->onscreen_x11_get_window_xid != NULL, 0);
return winsys->onscreen_x11_get_window_xid (onscreen); return winsys->onscreen_x11_get_window_xid (onscreen);
} }

View File

@ -293,7 +293,7 @@ public_to_internal_wrap_mode (CoglPipelineWrapMode mode)
static CoglPipelineWrapMode static CoglPipelineWrapMode
internal_to_public_wrap_mode (CoglSamplerCacheWrapMode internal_mode) internal_to_public_wrap_mode (CoglSamplerCacheWrapMode internal_mode)
{ {
_COGL_RETURN_VAL_IF_FAIL (internal_mode != g_return_val_if_fail (internal_mode !=
COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_BORDER, COGL_SAMPLER_CACHE_WRAP_MODE_CLAMP_TO_BORDER,
COGL_PIPELINE_WRAP_MODE_AUTOMATIC); COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
return (CoglPipelineWrapMode)internal_mode; return (CoglPipelineWrapMode)internal_mode;
@ -487,7 +487,7 @@ _cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer)
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
const CoglSamplerCacheEntry *sampler_state; const CoglSamplerCacheEntry *sampler_state;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), FALSE); g_return_val_if_fail (_cogl_is_pipeline_layer (layer), FALSE);
/* Now find the ancestor of the layer that is the authority for the /* Now find the ancestor of the layer that is the authority for the
* state we want to change */ * state we want to change */
@ -502,7 +502,7 @@ cogl_pipeline_get_layer_wrap_mode_s (CoglPipeline *pipeline, int layer_index)
{ {
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it /* Note: this will ensure that the layer exists, creating one if it
* doesn't already. * doesn't already.
@ -524,7 +524,7 @@ _cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer)
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
const CoglSamplerCacheEntry *sampler_state; const CoglSamplerCacheEntry *sampler_state;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), FALSE); g_return_val_if_fail (_cogl_is_pipeline_layer (layer), FALSE);
/* Now find the ancestor of the layer that is the authority for the /* Now find the ancestor of the layer that is the authority for the
* state we want to change */ * state we want to change */
@ -539,7 +539,7 @@ cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, int layer_index)
{ {
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it /* Note: this will ensure that the layer exists, creating one if it
* doesn't already. * doesn't already.
@ -570,7 +570,7 @@ cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, int layer_index)
{ {
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it /* Note: this will ensure that the layer exists, creating one if it
* doesn't already. * doesn't already.
@ -612,7 +612,7 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Don't allow point sprite coordinates to be enabled if the driver /* Don't allow point sprite coordinates to be enabled if the driver
doesn't support it */ doesn't support it */
@ -706,7 +706,7 @@ cogl_pipeline_get_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it /* Note: this will ensure that the layer exists, creating one if it
* doesn't already. * doesn't already.
@ -1040,7 +1040,7 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
CoglBlendStringStatement *a; CoglBlendStringStatement *a;
int count; int count;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
/* Note: this will ensure that the layer exists, creating one if it /* Note: this will ensure that the layer exists, creating one if it
* doesn't already. * doesn't already.
@ -1250,7 +1250,7 @@ _cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline, int layer_index)
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL); g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
layer = _cogl_pipeline_get_layer (pipeline, layer_index); layer = _cogl_pipeline_get_layer (pipeline, layer_index);
@ -1330,7 +1330,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
CoglTexture * CoglTexture *
_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer) _cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer)
{ {
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), NULL); g_return_val_if_fail (_cogl_is_pipeline_layer (layer), NULL);
return _cogl_pipeline_layer_get_texture_real (layer); return _cogl_pipeline_layer_get_texture_real (layer);
} }
@ -1415,7 +1415,7 @@ _cogl_pipeline_layer_get_min_filter (CoglPipelineLayer *layer)
{ {
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0); g_return_val_if_fail (_cogl_is_pipeline_layer (layer), 0);
authority = authority =
_cogl_pipeline_layer_get_authority (layer, _cogl_pipeline_layer_get_authority (layer,
@ -1429,7 +1429,7 @@ _cogl_pipeline_layer_get_mag_filter (CoglPipelineLayer *layer)
{ {
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
_COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0); g_return_val_if_fail (_cogl_is_pipeline_layer (layer), 0);
authority = authority =
_cogl_pipeline_layer_get_authority (layer, _cogl_pipeline_layer_get_authority (layer,

View File

@ -351,7 +351,7 @@ _cogl_pipeline_layer_pre_change_notify (CoglPipeline *required_owner,
goto init_layer_state; goto init_layer_state;
/* We only allow a NULL required_owner for new layers */ /* We only allow a NULL required_owner for new layers */
_COGL_RETURN_VAL_IF_FAIL (required_owner != NULL, layer); g_return_val_if_fail (required_owner != NULL, layer);
/* Chain up: /* Chain up:
* A modification of a layer is indirectly also a modification of * A modification of a layer is indirectly also a modification of

View File

@ -55,7 +55,7 @@ _cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL); g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER);
@ -452,7 +452,7 @@ _cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_BLEND_ENABLE);
@ -660,7 +660,7 @@ cogl_pipeline_get_shininess (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@ -830,7 +830,7 @@ cogl_pipeline_get_alpha_test_function (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_ALPHA_FUNC); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_ALPHA_FUNC);
@ -843,7 +843,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0.0f); g_return_val_if_fail (cogl_is_pipeline (pipeline), 0.0f);
authority = authority =
_cogl_pipeline_get_authority (pipeline, _cogl_pipeline_get_authority (pipeline,
@ -958,7 +958,7 @@ cogl_pipeline_set_blend (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
count = count =
_cogl_blend_string_compile (blend_description, _cogl_blend_string_compile (blend_description,
@ -1071,7 +1071,7 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), COGL_INVALID_HANDLE); g_return_val_if_fail (cogl_is_pipeline (pipeline), COGL_INVALID_HANDLE);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_USER_SHADER);
@ -1152,8 +1152,8 @@ cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
_COGL_RETURN_VAL_IF_FAIL (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); g_return_val_if_fail (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1294,8 +1294,8 @@ cogl_pipeline_get_cull_face_mode (CoglPipeline *pipeline)
CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE; CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE;
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), g_return_val_if_fail (cogl_is_pipeline (pipeline),
COGL_PIPELINE_CULL_FACE_MODE_NONE); COGL_PIPELINE_CULL_FACE_MODE_NONE);
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1308,8 +1308,8 @@ cogl_pipeline_get_front_face_winding (CoglPipeline *pipeline)
CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE; CoglPipelineState state = COGL_PIPELINE_STATE_CULL_FACE;
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), g_return_val_if_fail (cogl_is_pipeline (pipeline),
COGL_PIPELINE_CULL_FACE_MODE_NONE); COGL_PIPELINE_CULL_FACE_MODE_NONE);
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1321,7 +1321,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_POINT_SIZE);
@ -1395,7 +1395,7 @@ cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1434,7 +1434,7 @@ cogl_pipeline_get_per_vertex_point_size (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority = authority =
_cogl_pipeline_get_authority (pipeline, _cogl_pipeline_get_authority (pipeline,

View File

@ -474,7 +474,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
gboolean gboolean
_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline) _cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
return pipeline->real_blend_enable; return pipeline->real_blend_enable;
} }
@ -2401,7 +2401,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE); g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_FOG);
@ -2411,7 +2411,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
unsigned long unsigned long
_cogl_pipeline_get_age (CoglPipeline *pipeline) _cogl_pipeline_get_age (CoglPipeline *pipeline)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
return pipeline->age; return pipeline->age;
} }
@ -2486,7 +2486,7 @@ prepend_layer_to_list_cb (CoglPipelineLayer *layer,
const GList * const GList *
_cogl_pipeline_get_layers (CoglPipeline *pipeline) _cogl_pipeline_get_layers (CoglPipeline *pipeline)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), NULL); g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL);
if (!pipeline->deprecated_get_layers_list_dirty) if (!pipeline->deprecated_get_layers_list_dirty)
g_list_free (pipeline->deprecated_get_layers_list); g_list_free (pipeline->deprecated_get_layers_list);
@ -2509,7 +2509,7 @@ cogl_pipeline_get_n_layers (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0); g_return_val_if_fail (cogl_is_pipeline (pipeline), 0);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);

View File

@ -53,10 +53,10 @@ cogl_poll_renderer_get_info (CoglRenderer *renderer,
{ {
GList *l, *next; GList *l, *next;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), 0); g_return_val_if_fail (cogl_is_renderer (renderer), 0);
_COGL_RETURN_VAL_IF_FAIL (poll_fds != NULL, 0); g_return_val_if_fail (poll_fds != NULL, 0);
_COGL_RETURN_VAL_IF_FAIL (n_poll_fds != NULL, 0); g_return_val_if_fail (n_poll_fds != NULL, 0);
_COGL_RETURN_VAL_IF_FAIL (timeout != NULL, 0); g_return_val_if_fail (timeout != NULL, 0);
*timeout = -1; *timeout = -1;

View File

@ -74,7 +74,7 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
CoglAttribute *attribute = attributes[i]; CoglAttribute *attribute = attributes[i];
cogl_object_ref (attribute); cogl_object_ref (attribute);
_COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL); g_return_val_if_fail (cogl_is_attribute (attribute), NULL);
primitive->attributes[i] = attribute; primitive->attributes[i] = attribute;
} }
@ -463,7 +463,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
int int
cogl_primitive_get_first_vertex (CoglPrimitive *primitive) cogl_primitive_get_first_vertex (CoglPrimitive *primitive)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0); g_return_val_if_fail (cogl_is_primitive (primitive), 0);
return primitive->first_vertex; return primitive->first_vertex;
} }
@ -486,7 +486,7 @@ cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
int int
cogl_primitive_get_n_vertices (CoglPrimitive *primitive) cogl_primitive_get_n_vertices (CoglPrimitive *primitive)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0); g_return_val_if_fail (cogl_is_primitive (primitive), 0);
return primitive->n_vertices; return primitive->n_vertices;
} }
@ -503,7 +503,7 @@ cogl_primitive_set_n_vertices (CoglPrimitive *primitive,
CoglVerticesMode CoglVerticesMode
cogl_primitive_get_mode (CoglPrimitive *primitive) cogl_primitive_get_mode (CoglPrimitive *primitive)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0); g_return_val_if_fail (cogl_is_primitive (primitive), 0);
return primitive->mode; return primitive->mode;
} }
@ -571,7 +571,7 @@ _cogl_primitive_immutable_ref (CoglPrimitive *primitive)
{ {
int i; int i;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), NULL); g_return_val_if_fail (cogl_is_primitive (primitive), NULL);
primitive->immutable_ref++; primitive->immutable_ref++;

View File

@ -330,8 +330,8 @@ cogl_quaternion_equal (const void *v1, const void *v2)
const CoglQuaternion *a = v1; const CoglQuaternion *a = v1;
const CoglQuaternion *b = v2; const CoglQuaternion *b = v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); g_return_val_if_fail (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); g_return_val_if_fail (v2 != NULL, FALSE);
if (v1 == v2) if (v1 == v2)
return TRUE; return TRUE;

View File

@ -360,7 +360,7 @@ _cogl_rectangle_map_add (CoglRectangleMap *map,
/* Zero-sized rectangles break the algorithm for removing rectangles /* Zero-sized rectangles break the algorithm for removing rectangles
so we'll disallow them */ so we'll disallow them */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, FALSE); g_return_val_if_fail (width > 0 && height > 0, FALSE);
/* Start with the root node */ /* Start with the root node */
g_array_set_size (stack, 0); g_array_set_size (stack, 0);

View File

@ -243,7 +243,7 @@ cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
Display * Display *
cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer) cogl_xlib_renderer_get_foreign_display (CoglRenderer *renderer)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
return renderer->foreign_xdpy; return renderer->foreign_xdpy;
} }
@ -759,7 +759,7 @@ cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID CoglWinsysID
cogl_renderer_get_winsys_id (CoglRenderer *renderer) cogl_renderer_get_winsys_id (CoglRenderer *renderer)
{ {
_COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0); g_return_val_if_fail (renderer->connected, 0);
return renderer->winsys_vtable->id; return renderer->winsys_vtable->id;
} }
@ -817,7 +817,7 @@ cogl_renderer_set_driver (CoglRenderer *renderer,
CoglDriver CoglDriver
cogl_renderer_get_driver (CoglRenderer *renderer) cogl_renderer_get_driver (CoglRenderer *renderer)
{ {
_COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0); g_return_val_if_fail (renderer->connected, 0);
return renderer->driver; return renderer->driver;
} }

View File

@ -64,7 +64,7 @@ cogl_snippet_new (CoglSnippetHook hook,
CoglSnippetHook CoglSnippetHook
cogl_snippet_get_hook (CoglSnippet *snippet) cogl_snippet_get_hook (CoglSnippet *snippet)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), 0); g_return_val_if_fail (cogl_is_snippet (snippet), 0);
return snippet->hook; return snippet->hook;
} }
@ -100,7 +100,7 @@ cogl_snippet_set_declarations (CoglSnippet *snippet,
const char * const char *
cogl_snippet_get_declarations (CoglSnippet *snippet) cogl_snippet_get_declarations (CoglSnippet *snippet)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->declarations; return snippet->declarations;
} }
@ -121,7 +121,7 @@ cogl_snippet_set_pre (CoglSnippet *snippet,
const char * const char *
cogl_snippet_get_pre (CoglSnippet *snippet) cogl_snippet_get_pre (CoglSnippet *snippet)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->pre; return snippet->pre;
} }
@ -142,7 +142,7 @@ cogl_snippet_set_replace (CoglSnippet *snippet,
const char * const char *
cogl_snippet_get_replace (CoglSnippet *snippet) cogl_snippet_get_replace (CoglSnippet *snippet)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->replace; return snippet->replace;
} }
@ -163,7 +163,7 @@ cogl_snippet_set_post (CoglSnippet *snippet,
const char * const char *
cogl_snippet_get_post (CoglSnippet *snippet) cogl_snippet_get_post (CoglSnippet *snippet)
{ {
_COGL_RETURN_VAL_IF_FAIL (cogl_is_snippet (snippet), NULL); g_return_val_if_fail (cogl_is_snippet (snippet), NULL);
return snippet->post; return snippet->post;
} }

View File

@ -195,10 +195,10 @@ cogl_sub_texture_new (CoglContext *ctx,
next_height = cogl_texture_get_height (next_texture); next_height = cogl_texture_get_height (next_texture);
/* The region must specify a non-zero subset of the full texture */ /* The region must specify a non-zero subset of the full texture */
_COGL_RETURN_VAL_IF_FAIL (sub_x >= 0 && sub_y >= 0, NULL); g_return_val_if_fail (sub_x >= 0 && sub_y >= 0, NULL);
_COGL_RETURN_VAL_IF_FAIL (sub_width > 0 && sub_height > 0, NULL); g_return_val_if_fail (sub_width > 0 && sub_height > 0, NULL);
_COGL_RETURN_VAL_IF_FAIL (sub_x + sub_width <= next_width, NULL); g_return_val_if_fail (sub_x + sub_width <= next_width, NULL);
_COGL_RETURN_VAL_IF_FAIL (sub_y + sub_height <= next_height, NULL); g_return_val_if_fail (sub_y + sub_height <= next_height, NULL);
sub_tex = g_new (CoglSubTexture, 1); sub_tex = g_new (CoglSubTexture, 1);
@ -373,12 +373,12 @@ _cogl_sub_texture_set_region (CoglTexture *tex,
int full_width = cogl_texture_get_width (sub_tex->full_texture); int full_width = cogl_texture_get_width (sub_tex->full_texture);
int full_height = cogl_texture_get_width (sub_tex->full_texture); int full_height = cogl_texture_get_width (sub_tex->full_texture);
_COGL_RETURN_VAL_IF_FAIL (sub_tex->sub_x == 0 && g_return_val_if_fail (sub_tex->sub_x == 0 &&
cogl_texture_get_width (tex) == full_width, cogl_texture_get_width (tex) == full_width,
FALSE); FALSE);
_COGL_RETURN_VAL_IF_FAIL (sub_tex->sub_y == 0 && g_return_val_if_fail (sub_tex->sub_y == 0 &&
cogl_texture_get_height (tex) == full_height, cogl_texture_get_height (tex) == full_height,
FALSE); FALSE);
} }
return _cogl_texture_set_region_from_bitmap (sub_tex->full_texture, return _cogl_texture_set_region_from_bitmap (sub_tex->full_texture,

View File

@ -891,7 +891,7 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
{ {
CoglTextureLoader *loader; CoglTextureLoader *loader;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL); g_return_val_if_fail (cogl_is_bitmap (bmp), NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP;
@ -932,16 +932,16 @@ _cogl_texture_2d_sliced_new_from_foreign (CoglContext *ctx,
*/ */
/* This should only be called when the texture target is 2D. */ /* This should only be called when the texture target is 2D. */
_COGL_RETURN_VAL_IF_FAIL (gl_target == GL_TEXTURE_2D, NULL); g_return_val_if_fail (gl_target == GL_TEXTURE_2D, NULL);
/* Assert it is a valid GL texture object */ /* Assert it is a valid GL texture object */
_COGL_RETURN_VAL_IF_FAIL (ctx->glIsTexture (gl_handle), FALSE); g_return_val_if_fail (ctx->glIsTexture (gl_handle), FALSE);
/* Validate width and height */ /* Validate width and height */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL);
/* Validate pot waste */ /* Validate pot waste */
_COGL_RETURN_VAL_IF_FAIL (x_pot_waste >= 0 && x_pot_waste < width && g_return_val_if_fail (x_pot_waste >= 0 && x_pot_waste < width &&
y_pot_waste >= 0 && y_pot_waste < height, y_pot_waste >= 0 && y_pot_waste < height,
NULL); NULL);
@ -972,8 +972,8 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglTexture2DSliced *tex_2ds; CoglTexture2DSliced *tex_2ds;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
@ -1009,7 +1009,7 @@ cogl_texture_2d_sliced_new_from_file (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglTexture2DSliced *tex_2ds = NULL; CoglTexture2DSliced *tex_2ds = NULL;
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = _cogl_bitmap_from_file (ctx, filename, error); bmp = _cogl_bitmap_from_file (ctx, filename, error);
if (bmp == NULL) if (bmp == NULL)
@ -1063,7 +1063,7 @@ allocate_from_bitmap (CoglTexture2DSliced *tex_2ds,
CoglPixelFormat internal_format; CoglPixelFormat internal_format;
CoglBitmap *upload_bmp; CoglBitmap *upload_bmp;
_COGL_RETURN_VAL_IF_FAIL (tex_2ds->slice_textures == NULL, FALSE); g_return_val_if_fail (tex_2ds->slice_textures == NULL, FALSE);
internal_format = internal_format =
_cogl_texture_determine_internal_format (tex, _cogl_texture_determine_internal_format (tex,
@ -1175,7 +1175,7 @@ _cogl_texture_2d_sliced_allocate (CoglTexture *tex,
CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex);
CoglTextureLoader *loader = tex->loader; CoglTextureLoader *loader = tex->loader;
_COGL_RETURN_VAL_IF_FAIL (loader, FALSE); g_return_val_if_fail (loader, FALSE);
switch (loader->src_type) switch (loader->src_type)
{ {

View File

@ -148,7 +148,7 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
{ {
CoglTextureLoader *loader; CoglTextureLoader *loader;
_COGL_RETURN_VAL_IF_FAIL (bmp != NULL, NULL); g_return_val_if_fail (bmp != NULL, NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_BITMAP;
@ -177,7 +177,7 @@ cogl_texture_2d_new_from_file (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglTexture2D *tex_2d = NULL; CoglTexture2D *tex_2d = NULL;
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = _cogl_bitmap_from_file (ctx, filename, error); bmp = _cogl_bitmap_from_file (ctx, filename, error);
if (bmp == NULL) if (bmp == NULL)
@ -203,8 +203,8 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglTexture2D *tex_2d; CoglTexture2D *tex_2d;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
@ -246,14 +246,14 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
CoglTextureLoader *loader; CoglTextureLoader *loader;
CoglTexture2D *tex; CoglTexture2D *tex;
_COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints & g_return_val_if_fail (_cogl_context_get_winsys (ctx)->constraints &
COGL_RENDERER_CONSTRAINT_USES_EGL, COGL_RENDERER_CONSTRAINT_USES_EGL,
NULL); NULL);
_COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature g_return_val_if_fail (_cogl_has_private_feature
(ctx, (ctx,
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE), COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE),
NULL); NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE;

View File

@ -365,12 +365,10 @@ _cogl_texture_set_region_from_bitmap (CoglTexture *texture,
int level, int level,
CoglError **error) CoglError **error)
{ {
_COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_width (bmp) - src_x) g_return_val_if_fail (cogl_bitmap_get_width (bmp) - src_x >= width, FALSE);
>= width, FALSE); g_return_val_if_fail (cogl_bitmap_get_height (bmp) - src_y >= height, FALSE);
_COGL_RETURN_VAL_IF_FAIL ((cogl_bitmap_get_height (bmp) - src_y) g_return_val_if_fail (width > 0, FALSE);
>= height, FALSE); g_return_val_if_fail (height > 0, FALSE);
_COGL_RETURN_VAL_IF_FAIL (width > 0, FALSE);
_COGL_RETURN_VAL_IF_FAIL (height > 0, FALSE);
/* Assert that the storage for this texture has been allocated */ /* Assert that the storage for this texture has been allocated */
if (!cogl_texture_allocate (texture, error)) if (!cogl_texture_allocate (texture, error))
@ -433,7 +431,7 @@ _cogl_texture_set_region (CoglTexture *texture,
CoglBitmap *source_bmp; CoglBitmap *source_bmp;
gboolean ret; gboolean ret;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, FALSE); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, FALSE);
/* Rowstride from width if none specified */ /* Rowstride from width if none specified */
if (rowstride == 0) if (rowstride == 0)

View File

@ -124,8 +124,6 @@ _cogl_util_fls (unsigned int n)
#define _cogl_util_popcountl __builtin_popcountl #define _cogl_util_popcountl __builtin_popcountl
#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)
/* Match a CoglPixelFormat according to channel masks, color depth, /* Match a CoglPixelFormat according to channel masks, color depth,
* bits per pixel and byte order. These information are provided by * bits per pixel and byte order. These information are provided by
* the Visual and XImage structures. * the Visual and XImage structures.

View File

@ -63,8 +63,8 @@ cogl_vector3_equal (const void *v1, const void *v2)
float *vector0 = (float *)v1; float *vector0 = (float *)v1;
float *vector1 = (float *)v2; float *vector1 = (float *)v2;
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); g_return_val_if_fail (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); g_return_val_if_fail (v2 != NULL, FALSE);
/* There's no point picking an arbitrary epsilon that's appropriate /* There's no point picking an arbitrary epsilon that's appropriate
* for comparing the components so we just use == that will at least * for comparing the components so we just use == that will at least
@ -80,8 +80,8 @@ cogl_vector3_equal_with_epsilon (const float *vector0,
const float *vector1, const float *vector1,
float epsilon) float epsilon)
{ {
_COGL_RETURN_VAL_IF_FAIL (vector0 != NULL, FALSE); g_return_val_if_fail (vector0 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (vector1 != NULL, FALSE); g_return_val_if_fail (vector1 != NULL, FALSE);
if (fabsf (vector0[X] - vector1[X]) < epsilon && if (fabsf (vector0[X] - vector1[X]) < epsilon &&
fabsf (vector0[Y] - vector1[Y]) < epsilon && fabsf (vector0[Y] - vector1[Y]) < epsilon &&
@ -233,8 +233,8 @@ cogl_vector4_init_from_vector4 (float *vector, float *src)
gboolean gboolean
cogl_vector4_equal (const void *v0, const void *v1) cogl_vector4_equal (const void *v0, const void *v1)
{ {
_COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE); g_return_val_if_fail (v1 != NULL, FALSE);
_COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE); g_return_val_if_fail (v2 != NULL, FALSE);
return memcmp (v1, v2, sizeof (float) * 4) == 0 ? TRUE : FALSE; return memcmp (v1, v2, sizeof (float) * 4) == 0 ? TRUE : FALSE;
} }

View File

@ -566,7 +566,7 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer)
{ {
CoglXlibRenderer *xlib_renderer; CoglXlibRenderer *xlib_renderer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
xlib_renderer = _cogl_xlib_renderer_get_data (renderer); xlib_renderer = _cogl_xlib_renderer_get_data (renderer);
@ -655,7 +655,7 @@ cogl_xlib_renderer_get_visual_info (CoglRenderer *renderer)
{ {
CoglXlibRenderer *xlib_renderer; CoglXlibRenderer *xlib_renderer;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL); g_return_val_if_fail (cogl_is_renderer (renderer), NULL);
xlib_renderer = _cogl_xlib_renderer_get_data (renderer); xlib_renderer = _cogl_xlib_renderer_get_data (renderer);

View File

@ -617,7 +617,7 @@ cogl_get_source (void)
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, NULL); g_return_val_if_fail (ctx->source_stack, NULL);
top = ctx->source_stack->data; top = ctx->source_stack->data;
return top->pipeline; return top->pipeline;
@ -630,7 +630,7 @@ _cogl_get_enable_legacy_state (void)
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
_COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, FALSE); g_return_val_if_fail (ctx->source_stack, FALSE);
top = ctx->source_stack->data; top = ctx->source_stack->data;
return top->enable_legacy; return top->enable_legacy;

View File

@ -144,8 +144,8 @@ _cogl_texture_new_from_data (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglTexture *tex; CoglTexture *tex;
_COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL); g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL);
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
/* Rowstride from width if not given */ /* Rowstride from width if not given */
if (rowstride == 0) if (rowstride == 0)
@ -297,7 +297,7 @@ cogl_texture_new_from_file (const char *filename,
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
bmp = cogl_bitmap_new_from_file (filename, error); bmp = cogl_bitmap_new_from_file (filename, error);
if (bmp == NULL) if (bmp == NULL)

View File

@ -102,10 +102,10 @@ cogl_clutter_winsys_xlib_get_visual_info (void)
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
_COGL_RETURN_VAL_IF_FAIL (ctx->display != NULL, NULL); g_return_val_if_fail (ctx->display != NULL, NULL);
renderer = cogl_display_get_renderer (ctx->display); renderer = cogl_display_get_renderer (ctx->display);
_COGL_RETURN_VAL_IF_FAIL (renderer != NULL, NULL); g_return_val_if_fail (renderer != NULL, NULL);
return cogl_xlib_renderer_get_visual_info (renderer); return cogl_xlib_renderer_get_visual_info (renderer);
} }

View File

@ -193,10 +193,10 @@ cogl_program_modify_uniform (CoglProgram *program,
{ {
CoglProgramUniform *uniform; CoglProgramUniform *uniform;
_COGL_RETURN_VAL_IF_FAIL (cogl_is_program (program), NULL); g_return_val_if_fail (cogl_is_program (program), NULL);
_COGL_RETURN_VAL_IF_FAIL (uniform_no >= 0 && g_return_val_if_fail (uniform_no >= 0 &&
uniform_no < program->custom_uniforms->len, uniform_no < program->custom_uniforms->len,
NULL); NULL);
uniform = &g_array_index (program->custom_uniforms, uniform = &g_array_index (program->custom_uniforms,
CoglProgramUniform, uniform_no); CoglProgramUniform, uniform_no);

View File

@ -60,9 +60,9 @@ toggle_builtin_attribute_enabled_cb (int bit_num, void *user_data)
ForeachChangedBitState *state = user_data; ForeachChangedBitState *state = user_data;
CoglContext *context = state->context; CoglContext *context = state->context;
_COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature g_return_val_if_fail (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_GL_FIXED), (context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE); FALSE);
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
{ {
@ -99,9 +99,9 @@ toggle_texcood_attribute_enabled_cb (int bit_num, void *user_data)
ForeachChangedBitState *state = user_data; ForeachChangedBitState *state = user_data;
CoglContext *context = state->context; CoglContext *context = state->context;
_COGL_RETURN_VAL_IF_FAIL (_cogl_has_private_feature g_return_val_if_fail (_cogl_has_private_feature
(context, COGL_PRIVATE_FEATURE_GL_FIXED), (context, COGL_PRIVATE_FEATURE_GL_FIXED),
FALSE); FALSE);
#ifdef HAVE_COGL_GL #ifdef HAVE_COGL_GL
{ {

View File

@ -178,14 +178,14 @@ _cogl_buffer_bind_no_create (CoglBuffer *buffer,
{ {
CoglContext *ctx = buffer->context; CoglContext *ctx = buffer->context;
_COGL_RETURN_VAL_IF_FAIL (buffer != NULL, NULL); g_return_val_if_fail (buffer != NULL, NULL);
/* Don't allow binding the buffer to multiple targets at the same time */ /* Don't allow binding the buffer to multiple targets at the same time */
_COGL_RETURN_VAL_IF_FAIL (ctx->current_buffer[buffer->last_target] != buffer, g_return_val_if_fail (ctx->current_buffer[buffer->last_target] != buffer,
NULL); NULL);
/* Don't allow nesting binds to the same target */ /* Don't allow nesting binds to the same target */
_COGL_RETURN_VAL_IF_FAIL (ctx->current_buffer[target] == NULL, NULL); g_return_val_if_fail (ctx->current_buffer[target] == NULL, NULL);
buffer->last_target = target; buffer->last_target = target;
ctx->current_buffer[target] = buffer; ctx->current_buffer[target] = buffer;
@ -290,7 +290,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
return NULL; return NULL;
} }
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
} }
else else
{ {
@ -319,7 +319,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer,
return NULL; return NULL;
} }
_COGL_RETURN_VAL_IF_FAIL (data != NULL, NULL); g_return_val_if_fail (data != NULL, NULL);
data += offset; data += offset;
} }

View File

@ -529,7 +529,7 @@ try_creating_renderbuffers (CoglContext *ctx,
format = GL_DEPTH_STENCIL; format = GL_DEPTH_STENCIL;
else else
{ {
_COGL_RETURN_VAL_IF_FAIL ( g_return_val_if_fail (
_cogl_has_private_feature (ctx, _cogl_has_private_feature (ctx,
COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL), COGL_PRIVATE_FEATURE_OES_PACKED_DEPTH_STENCIL),
NULL); NULL);
@ -779,9 +779,9 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen,
int level_width; int level_width;
int level_height; int level_height;
_COGL_RETURN_VAL_IF_FAIL (offscreen->texture_level < g_return_val_if_fail (offscreen->texture_level <
_cogl_texture_get_n_levels (offscreen->texture), _cogl_texture_get_n_levels (offscreen->texture),
FALSE); FALSE);
_cogl_texture_get_level_size (offscreen->texture, _cogl_texture_get_level_size (offscreen->texture,
offscreen->texture_level, offscreen->texture_level,

View File

@ -180,8 +180,8 @@ _cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, -1); _COGL_GET_CONTEXT (ctx, -1);
_COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1); g_return_val_if_fail (program_state != NULL, -1);
_COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1); g_return_val_if_fail (program_state->program != 0, -1);
if (G_UNLIKELY (program_state->attribute_locations == NULL)) if (G_UNLIKELY (program_state->attribute_locations == NULL))
program_state->attribute_locations = program_state->attribute_locations =
@ -204,7 +204,7 @@ _cogl_pipeline_progend_glsl_get_attrib_location (CoglPipeline *pipeline,
g_array_index (ctx->attribute_name_index_map, g_array_index (ctx->attribute_name_index_map,
CoglAttributeNameState *, name_index); CoglAttributeNameState *, name_index);
_COGL_RETURN_VAL_IF_FAIL (name_state != NULL, 0); g_return_val_if_fail (name_state != NULL, 0);
GE_RET( locations[name_index], GE_RET( locations[name_index],
ctx, glGetAttribLocation (program_state->program, ctx, glGetAttribLocation (program_state->program,

View File

@ -524,13 +524,13 @@ cogl_texture_2d_new_from_egl_image_external (CoglContext *ctx,
CoglTexture2D *tex_2d; CoglTexture2D *tex_2d;
CoglPixelFormat internal_format = COGL_PIXEL_FORMAT_ANY; CoglPixelFormat internal_format = COGL_PIXEL_FORMAT_ANY;
_COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx)->constraints & g_return_val_if_fail (_cogl_context_get_winsys (ctx)->constraints &
COGL_RENDERER_CONSTRAINT_USES_EGL, COGL_RENDERER_CONSTRAINT_USES_EGL,
NULL); NULL);
_COGL_RETURN_VAL_IF_FAIL (cogl_has_feature (ctx, g_return_val_if_fail (cogl_has_feature (ctx,
COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL), COGL_FEATURE_ID_TEXTURE_EGL_IMAGE_EXTERNAL),
NULL); NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE_EXTERNAL; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_EGL_IMAGE_EXTERNAL;
@ -557,7 +557,7 @@ _cogl_texture_2d_gl_allocate (CoglTexture *tex,
CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex);
CoglTextureLoader *loader = tex->loader; CoglTextureLoader *loader = tex->loader;
_COGL_RETURN_VAL_IF_FAIL (loader, FALSE); g_return_val_if_fail (loader, FALSE);
switch (loader->src_type) switch (loader->src_type)
{ {
@ -659,10 +659,10 @@ cogl_texture_2d_gl_new_from_foreign (CoglContext *ctx,
*/ */
/* Assert it is a valid GL texture object */ /* Assert it is a valid GL texture object */
_COGL_RETURN_VAL_IF_FAIL (ctx->glIsTexture (gl_handle), FALSE); g_return_val_if_fail (ctx->glIsTexture (gl_handle), FALSE);
/* Validate width and height */ /* Validate width and height */
_COGL_RETURN_VAL_IF_FAIL (width > 0 && height > 0, NULL); g_return_val_if_fail (width > 0 && height > 0, NULL);
loader = _cogl_texture_create_loader (); loader = _cogl_texture_create_loader ();
loader->src_type = COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN; loader->src_type = COGL_TEXTURE_SOURCE_TYPE_GL_FOREIGN;

View File

@ -359,7 +359,7 @@ try_create_context (CoglDisplay *display,
const char *error_message; const char *error_message;
int i = 0; int i = 0;
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context == NULL, TRUE); g_return_val_if_fail (egl_display->egl_context == NULL, TRUE);
if (renderer->driver == COGL_DRIVER_GL || if (renderer->driver == COGL_DRIVER_GL ||
renderer->driver == COGL_DRIVER_GL3) renderer->driver == COGL_DRIVER_GL3)
@ -486,7 +486,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
CoglRenderer *renderer = display->renderer; CoglRenderer *renderer = display->renderer;
CoglRendererEGL *egl_renderer = renderer->winsys; CoglRendererEGL *egl_renderer = renderer->winsys;
_COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); g_return_val_if_fail (display->winsys == NULL, FALSE);
egl_display = g_slice_new0 (CoglDisplayEGL); egl_display = g_slice_new0 (CoglDisplayEGL);
display->winsys = egl_display; display->winsys = egl_display;
@ -528,7 +528,7 @@ _cogl_winsys_context_init (CoglContext *context, CoglError **error)
context->winsys = g_new0 (CoglContextEGL, 1); context->winsys = g_new0 (CoglContextEGL, 1);
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); g_return_val_if_fail (egl_display->egl_context, FALSE);
memset (context->winsys_features, 0, sizeof (context->winsys_features)); memset (context->winsys_features, 0, sizeof (context->winsys_features));
@ -647,7 +647,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
EGLint config_count = 0; EGLint config_count = 0;
EGLBoolean status; EGLBoolean status;
_COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context, FALSE); g_return_val_if_fail (egl_display->egl_context, FALSE);
egl_attributes_from_framebuffer_config (display, egl_attributes_from_framebuffer_config (display,
&framebuffer->config, &framebuffer->config,
@ -1034,7 +1034,7 @@ _cogl_egl_create_image (CoglContext *ctx,
CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys;
EGLContext egl_ctx; EGLContext egl_ctx;
_COGL_RETURN_VAL_IF_FAIL (egl_renderer->pf_eglCreateImage, EGL_NO_IMAGE_KHR); g_return_val_if_fail (egl_renderer->pf_eglCreateImage, EGL_NO_IMAGE_KHR);
/* The EGL_KHR_image_pixmap spec explicitly states that EGL_NO_CONTEXT must /* The EGL_KHR_image_pixmap spec explicitly states that EGL_NO_CONTEXT must
* always be used in conjunction with the EGL_NATIVE_PIXMAP_KHR target */ * always be used in conjunction with the EGL_NATIVE_PIXMAP_KHR target */
@ -1080,7 +1080,7 @@ _cogl_egl_query_wayland_buffer (CoglContext *ctx,
{ {
CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys;
_COGL_RETURN_VAL_IF_FAIL (egl_renderer->pf_eglQueryWaylandBuffer, FALSE); g_return_val_if_fail (egl_renderer->pf_eglQueryWaylandBuffer, FALSE);
return egl_renderer->pf_eglQueryWaylandBuffer (egl_renderer->edpy, return egl_renderer->pf_eglQueryWaylandBuffer (egl_renderer->edpy,
buffer, buffer,

View File

@ -830,7 +830,7 @@ update_winsys_features (CoglContext *context, CoglError **error)
CoglGLXDisplay *glx_display = context->display->winsys; CoglGLXDisplay *glx_display = context->display->winsys;
CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; CoglGLXRenderer *glx_renderer = context->display->renderer->winsys;
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE); g_return_val_if_fail (glx_display->glx_context, FALSE);
if (!_cogl_context_update_features (context, error)) if (!_cogl_context_update_features (context, error))
return FALSE; return FALSE;
@ -1137,7 +1137,7 @@ create_context (CoglDisplay *display, CoglError **error)
GLXDrawable dummy_drawable; GLXDrawable dummy_drawable;
CoglXlibTrapState old_state; CoglXlibTrapState old_state;
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context == NULL, TRUE); g_return_val_if_fail (glx_display->glx_context == NULL, TRUE);
glx_display->found_fbconfig = glx_display->found_fbconfig =
find_fbconfig (display, &display->onscreen_template->config, &config, find_fbconfig (display, &display->onscreen_template->config, &config,
@ -1303,7 +1303,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
CoglGLXDisplay *glx_display; CoglGLXDisplay *glx_display;
int i; int i;
_COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE); g_return_val_if_fail (display->winsys == NULL, FALSE);
glx_display = g_slice_new0 (CoglGLXDisplay); glx_display = g_slice_new0 (CoglGLXDisplay);
display->winsys = glx_display; display->winsys = glx_display;
@ -1358,7 +1358,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
GLXFBConfig fbconfig; GLXFBConfig fbconfig;
CoglError *fbconfig_error = NULL; CoglError *fbconfig_error = NULL;
_COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE); g_return_val_if_fail (glx_display->glx_context, FALSE);
if (!find_fbconfig (display, &framebuffer->config, if (!find_fbconfig (display, &framebuffer->config,
&fbconfig, &fbconfig,

View File

@ -2810,7 +2810,7 @@ meta_renderer_native_init_onscreen (CoglOnscreen *onscreen,
CoglOnscreenEGL *onscreen_egl; CoglOnscreenEGL *onscreen_egl;
MetaOnscreenNative *onscreen_native; MetaOnscreenNative *onscreen_native;
_COGL_RETURN_VAL_IF_FAIL (cogl_display_egl->egl_context, FALSE); g_return_val_if_fail (cogl_display_egl->egl_context, FALSE);
onscreen->winsys = g_slice_new0 (CoglOnscreenEGL); onscreen->winsys = g_slice_new0 (CoglOnscreenEGL);
onscreen_egl = onscreen->winsys; onscreen_egl = onscreen->winsys;