Start to reduce dependence on glib

Since we've had several developers from admirable projects say they
would like to use Cogl but would really prefer not to pull in
gobject,gmodule and glib as extra dependencies we are investigating if
we can get to the point where glib is only an optional dependency.
Actually we feel like we only make minimal use of glib anyway, so it may
well be quite straightforward to achieve this.

This adds a --disable-glib configure option that can be used to disable
features that depend on glib.

Actually --disable-glib doesn't strictly disable glib at this point
because it's more helpful if cogl continues to build as we make
incremental progress towards this.

The first use of glib that this patch tackles is the use of
g_return_val_if_fail and g_return_if_fail which have been replaced with
equivalent _COGL_RETURN_VAL_IF_FAIL and _COGL_RETURN_IF_FAIL macros.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
Robert Bragg 2011-10-13 22:34:30 +01:00
parent fd67ddd56e
commit b72f255c0a
49 changed files with 381 additions and 300 deletions

View File

@ -734,7 +734,7 @@ _cogl_atlas_texture_new_from_bitmap (CoglBitmap *bmp,
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
g_return_val_if_fail (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
bmp_width = _cogl_bitmap_get_width (bmp); bmp_width = _cogl_bitmap_get_width (bmp);
bmp_height = _cogl_bitmap_get_height (bmp); bmp_height = _cogl_bitmap_get_height (bmp);

View File

@ -29,6 +29,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-object-private.h" #include "cogl-object-private.h"
#include "cogl-journal-private.h" #include "cogl-journal-private.h"
@ -284,7 +285,7 @@ cogl_attribute_new (CoglAttributeBuffer *attribute_buffer,
gboolean gboolean
cogl_attribute_get_normalized (CoglAttribute *attribute) cogl_attribute_get_normalized (CoglAttribute *attribute)
{ {
g_return_val_if_fail (cogl_is_attribute (attribute), FALSE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), FALSE);
return attribute->normalized; return attribute->normalized;
} }
@ -305,7 +306,7 @@ void
cogl_attribute_set_normalized (CoglAttribute *attribute, cogl_attribute_set_normalized (CoglAttribute *attribute,
gboolean normalized) gboolean normalized)
{ {
g_return_if_fail (cogl_is_attribute (attribute)); _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
if (G_UNLIKELY (attribute->immutable_ref)) if (G_UNLIKELY (attribute->immutable_ref))
warn_about_midscene_changes (); warn_about_midscene_changes ();
@ -316,7 +317,7 @@ cogl_attribute_set_normalized (CoglAttribute *attribute,
CoglAttributeBuffer * CoglAttributeBuffer *
cogl_attribute_get_buffer (CoglAttribute *attribute) cogl_attribute_get_buffer (CoglAttribute *attribute)
{ {
g_return_val_if_fail (cogl_is_attribute (attribute), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL);
return attribute->attribute_buffer; return attribute->attribute_buffer;
} }
@ -325,7 +326,7 @@ void
cogl_attribute_set_buffer (CoglAttribute *attribute, cogl_attribute_set_buffer (CoglAttribute *attribute,
CoglAttributeBuffer *attribute_buffer) CoglAttributeBuffer *attribute_buffer)
{ {
g_return_if_fail (cogl_is_attribute (attribute)); _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
if (G_UNLIKELY (attribute->immutable_ref)) if (G_UNLIKELY (attribute->immutable_ref))
warn_about_midscene_changes (); warn_about_midscene_changes ();
@ -339,7 +340,7 @@ cogl_attribute_set_buffer (CoglAttribute *attribute,
CoglAttribute * CoglAttribute *
_cogl_attribute_immutable_ref (CoglAttribute *attribute) _cogl_attribute_immutable_ref (CoglAttribute *attribute)
{ {
g_return_val_if_fail (cogl_is_attribute (attribute), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL);
attribute->immutable_ref++; attribute->immutable_ref++;
_cogl_buffer_immutable_ref (COGL_BUFFER (attribute->attribute_buffer)); _cogl_buffer_immutable_ref (COGL_BUFFER (attribute->attribute_buffer));
@ -349,8 +350,8 @@ _cogl_attribute_immutable_ref (CoglAttribute *attribute)
void void
_cogl_attribute_immutable_unref (CoglAttribute *attribute) _cogl_attribute_immutable_unref (CoglAttribute *attribute)
{ {
g_return_if_fail (cogl_is_attribute (attribute)); _COGL_RETURN_IF_FAIL (cogl_is_attribute (attribute));
g_return_if_fail (attribute->immutable_ref > 0); _COGL_RETURN_IF_FAIL (attribute->immutable_ref > 0);
attribute->immutable_ref--; attribute->immutable_ref--;
_cogl_buffer_immutable_unref (COGL_BUFFER (attribute->attribute_buffer)); _cogl_buffer_immutable_unref (COGL_BUFFER (attribute->attribute_buffer));

View File

@ -26,6 +26,7 @@
#endif #endif
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-bitmap-private.h" #include "cogl-bitmap-private.h"
@ -195,7 +196,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
int *width, int *width,
int *height) int *height)
{ {
g_return_val_if_fail (filename != NULL, FALSE); _COGL_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;
@ -224,7 +225,7 @@ _cogl_bitmap_from_file (const char *filename,
int bits_per_sample; int bits_per_sample;
int n_channels; int n_channels;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, FALSE);
/* Load from file using GdkPixbuf */ /* Load from file using GdkPixbuf */
pixbuf = gdk_pixbuf_new_from_file (filename, error); pixbuf = gdk_pixbuf_new_from_file (filename, error);
@ -307,7 +308,7 @@ _cogl_bitmap_from_file (const char *filename,
int height; int height;
guint8 *pixels; guint8 *pixels;
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, FALSE);
/* Load from file using stb */ /* Load from file using stb */
pixels = stbi_load (filename, pixels = stbi_load (filename,

View File

@ -26,6 +26,7 @@
#endif #endif
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-debug.h" #include "cogl-debug.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-bitmap-private.h" #include "cogl-bitmap-private.h"
@ -310,7 +311,7 @@ cogl_bitmap_new_from_file (const char *filename,
{ {
CoglBitmap *bmp; CoglBitmap *bmp;
g_return_val_if_fail (error == NULL || *error == NULL, COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (error == NULL || *error == NULL, COGL_INVALID_HANDLE);
if ((bmp = _cogl_bitmap_from_file (filename, error)) == NULL) if ((bmp = _cogl_bitmap_from_file (filename, error)) == NULL)
{ {
@ -336,7 +337,7 @@ cogl_bitmap_new_from_buffer (CoglBuffer *buffer,
{ {
CoglBitmap *bmp; CoglBitmap *bmp;
g_return_val_if_fail (cogl_is_buffer (buffer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
bmp = _cogl_bitmap_new_from_data (NULL, /* data */ bmp = _cogl_bitmap_new_from_data (NULL, /* data */
format, format,

View File

@ -31,6 +31,7 @@
#include <string.h> #include <string.h>
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-blit.h" #include "cogl-blit.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-framebuffer-private.h" #include "cogl-framebuffer-private.h"
@ -369,7 +370,7 @@ _cogl_blit_begin (CoglBlitData *data,
_cogl_blit_modes[i].name); _cogl_blit_modes[i].name);
/* The last blit mode can't fail so this should never happen */ /* The last blit mode can't fail so this should never happen */
g_return_if_fail (i < G_N_ELEMENTS (_cogl_blit_modes)); _COGL_RETURN_IF_FAIL (i < G_N_ELEMENTS (_cogl_blit_modes));
} }
data->blit_mode = _cogl_blit_default_mode; data->blit_mode = _cogl_blit_default_mode;

View File

@ -296,8 +296,8 @@ _cogl_buffer_fini (CoglBuffer *buffer)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED)); _COGL_RETURN_IF_FAIL (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED));
g_return_if_fail (buffer->immutable_ref == 0); _COGL_RETURN_IF_FAIL (buffer->immutable_ref == 0);
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT) if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
GE( ctx, glDeleteBuffers (1, &buffer->gl_handle) ); GE( ctx, glDeleteBuffers (1, &buffer->gl_handle) );
@ -341,14 +341,14 @@ _cogl_buffer_bind (CoglBuffer *buffer, CoglBufferBindTarget target)
{ {
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (buffer != NULL, NULL); _COGL_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 */
g_return_val_if_fail (ctx->current_buffer[buffer->last_target] != buffer, _COGL_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 */
g_return_val_if_fail (ctx->current_buffer[target] == NULL, NULL); _COGL_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;
@ -368,10 +368,10 @@ _cogl_buffer_unbind (CoglBuffer *buffer)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (buffer != NULL); _COGL_RETURN_IF_FAIL (buffer != NULL);
/* the unbind should pair up with a previous bind */ /* the unbind should pair up with a previous bind */
g_return_if_fail (ctx->current_buffer[buffer->last_target] == buffer); _COGL_RETURN_IF_FAIL (ctx->current_buffer[buffer->last_target] == buffer);
if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT) if (buffer->flags & COGL_BUFFER_FLAG_BUFFER_OBJECT)
{ {
@ -430,7 +430,7 @@ cogl_buffer_map (CoglBuffer *buffer,
CoglBufferAccess access, CoglBufferAccess access,
CoglBufferMapHint hints) CoglBufferMapHint hints)
{ {
g_return_val_if_fail (cogl_is_buffer (buffer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
if (G_UNLIKELY (buffer->immutable_ref)) if (G_UNLIKELY (buffer->immutable_ref))
warn_about_midscene_changes (); warn_about_midscene_changes ();
@ -461,7 +461,7 @@ _cogl_buffer_map_for_fill_or_fallback (CoglBuffer *buffer)
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (!ctx->buffer_map_fallback_in_use, NULL); _COGL_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;
@ -490,7 +490,7 @@ _cogl_buffer_unmap_for_fill_or_fallback (CoglBuffer *buffer)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx->buffer_map_fallback_in_use); _COGL_RETURN_IF_FAIL (ctx->buffer_map_fallback_in_use);
ctx->buffer_map_fallback_in_use = FALSE; ctx->buffer_map_fallback_in_use = FALSE;
@ -511,8 +511,8 @@ cogl_buffer_set_data (CoglBuffer *buffer,
const void *data, const void *data,
gsize size) gsize size)
{ {
g_return_val_if_fail (cogl_is_buffer (buffer), FALSE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), FALSE);
g_return_val_if_fail ((offset + size) <= buffer->size, FALSE); _COGL_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 ();
@ -523,7 +523,7 @@ cogl_buffer_set_data (CoglBuffer *buffer,
CoglBuffer * CoglBuffer *
_cogl_buffer_immutable_ref (CoglBuffer *buffer) _cogl_buffer_immutable_ref (CoglBuffer *buffer)
{ {
g_return_val_if_fail (cogl_is_buffer (buffer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
buffer->immutable_ref++; buffer->immutable_ref++;
return buffer; return buffer;
@ -532,8 +532,8 @@ _cogl_buffer_immutable_ref (CoglBuffer *buffer)
void void
_cogl_buffer_immutable_unref (CoglBuffer *buffer) _cogl_buffer_immutable_unref (CoglBuffer *buffer)
{ {
g_return_if_fail (cogl_is_buffer (buffer)); _COGL_RETURN_IF_FAIL (cogl_is_buffer (buffer));
g_return_if_fail (buffer->immutable_ref > 0); _COGL_RETURN_IF_FAIL (buffer->immutable_ref > 0);
buffer->immutable_ref--; buffer->immutable_ref--;
} }

View File

@ -751,7 +751,7 @@ _cogl_clip_stack_pop (CoglClipStack *stack)
{ {
CoglClipStack *new_top; CoglClipStack *new_top;
g_return_val_if_fail (stack != NULL, NULL); _COGL_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

@ -222,7 +222,7 @@ _cogl_clip_stack_restore_real (CoglClipState *clip_state)
{ {
CoglHandle stack; CoglHandle stack;
g_return_if_fail (clip_state->stacks != NULL); _COGL_RETURN_IF_FAIL (clip_state->stacks != NULL);
stack = clip_state->stacks->data; stack = clip_state->stacks->data;

View File

@ -31,6 +31,7 @@
#include <glib.h> #include <glib.h>
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-types.h" #include "cogl-types.h"
#include "cogl-private.h" #include "cogl-private.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
@ -77,7 +78,7 @@ cogl_clutter_winsys_xlib_get_visual_info (void)
winsys = _cogl_context_get_winsys (ctx); winsys = _cogl_context_get_winsys (ctx);
/* This should only be called for xlib contexts */ /* This should only be called for xlib contexts */
g_return_val_if_fail (winsys->xlib_get_visual_info != NULL, NULL); _COGL_RETURN_VAL_IF_FAIL (winsys->xlib_get_visual_info != NULL, NULL);
return winsys->xlib_get_visual_info (); return winsys->xlib_get_visual_info ();
} }

View File

@ -28,6 +28,7 @@
#include <string.h> #include <string.h>
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-color.h" #include "cogl-color.h"
#include "cogl-fixed.h" #include "cogl-fixed.h"
@ -60,7 +61,7 @@ cogl_color_init_from_4ub (CoglColor *color,
guint8 blue, guint8 blue,
guint8 alpha) guint8 alpha)
{ {
g_return_if_fail (color != NULL); _COGL_RETURN_IF_FAIL (color != NULL);
color->red = red; color->red = red;
color->green = green; color->green = green;
@ -86,7 +87,7 @@ cogl_color_init_from_4f (CoglColor *color,
float blue, float blue,
float alpha) float alpha)
{ {
g_return_if_fail (color != NULL); _COGL_RETURN_IF_FAIL (color != NULL);
color->red = (red * 255); color->red = (red * 255);
color->green = (green * 255); color->green = (green * 255);
@ -109,7 +110,7 @@ void
cogl_color_init_from_4fv (CoglColor *color, cogl_color_init_from_4fv (CoglColor *color,
float *color_array) float *color_array)
{ {
g_return_if_fail (color != NULL); _COGL_RETURN_IF_FAIL (color != NULL);
color->red = (color_array[0] * 255); color->red = (color_array[0] * 255);
color->green = (color_array[1] * 255); color->green = (color_array[1] * 255);
@ -297,8 +298,8 @@ cogl_color_equal (gconstpointer v1, gconstpointer v2)
{ {
const guint32 *c1 = v1, *c2 = v2; const guint32 *c1 = v1, *c2 = v2;
g_return_val_if_fail (v1 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE); _COGL_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

@ -525,7 +525,7 @@ cogl_egl_context_get_egl_display (CoglContext *context)
const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context);
/* This should only be called for EGL contexts */ /* This should only be called for EGL contexts */
g_return_val_if_fail (winsys->context_egl_get_egl_display != NULL, NULL); _COGL_RETURN_VAL_IF_FAIL (winsys->context_egl_get_egl_display != NULL, NULL);
return winsys->context_egl_get_egl_display (context); return winsys->context_egl_get_egl_display (context);
} }

View File

@ -28,6 +28,7 @@
#endif #endif
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include "cogl-util.h"
#include "cogl-depth-state-private.h" #include "cogl-depth-state-private.h"
void void
@ -46,14 +47,14 @@ void
cogl_depth_state_set_test_enabled (CoglDepthState *state, cogl_depth_state_set_test_enabled (CoglDepthState *state,
gboolean enabled) gboolean enabled)
{ {
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC); _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
state->test_enabled = enabled; state->test_enabled = enabled;
} }
gboolean gboolean
cogl_depth_state_get_test_enabled (CoglDepthState *state) cogl_depth_state_get_test_enabled (CoglDepthState *state)
{ {
g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->test_enabled; return state->test_enabled;
} }
@ -61,14 +62,14 @@ void
cogl_depth_state_set_write_enabled (CoglDepthState *state, cogl_depth_state_set_write_enabled (CoglDepthState *state,
gboolean enabled) gboolean enabled)
{ {
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC); _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
state->write_enabled = enabled; state->write_enabled = enabled;
} }
gboolean gboolean
cogl_depth_state_get_write_enabled (CoglDepthState *state) cogl_depth_state_get_write_enabled (CoglDepthState *state)
{ {
g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->write_enabled; return state->write_enabled;
} }
@ -76,14 +77,14 @@ void
cogl_depth_state_set_test_function (CoglDepthState *state, cogl_depth_state_set_test_function (CoglDepthState *state,
CoglDepthTestFunction function) CoglDepthTestFunction function)
{ {
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC); _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
state->test_function = function; state->test_function = function;
} }
CoglDepthTestFunction CoglDepthTestFunction
cogl_depth_state_get_test_function (CoglDepthState *state) cogl_depth_state_get_test_function (CoglDepthState *state)
{ {
g_return_val_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); _COGL_RETURN_VAL_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC, FALSE);
return state->test_function; return state->test_function;
} }
@ -92,7 +93,7 @@ cogl_depth_state_set_range (CoglDepthState *state,
float near, float near,
float far) float far)
{ {
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC); _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
state->range_near = near; state->range_near = near;
state->range_far = far; state->range_far = far;
} }
@ -102,7 +103,7 @@ cogl_depth_state_get_range (CoglDepthState *state,
float *near_out, float *near_out,
float *far_out) float *far_out)
{ {
g_return_if_fail (state->magic == COGL_DEPTH_STATE_MAGIC); _COGL_RETURN_IF_FAIL (state->magic == COGL_DEPTH_STATE_MAGIC);
*near_out = state->range_near; *near_out = state->range_near;
*far_out = state->range_far; *far_out = state->range_far;
} }

View File

@ -150,7 +150,7 @@ void
cogl_gdl_display_set_plane (CoglDisplay *display, cogl_gdl_display_set_plane (CoglDisplay *display,
gdl_plane_id_t plane) gdl_plane_id_t plane)
{ {
g_return_if_fail (display->setup == FALSE); _COGL_RETURN_IF_FAIL (display->setup == FALSE);
display->gdl_plane = plane; display->gdl_plane = plane;
} }
@ -161,7 +161,7 @@ void
cogl_wayland_display_set_compositor_display (CoglDisplay *display, cogl_wayland_display_set_compositor_display (CoglDisplay *display,
struct wl_display *wayland_display) struct wl_display *wayland_display)
{ {
g_return_if_fail (display->setup == FALSE); _COGL_RETURN_IF_FAIL (display->setup == FALSE);
display->wayland_compositor_display = wayland_display; display->wayland_compositor_display = wayland_display;
} }

View File

@ -25,6 +25,7 @@
*/ */
#include <cogl.h> #include <cogl.h>
#include <cogl-util.h>
#include <cogl-euler.h> #include <cogl-euler.h>
#include <math.h> #include <math.h>
@ -151,8 +152,8 @@ cogl_euler_equal (gconstpointer v1, gconstpointer v2)
const CoglEuler *a = v1; const CoglEuler *a = v1;
const CoglEuler *b = v2; const CoglEuler *b = v2;
g_return_val_if_fail (v1 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
if (v1 == v2) if (v1 == v2)
return TRUE; return TRUE;

View File

@ -505,7 +505,7 @@ cogl_framebuffer_set_viewport (CoglFramebuffer *framebuffer,
float width, float width,
float height) float height)
{ {
g_return_if_fail (width > 0 && height > 0); _COGL_RETURN_IF_FAIL (width > 0 && height > 0);
if (framebuffer->viewport_x == x && if (framebuffer->viewport_x == x &&
framebuffer->viewport_y == y && framebuffer->viewport_y == y &&
@ -1146,8 +1146,8 @@ _cogl_set_framebuffers_real (CoglFramebuffer *draw_buffer,
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx != NULL); _COGL_RETURN_IF_FAIL (ctx != NULL);
g_return_if_fail (draw_buffer && read_buffer ? _COGL_RETURN_IF_FAIL (draw_buffer && read_buffer ?
draw_buffer->context == read_buffer->context : TRUE); draw_buffer->context == read_buffer->context : TRUE);
entry = ctx->framebuffer_stack->data; entry = ctx->framebuffer_stack->data;
@ -1178,8 +1178,8 @@ _cogl_set_framebuffers (CoglFramebuffer *draw_buffer,
CoglFramebuffer *current_draw_buffer; CoglFramebuffer *current_draw_buffer;
CoglFramebuffer *current_read_buffer; CoglFramebuffer *current_read_buffer;
g_return_if_fail (_cogl_is_framebuffer (draw_buffer)); _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (draw_buffer));
g_return_if_fail (_cogl_is_framebuffer (read_buffer)); _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (read_buffer));
current_draw_buffer = cogl_get_draw_framebuffer (); current_draw_buffer = cogl_get_draw_framebuffer ();
current_read_buffer = _cogl_get_read_framebuffer (); current_read_buffer = _cogl_get_read_framebuffer ();
@ -1257,14 +1257,14 @@ _cogl_push_framebuffers (CoglFramebuffer *draw_buffer,
CoglContext *ctx; CoglContext *ctx;
CoglFramebuffer *old_draw_buffer, *old_read_buffer; CoglFramebuffer *old_draw_buffer, *old_read_buffer;
g_return_if_fail (_cogl_is_framebuffer (draw_buffer)); _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (draw_buffer));
g_return_if_fail (_cogl_is_framebuffer (read_buffer)); _COGL_RETURN_IF_FAIL (_cogl_is_framebuffer (read_buffer));
ctx = draw_buffer->context; ctx = draw_buffer->context;
g_return_if_fail (ctx != NULL); _COGL_RETURN_IF_FAIL (ctx != NULL);
g_return_if_fail (draw_buffer->context == read_buffer->context); _COGL_RETURN_IF_FAIL (draw_buffer->context == read_buffer->context);
g_return_if_fail (ctx->framebuffer_stack != NULL); _COGL_RETURN_IF_FAIL (ctx->framebuffer_stack != NULL);
/* Copy the top of the stack so that when we call cogl_set_framebuffer /* Copy the top of the stack so that when we call cogl_set_framebuffer
it will still know what the old framebuffer was */ it will still know what the old framebuffer was */
@ -1380,10 +1380,10 @@ _cogl_framebuffer_flush_state (CoglFramebuffer *draw_buffer,
/* NB: Currently we only take advantage of binding separate /* NB: Currently we only take advantage of binding separate
* read/write buffers for offscreen framebuffer blit * read/write buffers for offscreen framebuffer blit
* purposes. */ * purposes. */
g_return_if_fail (ctx->private_feature_flags & _COGL_RETURN_IF_FAIL (ctx->private_feature_flags &
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT); COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT);
g_return_if_fail (draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN); _COGL_RETURN_IF_FAIL (draw_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN);
g_return_if_fail (read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN); _COGL_RETURN_IF_FAIL (read_buffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN);
bind_gl_framebuffer (ctx, GL_DRAW_FRAMEBUFFER, draw_buffer); bind_gl_framebuffer (ctx, GL_DRAW_FRAMEBUFFER, draw_buffer);
bind_gl_framebuffer (ctx, GL_READ_FRAMEBUFFER, read_buffer); bind_gl_framebuffer (ctx, GL_READ_FRAMEBUFFER, read_buffer);
@ -1530,7 +1530,7 @@ void
cogl_framebuffer_set_samples_per_pixel (CoglFramebuffer *framebuffer, cogl_framebuffer_set_samples_per_pixel (CoglFramebuffer *framebuffer,
int samples_per_pixel) int samples_per_pixel)
{ {
g_return_if_fail (!framebuffer->allocated); _COGL_RETURN_IF_FAIL (!framebuffer->allocated);
framebuffer->config.samples_per_pixel = samples_per_pixel; framebuffer->config.samples_per_pixel = samples_per_pixel;
} }
@ -1584,7 +1584,7 @@ cogl_framebuffer_resolve_samples_region (CoglFramebuffer *framebuffer,
CoglContext * CoglContext *
cogl_framebuffer_get_context (CoglFramebuffer *framebuffer) cogl_framebuffer_get_context (CoglFramebuffer *framebuffer)
{ {
g_return_val_if_fail (framebuffer != NULL, NULL); _COGL_RETURN_VAL_IF_FAIL (framebuffer != NULL, NULL);
return framebuffer->context; return framebuffer->context;
} }
@ -1670,16 +1670,16 @@ _cogl_blit_framebuffer (unsigned int src_x,
read_buffer = _cogl_get_read_framebuffer (); read_buffer = _cogl_get_read_framebuffer ();
ctx = draw_buffer->context; ctx = draw_buffer->context;
g_return_if_fail (ctx->private_feature_flags & _COGL_RETURN_IF_FAIL (ctx->private_feature_flags &
COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT); COGL_PRIVATE_FEATURE_OFFSCREEN_BLIT);
/* We can only support blitting between offscreen buffers because /* We can only support blitting between offscreen buffers because
otherwise we would need to mirror the image and GLES2.0 doesn't otherwise we would need to mirror the image and GLES2.0 doesn't
support this */ support this */
g_return_if_fail (cogl_is_offscreen (draw_buffer)); _COGL_RETURN_IF_FAIL (cogl_is_offscreen (draw_buffer));
g_return_if_fail (cogl_is_offscreen (read_buffer)); _COGL_RETURN_IF_FAIL (cogl_is_offscreen (read_buffer));
/* The buffers must be the same format */ /* The buffers must be the same format */
g_return_if_fail (draw_buffer->format == read_buffer->format); _COGL_RETURN_IF_FAIL (draw_buffer->format == read_buffer->format);
/* Make sure the current framebuffers are bound. We explicitly avoid /* Make sure the current framebuffers are bound. We explicitly avoid
flushing the clip state so we can bind our own empty state */ flushing the clip state so we can bind our own empty state */
@ -1741,7 +1741,7 @@ void
cogl_framebuffer_discard_buffers (CoglFramebuffer *framebuffer, cogl_framebuffer_discard_buffers (CoglFramebuffer *framebuffer,
unsigned long buffers) unsigned long buffers)
{ {
g_return_if_fail (buffers & COGL_BUFFER_BIT_COLOR); _COGL_RETURN_IF_FAIL (buffers & COGL_BUFFER_BIT_COLOR);
_cogl_framebuffer_discard_buffers_real (framebuffer, buffers); _cogl_framebuffer_discard_buffers_real (framebuffer, buffers);
} }

View File

@ -30,6 +30,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-object-private.h" #include "cogl-object-private.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-indices.h" #include "cogl-indices.h"
@ -104,7 +105,7 @@ cogl_indices_get_buffer (CoglIndices *indices)
CoglIndicesType CoglIndicesType
cogl_indices_get_type (CoglIndices *indices) cogl_indices_get_type (CoglIndices *indices)
{ {
g_return_val_if_fail (cogl_is_indices (indices), _COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices),
COGL_INDICES_TYPE_UNSIGNED_BYTE); COGL_INDICES_TYPE_UNSIGNED_BYTE);
return indices->type; return indices->type;
} }
@ -112,7 +113,7 @@ cogl_indices_get_type (CoglIndices *indices)
gsize gsize
cogl_indices_get_offset (CoglIndices *indices) cogl_indices_get_offset (CoglIndices *indices)
{ {
g_return_val_if_fail (cogl_is_indices (indices), 0); _COGL_RETURN_VAL_IF_FAIL (cogl_is_indices (indices), 0);
return indices->offset; return indices->offset;
} }
@ -133,7 +134,7 @@ void
cogl_indices_set_offset (CoglIndices *indices, cogl_indices_set_offset (CoglIndices *indices,
gsize offset) gsize offset)
{ {
g_return_if_fail (cogl_is_indices (indices)); _COGL_RETURN_IF_FAIL (cogl_is_indices (indices));
if (G_UNLIKELY (indices->immutable_ref)) if (G_UNLIKELY (indices->immutable_ref))
warn_about_midscene_changes (); warn_about_midscene_changes ();
@ -151,7 +152,7 @@ _cogl_indices_free (CoglIndices *indices)
CoglIndices * CoglIndices *
_cogl_indices_immutable_ref (CoglIndices *indices) _cogl_indices_immutable_ref (CoglIndices *indices)
{ {
g_return_val_if_fail (cogl_is_indices (indices), NULL); _COGL_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));
@ -161,8 +162,8 @@ _cogl_indices_immutable_ref (CoglIndices *indices)
void void
_cogl_indices_immutable_unref (CoglIndices *indices) _cogl_indices_immutable_unref (CoglIndices *indices)
{ {
g_return_if_fail (cogl_is_indices (indices)); _COGL_RETURN_IF_FAIL (cogl_is_indices (indices));
g_return_if_fail (indices->immutable_ref > 0); _COGL_RETURN_IF_FAIL (indices->immutable_ref > 0);
indices->immutable_ref--; indices->immutable_ref--;
_cogl_buffer_immutable_unref (COGL_BUFFER (indices->buffer)); _cogl_buffer_immutable_unref (COGL_BUFFER (indices->buffer));

View File

@ -66,6 +66,7 @@
#endif #endif
#include <cogl.h> #include <cogl.h>
#include <cogl-util.h>
#include <cogl-debug.h> #include <cogl-debug.h>
#include <cogl-quaternion.h> #include <cogl-quaternion.h>
#include <cogl-quaternion-private.h> #include <cogl-quaternion-private.h>
@ -375,7 +376,7 @@ _cogl_matrix_print (const CoglMatrix *matrix)
{ {
if (!(matrix->flags & MAT_DIRTY_TYPE)) if (!(matrix->flags & MAT_DIRTY_TYPE))
{ {
g_return_if_fail (matrix->type < COGL_MATRIX_N_TYPES); _COGL_RETURN_IF_FAIL (matrix->type < COGL_MATRIX_N_TYPES);
g_print ("Matrix type: %s, flags: %x\n", g_print ("Matrix type: %s, flags: %x\n",
types[matrix->type], (int)matrix->flags); types[matrix->type], (int)matrix->flags);
} }
@ -1777,8 +1778,8 @@ cogl_matrix_equal (gconstpointer v1, gconstpointer v2)
const CoglMatrix *a = v1; const CoglMatrix *a = v1;
const CoglMatrix *b = v2; const CoglMatrix *b = v2;
g_return_val_if_fail (v1 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE); _COGL_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
@ -2002,7 +2003,7 @@ cogl_matrix_transform_points (const CoglMatrix *matrix,
int n_points) int n_points)
{ {
/* The results of transforming always have three components... */ /* The results of transforming always have three components... */
g_return_if_fail (stride_out >= sizeof (Point3f)); _COGL_RETURN_IF_FAIL (stride_out >= sizeof (Point3f));
if (n_components == 2) if (n_components == 2)
_cogl_matrix_transform_points_f2 (matrix, _cogl_matrix_transform_points_f2 (matrix,
@ -2011,7 +2012,7 @@ cogl_matrix_transform_points (const CoglMatrix *matrix,
n_points); n_points);
else else
{ {
g_return_if_fail (n_components == 3); _COGL_RETURN_IF_FAIL (n_components == 3);
_cogl_matrix_transform_points_f3 (matrix, _cogl_matrix_transform_points_f3 (matrix,
stride_in, points_in, stride_in, points_in,
@ -2041,7 +2042,7 @@ cogl_matrix_project_points (const CoglMatrix *matrix,
n_points); n_points);
else else
{ {
g_return_if_fail (n_components == 4); _COGL_RETURN_IF_FAIL (n_components == 4);
_cogl_matrix_project_points_f4 (matrix, _cogl_matrix_project_points_f4 (matrix,
stride_in, points_in, stride_in, points_in,

View File

@ -29,6 +29,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-node-private.h" #include "cogl-node-private.h"
void void
@ -79,7 +80,7 @@ _cogl_pipeline_node_unparent_real (CoglNode *node)
if (parent == NULL) if (parent == NULL)
return; return;
g_return_if_fail (!COGL_LIST_EMPTY (&parent->children)); _COGL_RETURN_IF_FAIL (!COGL_LIST_EMPTY (&parent->children));
COGL_LIST_REMOVE (node, list_node); COGL_LIST_REMOVE (node, list_node);

View File

@ -30,6 +30,7 @@
#include <glib.h> #include <glib.h>
#include <string.h> #include <string.h>
#include "cogl-util.h"
#include "cogl-types.h" #include "cogl-types.h"
#include "cogl-object-private.h" #include "cogl-object-private.h"
@ -38,7 +39,7 @@ cogl_object_ref (void *object)
{ {
CoglObject *obj = object; CoglObject *obj = object;
g_return_val_if_fail (object != NULL, NULL); _COGL_RETURN_VAL_IF_FAIL (object != NULL, NULL);
obj->ref_count++; obj->ref_count++;
return object; return object;
@ -55,8 +56,8 @@ cogl_object_unref (void *object)
{ {
CoglObject *obj = object; CoglObject *obj = object;
g_return_if_fail (object != NULL); _COGL_RETURN_IF_FAIL (object != NULL);
g_return_if_fail (obj->ref_count > 0); _COGL_RETURN_IF_FAIL (obj->ref_count > 0);
if (--obj->ref_count < 1) if (--obj->ref_count < 1)
{ {

View File

@ -25,6 +25,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-onscreen-private.h" #include "cogl-onscreen-private.h"
#include "cogl-framebuffer-private.h" #include "cogl-framebuffer-private.h"
#include "cogl-onscreen-template-private.h" #include "cogl-onscreen-template-private.h"
@ -112,7 +113,7 @@ _cogl_onscreen_free (CoglOnscreen *onscreen)
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
winsys->onscreen_deinit (onscreen); winsys->onscreen_deinit (onscreen);
g_return_if_fail (onscreen->winsys == NULL); _COGL_RETURN_IF_FAIL (onscreen->winsys == NULL);
/* Chain up to parent */ /* Chain up to parent */
_cogl_framebuffer_free (framebuffer); _cogl_framebuffer_free (framebuffer);
@ -125,7 +126,7 @@ cogl_framebuffer_swap_buffers (CoglFramebuffer *framebuffer)
{ {
const CoglWinsysVtable *winsys; const CoglWinsysVtable *winsys;
g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); _COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
/* FIXME: we shouldn't need to flush *all* journals here! */ /* FIXME: we shouldn't need to flush *all* journals here! */
cogl_flush (); cogl_flush ();
@ -144,7 +145,7 @@ cogl_framebuffer_swap_region (CoglFramebuffer *framebuffer,
{ {
const CoglWinsysVtable *winsys; const CoglWinsysVtable *winsys;
g_return_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN); _COGL_RETURN_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN);
/* FIXME: we shouldn't need to flush *all* journals here! */ /* FIXME: we shouldn't need to flush *all* journals here! */
cogl_flush (); cogl_flush ();
@ -153,7 +154,7 @@ cogl_framebuffer_swap_region (CoglFramebuffer *framebuffer,
/* This should only be called if the winsys advertises /* This should only be called if the winsys advertises
COGL_WINSYS_FEATURE_SWAP_REGION */ COGL_WINSYS_FEATURE_SWAP_REGION */
g_return_if_fail (winsys->onscreen_swap_region != NULL); _COGL_RETURN_IF_FAIL (winsys->onscreen_swap_region != NULL);
winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer), winsys->onscreen_swap_region (COGL_ONSCREEN (framebuffer),
rectangles, rectangles,
@ -174,7 +175,7 @@ cogl_x11_onscreen_set_foreign_window_xid (CoglOnscreen *onscreen,
{ {
/* We don't wan't applications to get away with being lazy here and not /* We don't wan't applications to get away with being lazy here and not
* passing an update callback... */ * passing an update callback... */
g_return_if_fail (update); _COGL_RETURN_IF_FAIL (update);
onscreen->foreign_xid = xid; onscreen->foreign_xid = xid;
onscreen->foreign_update_mask_callback = update; onscreen->foreign_update_mask_callback = update;
@ -193,7 +194,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 */
g_return_val_if_fail (winsys->onscreen_x11_get_window_xid != NULL, 0); _COGL_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);
} }
@ -208,7 +209,7 @@ cogl_x11_onscreen_get_visual_xid (CoglOnscreen *onscreen)
guint32 id; guint32 id;
/* This should only be called for xlib based onscreens */ /* This should only be called for xlib based onscreens */
g_return_val_if_fail (winsys->xlib_get_visual_info != NULL, 0); _COGL_RETURN_VAL_IF_FAIL (winsys->xlib_get_visual_info != NULL, 0);
visinfo = winsys->xlib_get_visual_info (); visinfo = winsys->xlib_get_visual_info ();
id = (guint32)visinfo->visualid; id = (guint32)visinfo->visualid;
@ -239,7 +240,7 @@ cogl_win32_onscreen_get_window (CoglOnscreen *onscreen)
_cogl_framebuffer_get_winsys (framebuffer); _cogl_framebuffer_get_winsys (framebuffer);
/* This should only be called for win32 onscreens */ /* This should only be called for win32 onscreens */
g_return_val_if_fail (winsys->onscreen_win32_get_window != NULL, 0); _COGL_RETURN_VAL_IF_FAIL (winsys->onscreen_win32_get_window != NULL, 0);
return winsys->onscreen_win32_get_window (onscreen); return winsys->onscreen_win32_get_window (onscreen);
} }
@ -256,11 +257,11 @@ cogl_framebuffer_add_swap_buffers_callback (CoglFramebuffer *framebuffer,
const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer);
/* Should this just be cogl_onscreen API instead? */ /* Should this just be cogl_onscreen API instead? */
g_return_val_if_fail (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0); _COGL_RETURN_VAL_IF_FAIL (framebuffer->type == COGL_FRAMEBUFFER_TYPE_ONSCREEN, 0);
/* This should only be called when /* This should only be called when
COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT is advertised */ COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT is advertised */
g_return_val_if_fail (winsys->onscreen_add_swap_buffers_callback != NULL, 0); _COGL_RETURN_VAL_IF_FAIL (winsys->onscreen_add_swap_buffers_callback != NULL, 0);
return winsys->onscreen_add_swap_buffers_callback (onscreen, return winsys->onscreen_add_swap_buffers_callback (onscreen,
callback, callback,
@ -276,7 +277,7 @@ cogl_framebuffer_remove_swap_buffers_callback (CoglFramebuffer *framebuffer,
/* This should only be called when /* This should only be called when
COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT is advertised */ COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT is advertised */
g_return_if_fail (winsys->onscreen_remove_swap_buffers_callback != NULL); _COGL_RETURN_IF_FAIL (winsys->onscreen_remove_swap_buffers_callback != NULL);
winsys->onscreen_remove_swap_buffers_callback (onscreen, id); winsys->onscreen_remove_swap_buffers_callback (onscreen, id);
} }

View File

@ -28,6 +28,7 @@
#endif #endif
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl2-path.h" #include "cogl2-path.h"
@ -292,7 +293,7 @@ cogl_set_path (CoglPath *path)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
/* Reference the new object first in case it is the same as the old /* Reference the new object first in case it is the same as the old
object */ object */

View File

@ -288,7 +288,7 @@ get_texture_target (CoglTexture *texture)
GLuint ignore_handle; GLuint ignore_handle;
GLenum gl_target; GLenum gl_target;
g_return_val_if_fail (texture, 0); _COGL_RETURN_VAL_IF_FAIL (texture, 0);
cogl_texture_get_gl_texture (texture, &ignore_handle, &gl_target); cogl_texture_get_gl_texture (texture, &ignore_handle, &gl_target);
@ -395,7 +395,7 @@ public_to_internal_wrap_mode (CoglPipelineWrapMode mode)
static CoglPipelineWrapMode static CoglPipelineWrapMode
internal_to_public_wrap_mode (CoglPipelineWrapModeInternal internal_mode) internal_to_public_wrap_mode (CoglPipelineWrapModeInternal internal_mode)
{ {
g_return_val_if_fail (internal_mode != _COGL_RETURN_VAL_IF_FAIL (internal_mode !=
COGL_PIPELINE_WRAP_MODE_INTERNAL_CLAMP_TO_BORDER, COGL_PIPELINE_WRAP_MODE_INTERNAL_CLAMP_TO_BORDER,
COGL_PIPELINE_WRAP_MODE_AUTOMATIC); COGL_PIPELINE_WRAP_MODE_AUTOMATIC);
return (CoglPipelineWrapMode)internal_mode; return (CoglPipelineWrapMode)internal_mode;
@ -412,7 +412,7 @@ cogl_pipeline_set_layer_wrap_mode_s (CoglPipeline *pipeline,
CoglPipelineWrapModeInternal internal_mode = CoglPipelineWrapModeInternal internal_mode =
public_to_internal_wrap_mode (mode); public_to_internal_wrap_mode (mode);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -443,7 +443,7 @@ cogl_pipeline_set_layer_wrap_mode_t (CoglPipeline *pipeline,
CoglPipelineWrapModeInternal internal_mode = CoglPipelineWrapModeInternal internal_mode =
public_to_internal_wrap_mode (mode); public_to_internal_wrap_mode (mode);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -486,7 +486,7 @@ cogl_pipeline_set_layer_wrap_mode_p (CoglPipeline *pipeline,
CoglPipelineWrapModeInternal internal_mode = CoglPipelineWrapModeInternal internal_mode =
public_to_internal_wrap_mode (mode); public_to_internal_wrap_mode (mode);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -517,7 +517,7 @@ cogl_pipeline_set_layer_wrap_mode (CoglPipeline *pipeline,
CoglPipelineWrapModeInternal internal_mode = CoglPipelineWrapModeInternal internal_mode =
public_to_internal_wrap_mode (mode); public_to_internal_wrap_mode (mode);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -546,7 +546,7 @@ _cogl_pipeline_layer_get_wrap_mode_s (CoglPipelineLayer *layer)
CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES; CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), FALSE); _COGL_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 */
@ -560,7 +560,7 @@ cogl_pipeline_get_layer_wrap_mode_s (CoglPipeline *pipeline, int layer_index)
{ {
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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.
@ -581,7 +581,7 @@ _cogl_pipeline_layer_get_wrap_mode_t (CoglPipelineLayer *layer)
CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES; CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_WRAP_MODES;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), FALSE); _COGL_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 */
@ -595,7 +595,7 @@ cogl_pipeline_get_layer_wrap_mode_t (CoglPipeline *pipeline, int layer_index)
{ {
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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.
@ -624,7 +624,7 @@ cogl_pipeline_get_layer_wrap_mode_p (CoglPipeline *pipeline, int layer_index)
{ {
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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.
@ -666,7 +666,7 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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 */
@ -758,7 +758,7 @@ cogl_pipeline_get_layer_point_sprite_coords_enabled (CoglPipeline *pipeline,
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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.
@ -1009,7 +1009,7 @@ cogl_pipeline_set_layer_combine (CoglPipeline *pipeline,
GError *internal_error = NULL; GError *internal_error = NULL;
int count; int count;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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.
@ -1119,7 +1119,7 @@ cogl_pipeline_set_layer_combine_constant (CoglPipeline *pipeline,
CoglPipelineLayer *new; CoglPipelineLayer *new;
float color_as_floats[4]; float color_as_floats[4];
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -1202,7 +1202,7 @@ _cogl_pipeline_get_layer_combine_constant (CoglPipeline *pipeline,
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -1229,7 +1229,7 @@ _cogl_pipeline_get_layer_matrix (CoglPipeline *pipeline, int layer_index)
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL); _COGL_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);
@ -1247,7 +1247,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
CoglPipelineLayer *new; CoglPipelineLayer *new;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.
@ -1311,7 +1311,7 @@ cogl_pipeline_set_layer_matrix (CoglPipeline *pipeline,
CoglTexture * CoglTexture *
_cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer) _cogl_pipeline_layer_get_texture (CoglPipelineLayer *layer)
{ {
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), NULL); _COGL_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);
} }
@ -1355,7 +1355,7 @@ _cogl_pipeline_get_layer_filters (CoglPipeline *pipeline,
CoglPipelineLayer *layer; CoglPipelineLayer *layer;
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
layer = _cogl_pipeline_get_layer (pipeline, layer_index); layer = _cogl_pipeline_get_layer (pipeline, layer_index);
@ -1396,7 +1396,7 @@ _cogl_pipeline_layer_get_min_filter (CoglPipelineLayer *layer)
{ {
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), 0); _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0);
authority = authority =
_cogl_pipeline_layer_get_authority (layer, _cogl_pipeline_layer_get_authority (layer,
@ -1410,7 +1410,7 @@ _cogl_pipeline_layer_get_mag_filter (CoglPipelineLayer *layer)
{ {
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
g_return_val_if_fail (_cogl_is_pipeline_layer (layer), 0); _COGL_RETURN_VAL_IF_FAIL (_cogl_is_pipeline_layer (layer), 0);
authority = authority =
_cogl_pipeline_layer_get_authority (layer, _cogl_pipeline_layer_get_authority (layer,
@ -1430,7 +1430,7 @@ cogl_pipeline_set_layer_filters (CoglPipeline *pipeline,
CoglPipelineLayer *authority; CoglPipelineLayer *authority;
CoglPipelineLayer *new; CoglPipelineLayer *new;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
/* 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.

View File

@ -29,6 +29,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-texture-private.h" #include "cogl-texture-private.h"
@ -235,7 +236,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 */
g_return_val_if_fail (required_owner != NULL, layer); _COGL_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

@ -29,6 +29,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-pipeline-private.h" #include "cogl-pipeline-private.h"
#include "cogl-pipeline-opengl-private.h" #include "cogl-pipeline-opengl-private.h"
@ -168,8 +169,8 @@ _cogl_pipeline_progend_glsl_get_position_attribute (CoglPipeline *pipeline)
_COGL_GET_CONTEXT (ctx, -1); _COGL_GET_CONTEXT (ctx, -1);
g_return_val_if_fail (program_state != NULL, -1); _COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1);
g_return_val_if_fail (program_state->program != 0, -1); _COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1);
if (program_state->position_attribute_location == ATTRIBUTE_LOCATION_UNKNOWN) if (program_state->position_attribute_location == ATTRIBUTE_LOCATION_UNKNOWN)
GE_RET( program_state->position_attribute_location, GE_RET( program_state->position_attribute_location,
@ -186,8 +187,8 @@ _cogl_pipeline_progend_glsl_get_color_attribute (CoglPipeline *pipeline)
_COGL_GET_CONTEXT (ctx, -1); _COGL_GET_CONTEXT (ctx, -1);
g_return_val_if_fail (program_state != NULL, -1); _COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1);
g_return_val_if_fail (program_state->program != 0, -1); _COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1);
if (program_state->color_attribute_location == ATTRIBUTE_LOCATION_UNKNOWN) if (program_state->color_attribute_location == ATTRIBUTE_LOCATION_UNKNOWN)
GE_RET( program_state->color_attribute_location, GE_RET( program_state->color_attribute_location,
@ -204,8 +205,8 @@ _cogl_pipeline_progend_glsl_get_normal_attribute (CoglPipeline *pipeline)
_COGL_GET_CONTEXT (ctx, -1); _COGL_GET_CONTEXT (ctx, -1);
g_return_val_if_fail (program_state != NULL, -1); _COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1);
g_return_val_if_fail (program_state->program != 0, -1); _COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1);
if (program_state->normal_attribute_location == ATTRIBUTE_LOCATION_UNKNOWN) if (program_state->normal_attribute_location == ATTRIBUTE_LOCATION_UNKNOWN)
GE_RET( program_state->normal_attribute_location, GE_RET( program_state->normal_attribute_location,
@ -223,8 +224,8 @@ _cogl_pipeline_progend_glsl_get_tex_coord_attribute (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, -1); _COGL_GET_CONTEXT (ctx, -1);
g_return_val_if_fail (program_state != NULL, -1); _COGL_RETURN_VAL_IF_FAIL (program_state != NULL, -1);
g_return_val_if_fail (program_state->program != 0, -1); _COGL_RETURN_VAL_IF_FAIL (program_state->program != 0, -1);
if (unit == 0) if (unit == 0)
{ {
@ -921,7 +922,7 @@ _cogl_pipeline_progend_glsl_pre_paint (CoglPipeline *pipeline)
/* We only need to update the matrices if we're using the the GLSL /* We only need to update the matrices if we're using the the GLSL
vertend, but this is a requirement on GLES2 anyway */ vertend, but this is a requirement on GLES2 anyway */
g_return_if_fail (pipeline->vertend == COGL_PIPELINE_VERTEND_GLSL); _COGL_RETURN_IF_FAIL (pipeline->vertend == COGL_PIPELINE_VERTEND_GLSL);
program_state = get_program_state (pipeline); program_state = get_program_state (pipeline);

View File

@ -47,7 +47,7 @@ _cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL); _COGL_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);
@ -244,7 +244,7 @@ cogl_pipeline_get_color (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_COLOR);
@ -270,7 +270,7 @@ cogl_pipeline_set_color (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_COLOR; CoglPipelineState state = COGL_PIPELINE_STATE_COLOR;
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -321,7 +321,7 @@ _cogl_pipeline_get_blend_enabled (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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);
@ -342,8 +342,8 @@ _cogl_pipeline_set_blend_enabled (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE; CoglPipelineState state = COGL_PIPELINE_STATE_BLEND_ENABLE;
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (enable > 1 && _COGL_RETURN_IF_FAIL (enable > 1 &&
"don't pass TRUE or FALSE to _set_blend_enabled!"); "don't pass TRUE or FALSE to _set_blend_enabled!");
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -372,7 +372,7 @@ cogl_pipeline_get_ambient (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@ -389,7 +389,7 @@ cogl_pipeline_set_ambient (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineLightingState *lighting_state; CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -422,7 +422,7 @@ cogl_pipeline_get_diffuse (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@ -439,7 +439,7 @@ cogl_pipeline_set_diffuse (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineLightingState *lighting_state; CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -481,7 +481,7 @@ cogl_pipeline_get_specular (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@ -497,7 +497,7 @@ cogl_pipeline_set_specular (CoglPipeline *pipeline, const CoglColor *specular)
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state; CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -529,7 +529,7 @@ cogl_pipeline_get_shininess (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0); _COGL_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);
@ -545,7 +545,7 @@ cogl_pipeline_set_shininess (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state; CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
if (shininess < 0.0) if (shininess < 0.0)
{ {
@ -581,7 +581,7 @@ cogl_pipeline_get_emission (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LIGHTING);
@ -597,7 +597,7 @@ cogl_pipeline_set_emission (CoglPipeline *pipeline, const CoglColor *emission)
CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING; CoglPipelineState state = COGL_PIPELINE_STATE_LIGHTING;
CoglPipelineLightingState *lighting_state; CoglPipelineLightingState *lighting_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -632,7 +632,7 @@ _cogl_pipeline_set_alpha_test_function (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineAlphaFuncState *alpha_state; CoglPipelineAlphaFuncState *alpha_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -662,7 +662,7 @@ _cogl_pipeline_set_alpha_test_function_reference (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineAlphaFuncState *alpha_state; CoglPipelineAlphaFuncState *alpha_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -699,7 +699,7 @@ cogl_pipeline_get_alpha_test_function (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0); _COGL_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);
@ -712,7 +712,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0.0f); _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0.0f);
authority = authority =
_cogl_pipeline_get_authority (pipeline, _cogl_pipeline_get_authority (pipeline,
@ -828,7 +828,7 @@ cogl_pipeline_set_blend (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
count = count =
_cogl_blend_string_compile (blend_description, _cogl_blend_string_compile (blend_description,
@ -922,7 +922,7 @@ cogl_pipeline_set_blend_constant (CoglPipeline *pipeline,
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
if (ctx->driver == COGL_DRIVER_GLES1) if (ctx->driver == COGL_DRIVER_GLES1)
return; return;
@ -962,7 +962,7 @@ cogl_pipeline_get_user_program (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), COGL_INVALID_HANDLE); _COGL_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);
@ -983,7 +983,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_USER_SHADER; CoglPipelineState state = COGL_PIPELINE_STATE_USER_SHADER;
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1046,8 +1046,8 @@ cogl_pipeline_set_depth_state (CoglPipeline *pipeline,
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
g_return_val_if_fail (depth_state->magic == COGL_DEPTH_STATE_MAGIC, FALSE); _COGL_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);
@ -1091,7 +1091,7 @@ cogl_pipeline_get_depth_state (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_DEPTH); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_DEPTH);
@ -1103,7 +1103,7 @@ cogl_pipeline_get_color_mask (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0); _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LOGIC_OPS);
@ -1119,7 +1119,7 @@ cogl_pipeline_set_color_mask (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineLogicOpsState *logic_ops_state; CoglPipelineLogicOpsState *logic_ops_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1149,7 +1149,7 @@ _cogl_pipeline_set_fog_state (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineFogState *current_fog_state; CoglPipelineFogState *current_fog_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1185,7 +1185,7 @@ _cogl_pipeline_set_cull_face_state (CoglPipeline *pipeline,
CoglPipeline *authority; CoglPipeline *authority;
CoglPipelineCullFaceState *current_cull_face_state; CoglPipelineCullFaceState *current_cull_face_state;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);
@ -1214,7 +1214,7 @@ _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;
g_return_val_if_fail (cogl_is_pipeline (pipeline), _COGL_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);
@ -1227,7 +1227,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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);
@ -1242,7 +1242,7 @@ cogl_pipeline_set_point_size (CoglPipeline *pipeline,
CoglPipelineState state = COGL_PIPELINE_STATE_POINT_SIZE; CoglPipelineState state = COGL_PIPELINE_STATE_POINT_SIZE;
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = _cogl_pipeline_get_authority (pipeline, state); authority = _cogl_pipeline_get_authority (pipeline, state);

View File

@ -297,7 +297,7 @@ _cogl_pipeline_promote_weak_ancestors (CoglPipeline *strong)
{ {
CoglNode *n; CoglNode *n;
g_return_if_fail (!strong->is_weak); _COGL_RETURN_IF_FAIL (!strong->is_weak);
/* If the parent of strong is weak, then we want to promote it by /* If the parent of strong is weak, then we want to promote it by
taking a reference on strong's grandparent. We don't need to take taking a reference on strong's grandparent. We don't need to take
@ -319,7 +319,7 @@ _cogl_pipeline_revert_weak_ancestors (CoglPipeline *strong)
{ {
CoglNode *n; CoglNode *n;
g_return_if_fail (!strong->is_weak); _COGL_RETURN_IF_FAIL (!strong->is_weak);
/* This reverts the effect of calling /* This reverts the effect of calling
_cogl_pipeline_promote_weak_ancestors */ _cogl_pipeline_promote_weak_ancestors */
@ -478,7 +478,7 @@ _cogl_pipeline_free (CoglPipeline *pipeline)
gboolean gboolean
_cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline) _cogl_pipeline_get_real_blend_enabled (CoglPipeline *pipeline)
{ {
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), FALSE);
return pipeline->real_blend_enable; return pipeline->real_blend_enable;
} }
@ -583,7 +583,7 @@ _cogl_pipeline_foreach_layer_internal (CoglPipeline *pipeline,
for (i = 0, cont = TRUE; i < n_layers && cont == TRUE; i++) for (i = 0, cont = TRUE; i < n_layers && cont == TRUE; i++)
{ {
g_return_if_fail (authority->layers_cache_dirty == FALSE); _COGL_RETURN_IF_FAIL (authority->layers_cache_dirty == FALSE);
cont = callback (authority->layers_cache[i], user_data); cont = callback (authority->layers_cache[i], user_data);
} }
} }
@ -945,7 +945,7 @@ _cogl_pipeline_init_multi_property_sparse_state (CoglPipeline *pipeline,
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_if_fail (change & COGL_PIPELINE_STATE_ALL_SPARSE); _COGL_RETURN_IF_FAIL (change & COGL_PIPELINE_STATE_ALL_SPARSE);
if (!(change & COGL_PIPELINE_STATE_MULTI_PROPERTY)) if (!(change & COGL_PIPELINE_STATE_MULTI_PROPERTY))
return; return;
@ -1285,7 +1285,7 @@ _cogl_pipeline_add_layer_difference (CoglPipeline *pipeline,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
gboolean inc_n_layers) gboolean inc_n_layers)
{ {
g_return_if_fail (layer->owner == NULL); _COGL_RETURN_IF_FAIL (layer->owner == NULL);
layer->owner = pipeline; layer->owner = pipeline;
cogl_object_ref (layer); cogl_object_ref (layer);
@ -1319,7 +1319,7 @@ _cogl_pipeline_remove_layer_difference (CoglPipeline *pipeline,
CoglPipelineLayer *layer, CoglPipelineLayer *layer,
gboolean dec_n_layers) gboolean dec_n_layers)
{ {
g_return_if_fail (layer->owner == pipeline); _COGL_RETURN_IF_FAIL (layer->owner == pipeline);
/* - Flush journal primitives referencing the current state. /* - Flush journal primitives referencing the current state.
* - Make sure the pipeline has no dependants so it may be modified. * - Make sure the pipeline has no dependants so it may be modified.
@ -1692,7 +1692,7 @@ _cogl_pipeline_prune_empty_layer_difference (CoglPipeline *layers_authority,
CoglPipelineLayerInfo layer_info; CoglPipelineLayerInfo layer_info;
CoglPipeline *old_layers_authority; CoglPipeline *old_layers_authority;
g_return_if_fail (link != NULL); _COGL_RETURN_IF_FAIL (link != NULL);
/* If the layer's parent doesn't have an owner then we can simply /* If the layer's parent doesn't have an owner then we can simply
* take ownership ourselves and drop our reference on the empty * take ownership ourselves and drop our reference on the empty
@ -2289,7 +2289,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), FALSE); _COGL_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);
@ -2299,7 +2299,7 @@ _cogl_pipeline_get_fog_enabled (CoglPipeline *pipeline)
unsigned long unsigned long
_cogl_pipeline_get_age (CoglPipeline *pipeline) _cogl_pipeline_get_age (CoglPipeline *pipeline)
{ {
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0); _COGL_RETURN_VAL_IF_FAIL (cogl_is_pipeline (pipeline), 0);
return pipeline->age; return pipeline->age;
} }
@ -2311,7 +2311,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline, int layer_index)
CoglPipelineLayerInfo layer_info; CoglPipelineLayerInfo layer_info;
int i; int i;
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
authority = authority =
_cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS); _cogl_pipeline_get_authority (pipeline, COGL_PIPELINE_STATE_LAYERS);
@ -2374,7 +2374,7 @@ prepend_layer_to_list_cb (CoglPipelineLayer *layer,
const GList * const GList *
_cogl_pipeline_get_layers (CoglPipeline *pipeline) _cogl_pipeline_get_layers (CoglPipeline *pipeline)
{ {
g_return_val_if_fail (cogl_is_pipeline (pipeline), NULL); _COGL_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);
@ -2397,7 +2397,7 @@ cogl_pipeline_get_n_layers (CoglPipeline *pipeline)
{ {
CoglPipeline *authority; CoglPipeline *authority;
g_return_val_if_fail (cogl_is_pipeline (pipeline), 0); _COGL_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

@ -29,6 +29,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "cogl-util.h"
#include "cogl-object-private.h" #include "cogl-object-private.h"
#include "cogl-primitive.h" #include "cogl-primitive.h"
#include "cogl-primitive-private.h" #include "cogl-primitive-private.h"
@ -66,7 +67,7 @@ cogl_primitive_new_with_attributes (CoglVerticesMode mode,
CoglAttribute *attribute = attributes[i]; CoglAttribute *attribute = attributes[i];
cogl_object_ref (attribute); cogl_object_ref (attribute);
g_return_val_if_fail (cogl_is_attribute (attribute), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_attribute (attribute), NULL);
primitive->attributes[i] = attribute; primitive->attributes[i] = attribute;
} }
@ -393,7 +394,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
{ {
int i; int i;
g_return_if_fail (cogl_is_primitive (primitive)); _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref)) if (G_UNLIKELY (primitive->immutable_ref))
{ {
@ -406,7 +407,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
* attribute thats actually in the new list too. */ * attribute thats actually in the new list too. */
for (i = 0; i < n_attributes; i++) for (i = 0; i < n_attributes; i++)
{ {
g_return_if_fail (cogl_is_attribute (attributes[i])); _COGL_RETURN_IF_FAIL (cogl_is_attribute (attributes[i]));
cogl_object_ref (attributes[i]); cogl_object_ref (attributes[i]);
} }
@ -442,7 +443,7 @@ cogl_primitive_set_attributes (CoglPrimitive *primitive,
int int
cogl_primitive_get_first_vertex (CoglPrimitive *primitive) cogl_primitive_get_first_vertex (CoglPrimitive *primitive)
{ {
g_return_val_if_fail (cogl_is_primitive (primitive), 0); _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0);
return primitive->first_vertex; return primitive->first_vertex;
} }
@ -451,7 +452,7 @@ void
cogl_primitive_set_first_vertex (CoglPrimitive *primitive, cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
int first_vertex) int first_vertex)
{ {
g_return_if_fail (cogl_is_primitive (primitive)); _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref)) if (G_UNLIKELY (primitive->immutable_ref))
{ {
@ -465,7 +466,7 @@ cogl_primitive_set_first_vertex (CoglPrimitive *primitive,
int int
cogl_primitive_get_n_vertices (CoglPrimitive *primitive) cogl_primitive_get_n_vertices (CoglPrimitive *primitive)
{ {
g_return_val_if_fail (cogl_is_primitive (primitive), 0); _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0);
return primitive->n_vertices; return primitive->n_vertices;
} }
@ -474,7 +475,7 @@ void
cogl_primitive_set_n_vertices (CoglPrimitive *primitive, cogl_primitive_set_n_vertices (CoglPrimitive *primitive,
int n_vertices) int n_vertices)
{ {
g_return_if_fail (cogl_is_primitive (primitive)); _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
primitive->n_vertices = n_vertices; primitive->n_vertices = n_vertices;
} }
@ -482,7 +483,7 @@ cogl_primitive_set_n_vertices (CoglPrimitive *primitive,
CoglVerticesMode CoglVerticesMode
cogl_primitive_get_mode (CoglPrimitive *primitive) cogl_primitive_get_mode (CoglPrimitive *primitive)
{ {
g_return_val_if_fail (cogl_is_primitive (primitive), 0); _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), 0);
return primitive->mode; return primitive->mode;
} }
@ -491,7 +492,7 @@ void
cogl_primitive_set_mode (CoglPrimitive *primitive, cogl_primitive_set_mode (CoglPrimitive *primitive,
CoglVerticesMode mode) CoglVerticesMode mode)
{ {
g_return_if_fail (cogl_is_primitive (primitive)); _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref)) if (G_UNLIKELY (primitive->immutable_ref))
{ {
@ -506,7 +507,7 @@ void
cogl_primitive_set_indices (CoglPrimitive *primitive, cogl_primitive_set_indices (CoglPrimitive *primitive,
CoglIndices *indices) CoglIndices *indices)
{ {
g_return_if_fail (cogl_is_primitive (primitive)); _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
if (G_UNLIKELY (primitive->immutable_ref)) if (G_UNLIKELY (primitive->immutable_ref))
{ {
@ -526,7 +527,7 @@ _cogl_primitive_immutable_ref (CoglPrimitive *primitive)
{ {
int i; int i;
g_return_val_if_fail (cogl_is_primitive (primitive), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_primitive (primitive), NULL);
primitive->immutable_ref++; primitive->immutable_ref++;
@ -541,8 +542,8 @@ _cogl_primitive_immutable_unref (CoglPrimitive *primitive)
{ {
int i; int i;
g_return_if_fail (cogl_is_primitive (primitive)); _COGL_RETURN_IF_FAIL (cogl_is_primitive (primitive));
g_return_if_fail (primitive->immutable_ref > 0); _COGL_RETURN_IF_FAIL (primitive->immutable_ref > 0);
primitive->immutable_ref--; primitive->immutable_ref--;

View File

@ -27,6 +27,7 @@
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-handle.h" #include "cogl-handle.h"
@ -107,9 +108,9 @@ cogl_program_attach_shader (CoglHandle program_handle,
/* Only one shader is allowed if the type is ARBfp */ /* Only one shader is allowed if the type is ARBfp */
if (shader->language == COGL_SHADER_LANGUAGE_ARBFP) if (shader->language == COGL_SHADER_LANGUAGE_ARBFP)
g_return_if_fail (program->attached_shaders == NULL); _COGL_RETURN_IF_FAIL (program->attached_shaders == NULL);
else if (shader->language == COGL_SHADER_LANGUAGE_GLSL) else if (shader->language == COGL_SHADER_LANGUAGE_GLSL)
g_return_if_fail (_cogl_program_get_language (program) == _COGL_RETURN_IF_FAIL (_cogl_program_get_language (program) ==
COGL_SHADER_LANGUAGE_GLSL); COGL_SHADER_LANGUAGE_GLSL);
program->attached_shaders program->attached_shaders
@ -132,7 +133,7 @@ cogl_program_use (CoglHandle handle)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (handle == COGL_INVALID_HANDLE || _COGL_RETURN_IF_FAIL (handle == COGL_INVALID_HANDLE ||
cogl_is_program (handle)); cogl_is_program (handle));
if (ctx->current_program == 0 && handle != 0) if (ctx->current_program == 0 && handle != 0)
@ -202,8 +203,8 @@ cogl_program_uniform_x (CoglHandle handle,
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_program (handle)); _COGL_RETURN_IF_FAIL (cogl_is_program (handle));
g_return_if_fail (program != NULL); _COGL_RETURN_IF_FAIL (program != NULL);
if (uniform_no >= 0 && uniform_no < program->custom_uniforms->len && if (uniform_no >= 0 && uniform_no < program->custom_uniforms->len &&
size >= 1 && size <= 4 && count >= 1) size >= 1 && size <= 4 && count >= 1)
@ -342,7 +343,7 @@ cogl_program_set_uniform_matrix (CoglHandle handle,
gboolean transpose, gboolean transpose,
const float *value) const float *value)
{ {
g_return_if_fail (cogl_is_program (handle)); _COGL_RETURN_IF_FAIL (cogl_is_program (handle));
cogl_program_uniform_x (handle, cogl_program_uniform_x (handle,
uniform_location, dimensions, count, uniform_location, dimensions, count,
@ -383,13 +384,13 @@ get_local_param_index (const char *uniform_name)
*p++ = input[i]; *p++ = input[i];
input[i] = '\0'; input[i] = '\0';
g_return_val_if_fail (strncmp ("program.local[", input, 14) == 0, -1); _COGL_RETURN_VAL_IF_FAIL (strncmp ("program.local[", input, 14) == 0, -1);
_index = g_ascii_strtoull (input + 14, &endptr, 10); _index = g_ascii_strtoull (input + 14, &endptr, 10);
g_return_val_if_fail (endptr != input + 14, -1); _COGL_RETURN_VAL_IF_FAIL (endptr != input + 14, -1);
g_return_val_if_fail (*endptr == ']', -1); _COGL_RETURN_VAL_IF_FAIL (*endptr == ']', -1);
g_return_val_if_fail (_index >= 0, -1); _COGL_RETURN_VAL_IF_FAIL (_index >= 0, -1);
g_free (input); g_free (input);
@ -484,9 +485,9 @@ _cogl_program_flush_uniform_arbfp (GLint location,
if (value->type != COGL_BOXED_NONE) if (value->type != COGL_BOXED_NONE)
{ {
g_return_if_fail (value->type == COGL_BOXED_FLOAT); _COGL_RETURN_IF_FAIL (value->type == COGL_BOXED_FLOAT);
g_return_if_fail (value->size == 4); _COGL_RETURN_IF_FAIL (value->size == 4);
g_return_if_fail (value->count == 1); _COGL_RETURN_IF_FAIL (value->count == 1);
GE( ctx, glProgramLocalParameter4fv (GL_FRAGMENT_PROGRAM_ARB, location, GE( ctx, glProgramLocalParameter4fv (GL_FRAGMENT_PROGRAM_ARB, location,
value->v.float_value) ); value->v.float_value) );
@ -505,7 +506,7 @@ _cogl_program_flush_uniforms (CoglProgram *program,
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx->driver != COGL_DRIVER_GLES1); _COGL_RETURN_IF_FAIL (ctx->driver != COGL_DRIVER_GLES1);
for (i = 0; i < program->custom_uniforms->len; i++) for (i = 0; i < program->custom_uniforms->len; i++)
{ {

View File

@ -35,6 +35,7 @@
*/ */
#include <cogl.h> #include <cogl.h>
#include <cogl-util.h>
#include <cogl-quaternion.h> #include <cogl-quaternion.h>
#include <cogl-quaternion-private.h> #include <cogl-quaternion-private.h>
#include <cogl-matrix.h> #include <cogl-matrix.h>
@ -319,8 +320,8 @@ cogl_quaternion_equal (gconstpointer v1, gconstpointer v2)
const CoglQuaternion *a = v1; const CoglQuaternion *a = v1;
const CoglQuaternion *b = v2; const CoglQuaternion *b = v2;
g_return_val_if_fail (v1 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v2 != NULL, FALSE);
if (v1 == v2) if (v1 == v2)
return TRUE; return TRUE;
@ -486,7 +487,7 @@ cogl_quaternion_slerp (CoglQuaternion *result,
float fa; float fa;
float fb; float fb;
g_return_if_fail (t >=0 && t <= 1.0f); _COGL_RETURN_IF_FAIL (t >=0 && t <= 1.0f);
if (t == 0) if (t == 0)
{ {
@ -573,7 +574,7 @@ cogl_quaternion_nlerp (CoglQuaternion *result,
float fa; float fa;
float fb; float fb;
g_return_if_fail (t >=0 && t <= 1.0f); _COGL_RETURN_IF_FAIL (t >=0 && t <= 1.0f);
if (t == 0) if (t == 0)
{ {

View File

@ -30,6 +30,7 @@
#include <glib.h> #include <glib.h>
#include "cogl-util.h"
#include "cogl-rectangle-map.h" #include "cogl-rectangle-map.h"
#include "cogl-debug.h" #include "cogl-debug.h"
@ -354,7 +355,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 */
g_return_val_if_fail (width > 0 && height > 0, FALSE); _COGL_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

@ -32,6 +32,7 @@
#include <string.h> #include <string.h>
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-private.h" #include "cogl-private.h"
#include "cogl-object.h" #include "cogl-object.h"
@ -133,10 +134,10 @@ void
cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer, cogl_xlib_renderer_set_foreign_display (CoglRenderer *renderer,
Display *xdisplay) Display *xdisplay)
{ {
g_return_if_fail (cogl_is_renderer (renderer)); _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */ /* NB: Renderers are considered immutable once connected */
g_return_if_fail (!renderer->connected); _COGL_RETURN_IF_FAIL (!renderer->connected);
renderer->foreign_xdpy = xdisplay; renderer->foreign_xdpy = xdisplay;
} }
@ -144,7 +145,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)
{ {
g_return_val_if_fail (cogl_is_renderer (renderer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
return renderer->foreign_xdpy; return renderer->foreign_xdpy;
} }
@ -374,7 +375,7 @@ void
cogl_renderer_set_winsys_id (CoglRenderer *renderer, cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID winsys_id) CoglWinsysID winsys_id)
{ {
g_return_if_fail (!renderer->connected); _COGL_RETURN_IF_FAIL (!renderer->connected);
renderer->winsys_id_override = winsys_id; renderer->winsys_id_override = winsys_id;
} }
@ -382,7 +383,7 @@ cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID CoglWinsysID
cogl_renderer_get_winsys_id (CoglRenderer *renderer) cogl_renderer_get_winsys_id (CoglRenderer *renderer)
{ {
g_return_val_if_fail (renderer->connected, 0); _COGL_RETURN_VAL_IF_FAIL (renderer->connected, 0);
return renderer->winsys_vtable->id; return renderer->winsys_vtable->id;
} }

View File

@ -28,6 +28,7 @@
#include "math.h" #include "math.h"
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-spans.h" #include "cogl-spans.h"
@ -77,7 +78,7 @@ _cogl_span_iter_begin (CoglSpanIter *iter,
/* XXX: If CLAMP_TO_EDGE needs to be emulated then it needs to be /* XXX: If CLAMP_TO_EDGE needs to be emulated then it needs to be
* done at a higher level than here... */ * done at a higher level than here... */
g_return_if_fail (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT || _COGL_RETURN_IF_FAIL (wrap_mode == COGL_PIPELINE_WRAP_MODE_REPEAT ||
wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT); wrap_mode == COGL_PIPELINE_WRAP_MODE_MIRRORED_REPEAT);
iter->span = NULL; iter->span = NULL;

View File

@ -219,10 +219,13 @@ _cogl_sub_texture_new (CoglHandle next_texture,
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 */
g_return_val_if_fail (sub_x >= 0 && sub_y >= 0, COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (sub_x >= 0 && sub_y >= 0, COGL_INVALID_HANDLE);
g_return_val_if_fail (sub_width > 0 && sub_height > 0, COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (sub_width > 0 && sub_height > 0,
g_return_val_if_fail (sub_x + sub_width <= next_width, COGL_INVALID_HANDLE); COGL_INVALID_HANDLE);
g_return_val_if_fail (sub_y + sub_height <= next_height, COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (sub_x + sub_width <= next_width,
COGL_INVALID_HANDLE);
_COGL_RETURN_VAL_IF_FAIL (sub_y + sub_height <= next_height,
COGL_INVALID_HANDLE);
sub_tex = g_new (CoglSubTexture, 1); sub_tex = g_new (CoglSubTexture, 1);

View File

@ -883,7 +883,7 @@ _cogl_texture_2d_sliced_new_from_bitmap (CoglBitmap *bmp,
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (cogl_is_bitmap (bmp), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), NULL);
width = _cogl_bitmap_get_width (bmp); width = _cogl_bitmap_get_width (bmp);
height = _cogl_bitmap_get_height (bmp); height = _cogl_bitmap_get_height (bmp);

View File

@ -224,7 +224,7 @@ _cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp,
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
g_return_val_if_fail (bmp != NULL, COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (bmp != NULL, COGL_INVALID_HANDLE);
internal_format = internal_format =
_cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp), _cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp),
@ -303,8 +303,8 @@ cogl_texture_2d_new_from_data (CoglContext *ctx,
CoglBitmap *bmp; CoglBitmap *bmp;
CoglHandle tex; CoglHandle tex;
g_return_val_if_fail (format != COGL_PIXEL_FORMAT_ANY, NULL); _COGL_RETURN_VAL_IF_FAIL (format != COGL_PIXEL_FORMAT_ANY, NULL);
g_return_val_if_fail (data != NULL, NULL); _COGL_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)
@ -458,11 +458,11 @@ _cogl_egl_texture_2d_new_from_image (CoglContext *ctx,
CoglTexture2D *tex_2d; CoglTexture2D *tex_2d;
GLenum gl_error; GLenum gl_error;
g_return_val_if_fail (_cogl_context_get_winsys (ctx) == _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx) ==
_cogl_winsys_egl_get_vtable (), _cogl_winsys_egl_get_vtable (),
NULL); NULL);
g_return_val_if_fail (ctx->private_feature_flags & _COGL_RETURN_VAL_IF_FAIL (ctx->private_feature_flags &
COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE, COGL_PRIVATE_FEATURE_TEXTURE_2D_FROM_EGL_IMAGE,
NULL); NULL);
@ -538,7 +538,7 @@ cogl_wayland_texture_2d_new_from_buffer (CoglContext *ctx,
{ {
EGLImageKHR image; EGLImageKHR image;
g_return_val_if_fail (_cogl_context_get_winsys (ctx) == _COGL_RETURN_VAL_IF_FAIL (_cogl_context_get_winsys (ctx) ==
_cogl_winsys_egl_get_vtable (), _cogl_winsys_egl_get_vtable (),
NULL); NULL);
image = _cogl_egl_create_image (ctx, image = _cogl_egl_create_image (ctx,
@ -577,7 +577,7 @@ _cogl_texture_2d_copy_from_framebuffer (CoglHandle handle,
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_texture_2d (handle)); _COGL_RETURN_IF_FAIL (cogl_is_texture_2d (handle));
tex_2d = COGL_TEXTURE_2D (handle); tex_2d = COGL_TEXTURE_2D (handle);

View File

@ -330,7 +330,7 @@ cogl_texture_3d_new_from_data (unsigned int width,
CoglHandle ret; CoglHandle ret;
/* These are considered a programmer errors so we won't set a /* These are considered a programmer errors so we won't set a
GError. It would be nice if this was a g_return_if_fail but the GError. It would be nice if this was a _COGL_RETURN_IF_FAIL but the
rest of Cogl isn't using that */ rest of Cogl isn't using that */
if (format == COGL_PIXEL_FORMAT_ANY) if (format == COGL_PIXEL_FORMAT_ANY)
return COGL_INVALID_HANDLE; return COGL_INVALID_HANDLE;

View File

@ -216,7 +216,7 @@ _cogl_texture_rectangle_new_from_bitmap (CoglBitmap *bmp,
_COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE); _COGL_GET_CONTEXT (ctx, COGL_INVALID_HANDLE);
g_return_val_if_fail (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE); _COGL_RETURN_VAL_IF_FAIL (cogl_is_bitmap (bmp), COGL_INVALID_HANDLE);
internal_format = internal_format =
_cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp), _cogl_texture_determine_internal_format (_cogl_bitmap_get_format (bmp),

View File

@ -397,7 +397,7 @@ cogl_texture_new_from_file (const char *filename,
CoglTexture *texture = NULL; CoglTexture *texture = NULL;
CoglPixelFormat src_format; CoglPixelFormat src_format;
g_return_val_if_fail (error == NULL || *error == NULL, NULL); _COGL_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)
@ -515,7 +515,7 @@ cogl_texture_new_from_buffer_EXP (CoglPixelBuffer *buffer,
CoglPixelBuffer *pixel_buffer; CoglPixelBuffer *pixel_buffer;
CoglBitmap *bmp; CoglBitmap *bmp;
g_return_val_if_fail (cogl_is_buffer (buffer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_buffer (buffer), NULL);
if (format == COGL_PIXEL_FORMAT_ANY) if (format == COGL_PIXEL_FORMAT_ANY)
return NULL; return NULL;

View File

@ -236,5 +236,4 @@ _cogl_util_ffs (int num)
return i; return i;
} }
#endif /* HAVE_FFS */ #endif /* HAVE_FFS */

View File

@ -27,6 +27,10 @@
#include <glib.h> #include <glib.h>
#include <math.h> #include <math.h>
#ifndef COGL_HAS_GLIB_SUPPORT
#include <stdio.h>
#endif
int int
_cogl_util_next_p2 (int a); _cogl_util_next_p2 (int a);
@ -103,4 +107,30 @@ int
_cogl_util_ffs (int num); _cogl_util_ffs (int num);
#endif #endif
#ifdef COGL_HAS_GLIB_SUPPORT
#define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR)
#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)
#else
#define _COGL_RETURN_IF_FAIL(EXPR) do { \
if (!(EXPR)) \
{ \
fprintf (stderr, "file %s: line %d: assertion `%s' failed", \
__FILE__, \
__LINE__, \
#EXPR); \
return; \
}; \
} while(0)
#define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) do { \
if (!(EXPR)) \
{ \
fprintf (stderr, "file %s: line %d: assertion `%s' failed", \
__FILE__, \
__LINE__, \
#EXPR); \
return (VAL); \
}; \
} while(0)
#endif /* COGL_HAS_GLIB_SUPPORT */
#endif /* __COGL_UTIL_H */ #endif /* __COGL_UTIL_H */

View File

@ -25,6 +25,7 @@
*/ */
#include <cogl.h> #include <cogl.h>
#include <cogl-util.h>
#include <cogl-vector.h> #include <cogl-vector.h>
#include <glib.h> #include <glib.h>
@ -51,8 +52,8 @@ cogl_vector3_equal (gconstpointer v1, gconstpointer v2)
CoglVector3 *vector0 = (CoglVector3 *)v1; CoglVector3 *vector0 = (CoglVector3 *)v1;
CoglVector3 *vector1 = (CoglVector3 *)v2; CoglVector3 *vector1 = (CoglVector3 *)v2;
g_return_val_if_fail (v1 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE); _COGL_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
@ -68,8 +69,8 @@ cogl_vector3_equal_with_epsilon (const CoglVector3 *vector0,
const CoglVector3 *vector1, const CoglVector3 *vector1,
float epsilon) float epsilon)
{ {
g_return_val_if_fail (vector0 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (vector0 != NULL, FALSE);
g_return_val_if_fail (vector1 != NULL, FALSE); _COGL_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 &&
@ -219,8 +220,8 @@ cogl_vector4_init_from_vector4 (CoglVector4 *vector, CoglVector4 *src)
gboolean gboolean
cogl_vector4_equal (gconstpointer *v0, gconstpointer *v1) cogl_vector4_equal (gconstpointer *v0, gconstpointer *v1)
{ {
g_return_val_if_fail (v1 != NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (v1 != NULL, FALSE);
g_return_val_if_fail (v2 != NULL, FALSE); _COGL_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

@ -1163,7 +1163,7 @@ update_primitive_attributes (CoglVertexBuffer *buffer)
; ;
} }
g_return_if_fail (n_attributes > 0); _COGL_RETURN_IF_FAIL (n_attributes > 0);
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes); attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);

View File

@ -29,6 +29,7 @@
#endif #endif
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-object.h" #include "cogl-object.h"
@ -197,7 +198,7 @@ cogl_xlib_renderer_get_display (CoglRenderer *renderer)
{ {
CoglXlibRenderer *xlib_renderer; CoglXlibRenderer *xlib_renderer;
g_return_val_if_fail (cogl_is_renderer (renderer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
xlib_renderer = renderer->winsys; xlib_renderer = renderer->winsys;

View File

@ -149,7 +149,7 @@ toggle_client_flag (CoglContext *ctx,
unsigned long flag, unsigned long flag,
GLenum gl_flag) GLenum gl_flag)
{ {
g_return_val_if_fail (ctx->driver != COGL_DRIVER_GLES2, FALSE); _COGL_RETURN_VAL_IF_FAIL (ctx->driver != COGL_DRIVER_GLES2, FALSE);
/* Toggles and caches a single client-side enable flag /* Toggles and caches a single client-side enable flag
* on or off by comparing to current state * on or off by comparing to current state
@ -453,7 +453,7 @@ _cogl_read_pixels_with_rowstride (int x,
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (source == COGL_READ_PIXELS_COLOR_BUFFER); _COGL_RETURN_IF_FAIL (source == COGL_READ_PIXELS_COLOR_BUFFER);
if (width == 1 && height == 1 && !framebuffer->clear_clip_dirty) if (width == 1 && height == 1 && !framebuffer->clear_clip_dirty)
{ {
@ -924,7 +924,7 @@ cogl_push_source (void *material_or_pipeline)
{ {
CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline); CoglPipeline *pipeline = COGL_PIPELINE (material_or_pipeline);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
_cogl_push_source (pipeline, TRUE); _cogl_push_source (pipeline, TRUE);
} }
@ -939,7 +939,7 @@ _cogl_push_source (CoglPipeline *pipeline, gboolean enable_legacy)
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
if (ctx->source_stack) if (ctx->source_stack)
{ {
@ -964,7 +964,7 @@ cogl_pop_source (void)
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (ctx->source_stack); _COGL_RETURN_IF_FAIL (ctx->source_stack);
top = ctx->source_stack->data; top = ctx->source_stack->data;
top->push_count--; top->push_count--;
@ -985,7 +985,7 @@ cogl_get_source (void)
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (ctx->source_stack, NULL); _COGL_RETURN_VAL_IF_FAIL (ctx->source_stack, NULL);
top = ctx->source_stack->data; top = ctx->source_stack->data;
return top->pipeline; return top->pipeline;
@ -998,7 +998,7 @@ _cogl_get_enable_legacy_state (void)
_COGL_GET_CONTEXT (ctx, FALSE); _COGL_GET_CONTEXT (ctx, FALSE);
g_return_val_if_fail (ctx->source_stack, FALSE); _COGL_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;
@ -1012,8 +1012,8 @@ cogl_set_source (void *material_or_pipeline)
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (cogl_is_pipeline (pipeline)); _COGL_RETURN_IF_FAIL (cogl_is_pipeline (pipeline));
g_return_if_fail (ctx->source_stack); _COGL_RETURN_IF_FAIL (ctx->source_stack);
top = ctx->source_stack->data; top = ctx->source_stack->data;
if (top->pipeline == pipeline && top->enable_legacy) if (top->pipeline == pipeline && top->enable_legacy)
@ -1040,7 +1040,7 @@ cogl_set_source_texture (CoglTexture *texture)
{ {
_COGL_GET_CONTEXT (ctx, NO_RETVAL); _COGL_GET_CONTEXT (ctx, NO_RETVAL);
g_return_if_fail (texture != NULL); _COGL_RETURN_IF_FAIL (texture != NULL);
cogl_pipeline_set_layer_texture (ctx->texture_pipeline, 0, texture); cogl_pipeline_set_layer_texture (ctx->texture_pipeline, 0, texture);
cogl_set_source (ctx->texture_pipeline); cogl_set_source (ctx->texture_pipeline);

View File

@ -31,6 +31,7 @@
#endif #endif
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-object.h" #include "cogl-object.h"
#include "cogl-internal.h" #include "cogl-internal.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
@ -133,7 +134,7 @@ void
cogl2_path_set_fill_rule (CoglPath *path, cogl2_path_set_fill_rule (CoglPath *path,
CoglPathFillRule fill_rule) CoglPathFillRule fill_rule)
{ {
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
if (path->data->fill_rule != fill_rule) if (path->data->fill_rule != fill_rule)
{ {
@ -146,7 +147,7 @@ cogl2_path_set_fill_rule (CoglPath *path,
CoglPathFillRule CoglPathFillRule
cogl2_path_get_fill_rule (CoglPath *path) cogl2_path_get_fill_rule (CoglPath *path)
{ {
g_return_val_if_fail (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO); _COGL_RETURN_VAL_IF_FAIL (cogl_is_path (path), COGL_PATH_FILL_RULE_NON_ZERO);
return path->data->fill_rule; return path->data->fill_rule;
} }
@ -341,7 +342,7 @@ _cogl_path_fill_nodes (CoglPath *path, CoglDrawFlags flags)
void void
cogl2_path_fill (CoglPath *path) cogl2_path_fill (CoglPath *path)
{ {
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
if (path->data->path_nodes->len == 0) if (path->data->path_nodes->len == 0)
return; return;
@ -364,7 +365,7 @@ cogl2_path_fill (CoglPath *path)
void void
cogl2_path_stroke (CoglPath *path) cogl2_path_stroke (CoglPath *path)
{ {
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
if (path->data->path_nodes->len == 0) if (path->data->path_nodes->len == 0)
return; return;
@ -379,7 +380,7 @@ cogl2_path_move_to (CoglPath *path,
{ {
CoglPathData *data; CoglPathData *data;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
_cogl_path_add_node (path, TRUE, x, y); _cogl_path_add_node (path, TRUE, x, y);
@ -398,7 +399,7 @@ cogl2_path_rel_move_to (CoglPath *path,
{ {
CoglPathData *data; CoglPathData *data;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
data = path->data; data = path->data;
@ -414,7 +415,7 @@ cogl2_path_line_to (CoglPath *path,
{ {
CoglPathData *data; CoglPathData *data;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
_cogl_path_add_node (path, FALSE, x, y); _cogl_path_add_node (path, FALSE, x, y);
@ -431,7 +432,7 @@ cogl2_path_rel_line_to (CoglPath *path,
{ {
CoglPathData *data; CoglPathData *data;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
data = path->data; data = path->data;
@ -443,7 +444,7 @@ cogl2_path_rel_line_to (CoglPath *path,
void void
cogl2_path_close (CoglPath *path) cogl2_path_close (CoglPath *path)
{ {
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
_cogl_path_add_node (path, FALSE, path->data->path_start.x, _cogl_path_add_node (path, FALSE, path->data->path_start.x,
path->data->path_start.y); path->data->path_start.y);
@ -469,7 +470,7 @@ cogl2_path_polyline (CoglPath *path,
{ {
int c = 0; int c = 0;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
cogl2_path_move_to (path, coords[0], coords[1]); cogl2_path_move_to (path, coords[0], coords[1]);
@ -594,7 +595,7 @@ cogl2_path_arc (CoglPath *path,
{ {
float angle_step = 10; float angle_step = 10;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
/* it is documented that a move to is needed to create a freestanding /* it is documented that a move to is needed to create a freestanding
* arc * arc
@ -638,7 +639,7 @@ cogl2_path_ellipse (CoglPath *path,
{ {
float angle_step = 10; float angle_step = 10;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
/* FIXME: if shows to be slow might be optimized /* FIXME: if shows to be slow might be optimized
* by mirroring just a quarter of it */ * by mirroring just a quarter of it */
@ -664,7 +665,7 @@ cogl2_path_round_rectangle (CoglPath *path,
float inner_width = x_2 - x_1 - radius * 2; float inner_width = x_2 - x_1 - radius * 2;
float inner_height = y_2 - y_1 - radius * 2; float inner_height = y_2 - y_1 - radius * 2;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
cogl2_path_move_to (path, x_1, y_1 + radius); cogl2_path_move_to (path, x_1, y_1 + radius);
_cogl_path_rel_arc (path, _cogl_path_rel_arc (path,
@ -815,7 +816,7 @@ cogl2_path_curve_to (CoglPath *path,
{ {
CoglBezCubic cubic; CoglBezCubic cubic;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
/* Prepare cubic curve */ /* Prepare cubic curve */
cubic.p1 = path->data->path_pen; cubic.p1 = path->data->path_pen;
@ -845,7 +846,7 @@ cogl2_path_rel_curve_to (CoglPath *path,
{ {
CoglPathData *data; CoglPathData *data;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
data = path->data; data = path->data;
@ -883,7 +884,7 @@ cogl_path_copy (CoglPath *old_path)
{ {
CoglPath *new_path; CoglPath *new_path;
g_return_val_if_fail (cogl_is_path (old_path), NULL); _COGL_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;
@ -1004,7 +1005,7 @@ cogl_rel_curve2_to (CoglPath *path,
{ {
CoglPathData *data; CoglPathData *data;
g_return_if_fail (cogl_is_path (path)); _COGL_RETURN_IF_FAIL (cogl_is_path (path));
data = path->data; data = path->data;

View File

@ -30,6 +30,7 @@
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-winsys-egl-private.h" #include "cogl-winsys-egl-private.h"
#include "cogl-winsys-private.h" #include "cogl-winsys-private.h"
#include "cogl-feature-private.h" #include "cogl-feature-private.h"
@ -522,7 +523,7 @@ update_winsys_features (CoglContext *context, GError **error)
CoglDisplayEGL *egl_display = context->display->winsys; CoglDisplayEGL *egl_display = context->display->winsys;
CoglRendererEGL *egl_renderer = context->display->renderer->winsys; CoglRendererEGL *egl_renderer = context->display->renderer->winsys;
g_return_val_if_fail (egl_display->egl_context, FALSE); _COGL_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));
@ -691,7 +692,7 @@ try_create_context (CoglDisplay *display,
with_stencil_buffer, with_stencil_buffer,
cfg_attribs); cfg_attribs);
g_return_val_if_fail (egl_display->egl_context == NULL, TRUE); _COGL_RETURN_VAL_IF_FAIL (egl_display->egl_context == NULL, TRUE);
edpy = egl_renderer->edpy; edpy = egl_renderer->edpy;
@ -1045,7 +1046,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
{ {
CoglDisplayEGL *egl_display = display->winsys; CoglDisplayEGL *egl_display = display->winsys;
g_return_if_fail (egl_display != NULL); _COGL_RETURN_IF_FAIL (egl_display != NULL);
cleanup_context (display); cleanup_context (display);
@ -1148,7 +1149,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
CoglRendererEGL *egl_renderer = display->renderer->winsys; CoglRendererEGL *egl_renderer = display->renderer->winsys;
#endif #endif
g_return_val_if_fail (display->winsys == NULL, FALSE); _COGL_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;
@ -1231,7 +1232,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
gboolean need_stencil = gboolean need_stencil =
egl_display->stencil_disabled ? FALSE : framebuffer->config.need_stencil; egl_display->stencil_disabled ? FALSE : framebuffer->config.need_stencil;
g_return_val_if_fail (egl_display->egl_context, FALSE); _COGL_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,
@ -1642,7 +1643,7 @@ _cogl_winsys_xlib_get_visual_info (void)
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (ctx->display->winsys, FALSE); _COGL_RETURN_VAL_IF_FAIL (ctx->display->winsys, FALSE);
egl_display = ctx->display->winsys; egl_display = ctx->display->winsys;
@ -1833,10 +1834,10 @@ void
cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer, cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer,
struct wl_display *display) struct wl_display *display)
{ {
g_return_if_fail (cogl_is_renderer (renderer)); _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */ /* NB: Renderers are considered immutable once connected */
g_return_if_fail (!renderer->connected); _COGL_RETURN_IF_FAIL (!renderer->connected);
renderer->foreign_wayland_display = display; renderer->foreign_wayland_display = display;
} }
@ -1844,7 +1845,7 @@ cogl_wayland_renderer_set_foreign_display (CoglRenderer *renderer,
struct wl_display * struct wl_display *
cogl_wayland_renderer_get_display (CoglRenderer *renderer) cogl_wayland_renderer_get_display (CoglRenderer *renderer)
{ {
g_return_val_if_fail (cogl_is_renderer (renderer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
if (renderer->foreign_wayland_display) if (renderer->foreign_wayland_display)
return renderer->foreign_wayland_display; return renderer->foreign_wayland_display;
@ -1861,10 +1862,10 @@ void
cogl_wayland_renderer_set_foreign_compositor (CoglRenderer *renderer, cogl_wayland_renderer_set_foreign_compositor (CoglRenderer *renderer,
struct wl_compositor *compositor) struct wl_compositor *compositor)
{ {
g_return_if_fail (cogl_is_renderer (renderer)); _COGL_RETURN_IF_FAIL (cogl_is_renderer (renderer));
/* NB: Renderers are considered immutable once connected */ /* NB: Renderers are considered immutable once connected */
g_return_if_fail (!renderer->connected); _COGL_RETURN_IF_FAIL (!renderer->connected);
renderer->foreign_wayland_compositor = compositor; renderer->foreign_wayland_compositor = compositor;
} }
@ -1872,7 +1873,7 @@ cogl_wayland_renderer_set_foreign_compositor (CoglRenderer *renderer,
struct wl_compositor * struct wl_compositor *
cogl_wayland_renderer_get_compositor (CoglRenderer *renderer) cogl_wayland_renderer_get_compositor (CoglRenderer *renderer)
{ {
g_return_val_if_fail (cogl_is_renderer (renderer), NULL); _COGL_RETURN_VAL_IF_FAIL (cogl_is_renderer (renderer), NULL);
if (renderer->foreign_wayland_compositor) if (renderer->foreign_wayland_compositor)
return renderer->foreign_wayland_compositor; return renderer->foreign_wayland_compositor;
@ -1913,7 +1914,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;
g_return_val_if_fail (egl_renderer->pf_eglCreateImage, EGL_NO_IMAGE_KHR); _COGL_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 */
@ -1937,7 +1938,7 @@ _cogl_egl_destroy_image (CoglContext *ctx,
{ {
CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys;
g_return_if_fail (egl_renderer->pf_eglDestroyImage); _COGL_RETURN_IF_FAIL (egl_renderer->pf_eglDestroyImage);
egl_renderer->pf_eglDestroyImage (egl_renderer->edpy, image); egl_renderer->pf_eglDestroyImage (egl_renderer->edpy, image);
} }

View File

@ -30,6 +30,7 @@
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-winsys-private.h" #include "cogl-winsys-private.h"
#include "cogl-feature-private.h" #include "cogl-feature-private.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
@ -381,7 +382,7 @@ update_winsys_features (CoglContext *context, GError **error)
int default_screen; int default_screen;
int i; int i;
g_return_val_if_fail (glx_display->glx_context, FALSE); _COGL_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;
@ -592,7 +593,7 @@ create_context (CoglDisplay *display, GError **error)
GLXDrawable dummy_drawable; GLXDrawable dummy_drawable;
CoglXlibTrapState old_state; CoglXlibTrapState old_state;
g_return_val_if_fail (glx_display->glx_context == NULL, TRUE); _COGL_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,
@ -714,7 +715,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
CoglXlibRenderer *xlib_renderer = display->renderer->winsys; CoglXlibRenderer *xlib_renderer = display->renderer->winsys;
CoglGLXRenderer *glx_renderer = display->renderer->winsys; CoglGLXRenderer *glx_renderer = display->renderer->winsys;
g_return_if_fail (glx_display != NULL); _COGL_RETURN_IF_FAIL (glx_display != NULL);
if (glx_display->glx_context) if (glx_display->glx_context)
{ {
@ -749,7 +750,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
CoglGLXDisplay *glx_display; CoglGLXDisplay *glx_display;
int i; int i;
g_return_val_if_fail (display->winsys == NULL, FALSE); _COGL_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;
@ -803,7 +804,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
GLXFBConfig fbconfig; GLXFBConfig fbconfig;
GError *fbconfig_error = NULL; GError *fbconfig_error = NULL;
g_return_val_if_fail (glx_display->glx_context, FALSE); _COGL_RETURN_VAL_IF_FAIL (glx_display->glx_context, FALSE);
if (!find_fbconfig (display, &framebuffer->config, if (!find_fbconfig (display, &framebuffer->config,
&fbconfig, &fbconfig,
@ -1483,7 +1484,7 @@ _cogl_winsys_xlib_get_visual_info (void)
_COGL_GET_CONTEXT (ctx, NULL); _COGL_GET_CONTEXT (ctx, NULL);
g_return_val_if_fail (ctx->display->winsys, FALSE); _COGL_RETURN_VAL_IF_FAIL (ctx->display->winsys, FALSE);
glx_display = ctx->display->winsys; glx_display = ctx->display->winsys;
xlib_renderer = ctx->display->renderer->winsys; xlib_renderer = ctx->display->renderer->winsys;

View File

@ -32,6 +32,7 @@
#include "cogl.h" #include "cogl.h"
#include "cogl-util.h"
#include "cogl-winsys-private.h" #include "cogl-winsys-private.h"
#include "cogl-context-private.h" #include "cogl-context-private.h"
#include "cogl-framebuffer.h" #include "cogl-framebuffer.h"
@ -420,7 +421,7 @@ create_context (CoglDisplay *display, GError **error)
{ {
CoglDisplayWgl *wgl_display = display->winsys; CoglDisplayWgl *wgl_display = display->winsys;
g_return_val_if_fail (wgl_display->wgl_context == NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (wgl_display->wgl_context == NULL, FALSE);
/* Cogl assumes that there is always a GL context selected; in order /* Cogl assumes that there is always a GL context selected; in order
* to make sure that a WGL context exists and is made current, we * to make sure that a WGL context exists and is made current, we
@ -496,7 +497,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display)
{ {
CoglDisplayWgl *wgl_display = display->winsys; CoglDisplayWgl *wgl_display = display->winsys;
g_return_if_fail (wgl_display != NULL); _COGL_RETURN_IF_FAIL (wgl_display != NULL);
if (wgl_display->wgl_context) if (wgl_display->wgl_context)
{ {
@ -524,7 +525,7 @@ _cogl_winsys_display_setup (CoglDisplay *display,
{ {
CoglDisplayWgl *wgl_display; CoglDisplayWgl *wgl_display;
g_return_val_if_fail (display->winsys == NULL, FALSE); _COGL_RETURN_VAL_IF_FAIL (display->winsys == NULL, FALSE);
wgl_display = g_slice_new0 (CoglDisplayWgl); wgl_display = g_slice_new0 (CoglDisplayWgl);
display->winsys = wgl_display; display->winsys = wgl_display;
@ -585,7 +586,7 @@ update_winsys_features (CoglContext *context, GError **error)
const char *wgl_extensions; const char *wgl_extensions;
int i; int i;
g_return_val_if_fail (wgl_display->wgl_context, FALSE); _COGL_RETURN_VAL_IF_FAIL (wgl_display->wgl_context, FALSE);
if (!_cogl_context_update_features (context, error)) if (!_cogl_context_update_features (context, error))
return FALSE; return FALSE;
@ -660,7 +661,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen)
NULL, but this isn't really going to work because before checking NULL, but this isn't really going to work because before checking
whether onscreen == NULL it reads the pointer to get the whether onscreen == NULL it reads the pointer to get the
context */ context */
g_return_if_fail (onscreen != NULL); _COGL_RETURN_IF_FAIL (onscreen != NULL);
context = COGL_FRAMEBUFFER (onscreen)->context; context = COGL_FRAMEBUFFER (onscreen)->context;
wgl_context = context->winsys; wgl_context = context->winsys;
@ -734,7 +735,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen,
int pf; int pf;
HWND hwnd; HWND hwnd;
g_return_val_if_fail (wgl_display->wgl_context, FALSE); _COGL_RETURN_VAL_IF_FAIL (wgl_display->wgl_context, FALSE);
/* XXX: Note we ignore the user's original width/height when given a /* XXX: Note we ignore the user's original width/height when given a
* foreign window. */ * foreign window. */

View File

@ -394,6 +394,27 @@ AC_ARG_ENABLE(
) )
AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x$enable_examples_install" = "xyes"]) AM_CONDITIONAL([INSTALL_EXAMPLES], [test "x$enable_examples_install" = "xyes"])
dnl ============================================================
dnl Should glib be used?
dnl ============================================================
AC_ARG_ENABLE(
[glib],
[AC_HELP_STRING([--enable-glib=@<:@no/yes@:>@], [Enable glib support @<:@default=yes@:>@])],
[],
enable_glib=yes
)
AM_CONDITIONAL([USE_GLIB], [test "x$enable_glib" = "xyes"])
AS_IF([test "x$enable_glib" = "xyes"],
[
COGL_DEFINES_SYMBOLS="$COGL_DEFINES_SYMBOLS COGL_HAS_GLIB_SUPPORT"
],
[
EXPERIMENTAL_CONFIG=yes
EXPERIMENTAL_OPTIONS="$EXPERIMENTAL_OPTIONS --disable-glib,"
]
)
dnl ============================================================ dnl ============================================================
dnl Determine which drivers and window systems we can support dnl Determine which drivers and window systems we can support
dnl ============================================================ dnl ============================================================