Commit 70bacb94 authored by Niels De Graef's avatar Niels De Graef Committed by Niels De Graef

cogl: Remove CoglError wrapper

CoglError was added at a certain point to remove the hard dependency on
GLib, but since this can't be avoided inside mutter, let's remove this
whole abstraction.

!631
parent 57dfe469
......@@ -1111,7 +1111,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
{
if (backend->dummy_onscreen == COGL_INVALID_HANDLE)
{
CoglError *internal_error = NULL;
GError *internal_error = NULL;
backend->dummy_onscreen = cogl_onscreen_new (backend->cogl_context, 1, 1);
......@@ -1119,7 +1119,7 @@ _clutter_backend_reset_cogl_framebuffer (ClutterBackend *backend)
&internal_error))
{
g_critical ("Unable to create dummy onscreen: %s", internal_error->message);
cogl_error_free (internal_error);
g_error_free (internal_error);
return;
}
}
......
......@@ -217,7 +217,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
CoglPangoGlyphCacheValue *value)
{
CoglAtlasTexture *texture;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
if (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SHARED_ATLAS))
return FALSE;
......@@ -232,7 +232,7 @@ cogl_pango_glyph_cache_add_to_global_atlas (CoglPangoGlyphCache *cache,
value->draw_height);
if (!cogl_texture_allocate (COGL_TEXTURE (texture), &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
return FALSE;
}
......
......@@ -47,7 +47,6 @@
#include "cogl-atlas.h"
#include "cogl1-context.h"
#include "cogl-sub-texture.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-pipeline-opengl-private.h"
#include "driver/gl/cogl-texture-gl-private.h"
......@@ -453,7 +452,7 @@ _cogl_atlas_texture_set_region_with_border (CoglAtlasTexture *atlas_tex,
int dst_width,
int dst_height,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglAtlas *atlas = atlas_tex->atlas;
......@@ -524,7 +523,7 @@ _cogl_atlas_texture_convert_bitmap_for_upload (CoglAtlasTexture *atlas_tex,
CoglBitmap *bmp,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error)
GError **error)
{
CoglBitmap *upload_bmp;
CoglBitmap *override_bmp;
......@@ -574,7 +573,7 @@ _cogl_atlas_texture_set_region (CoglTexture *tex,
int dst_height,
int level,
CoglBitmap *bmp,
CoglError **error)
GError **error)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
......@@ -711,7 +710,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
int width,
int height,
CoglPixelFormat internal_format,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (atlas_tex);
CoglContext *ctx = tex->context;
......@@ -723,10 +722,10 @@ allocate_space (CoglAtlasTexture *atlas_tex,
{
COGL_NOTE (ATLAS, "Texture can not be added because the "
"format is unsupported");
_cogl_set_error (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_FORMAT,
"Texture format unsuitable for atlasing");
g_set_error_literal (error,
COGL_TEXTURE_ERROR,
COGL_TEXTURE_ERROR_FORMAT,
"Texture format unsuitable for atlasing");
return FALSE;
}
......@@ -734,11 +733,11 @@ allocate_space (CoglAtlasTexture *atlas_tex,
and we shouldn't use the atlas */
if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN))
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Atlasing disabled because migrations "
"would be too slow");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_UNSUPPORTED,
"Atlasing disabled because migrations "
"would be too slow");
return FALSE;
}
......@@ -777,10 +776,10 @@ allocate_space (CoglAtlasTexture *atlas_tex,
/* Ok, this means we really can't add it to the atlas */
cogl_object_unref (atlas);
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Not enough memory to atlas texture");
g_set_error_literal (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Not enough memory to atlas texture");
return FALSE;
}
}
......@@ -795,7 +794,7 @@ allocate_space (CoglAtlasTexture *atlas_tex,
static gboolean
allocate_with_size (CoglAtlasTexture *atlas_tex,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (atlas_tex);
CoglPixelFormat internal_format =
......@@ -820,7 +819,7 @@ allocate_with_size (CoglAtlasTexture *atlas_tex,
static gboolean
allocate_from_bitmap (CoglAtlasTexture *atlas_tex,
CoglTextureLoader *loader,
CoglError **error)
GError **error)
{
CoglTexture *tex = COGL_TEXTURE (atlas_tex);
CoglBitmap *bmp = loader->src.bitmap.bitmap;
......@@ -880,7 +879,7 @@ allocate_from_bitmap (CoglAtlasTexture *atlas_tex,
static gboolean
_cogl_atlas_texture_allocate (CoglTexture *tex,
CoglError **error)
GError **error)
{
CoglAtlasTexture *atlas_tex = COGL_ATLAS_TEXTURE (tex);
CoglTextureLoader *loader = tex->loader;
......@@ -933,7 +932,7 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex;
......@@ -969,7 +968,7 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglAtlasTexture *
cogl_atlas_texture_new_from_file (CoglContext *ctx,
const char *filename,
CoglError **error)
GError **error)
{
CoglBitmap *bmp;
CoglAtlasTexture *atlas_tex = NULL;
......
......@@ -117,7 +117,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
* cogl_atlas_texture_new_from_file:
* @ctx: A #CoglContext
* @filename: the file to load
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a #CoglAtlasTexture from an image file. A #CoglAtlasTexture
* represents a sub-region within one of Cogl's shared texture
......@@ -149,7 +149,7 @@ cogl_atlas_texture_new_with_size (CoglContext *ctx,
CoglAtlasTexture *
cogl_atlas_texture_new_from_file (CoglContext *ctx,
const char *filename,
CoglError **error);
GError **error);
/**
* cogl_atlas_texture_new_from_data:
......@@ -161,7 +161,7 @@ cogl_atlas_texture_new_from_file (CoglContext *ctx,
* row in @data. A value of 0 will make Cogl automatically
* calculate @rowstride from @width and @format.
* @data: pointer to the memory region where the source buffer resides
* @error: A #CoglError to catch exceptional errors or %NULL
* @error: A #GError to catch exceptional errors or %NULL
*
* Creates a new #CoglAtlasTexture texture based on data residing in
* memory. A #CoglAtlasTexture represents a sub-region within one of
......@@ -198,7 +198,7 @@ cogl_atlas_texture_new_from_data (CoglContext *ctx,
CoglPixelFormat format,
int rowstride,
const uint8_t *data,
CoglError **error);
GError **error);
/**
* cogl_atlas_texture_new_from_bitmap:
......
......@@ -283,7 +283,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
int height)
{
CoglTexture2D *tex;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
......@@ -309,7 +309,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (tex);
tex = NULL;
}
......@@ -327,7 +327,7 @@ _cogl_atlas_create_texture (CoglAtlas *atlas,
if (!cogl_texture_allocate (COGL_TEXTURE (tex), &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (tex);
tex = NULL;
}
......@@ -560,7 +560,7 @@ create_migration_texture (CoglContext *ctx,
CoglPixelFormat internal_format)
{
CoglTexture *tex;
CoglError *skip_error = NULL;
GError *skip_error = NULL;
/* First try creating a fast-path non-sliced texture */
tex = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
......@@ -573,7 +573,7 @@ create_migration_texture (CoglContext *ctx,
* lazily when uploading data. */
if (!cogl_texture_allocate (tex, &skip_error))
{
cogl_error_free (skip_error);
g_error_free (skip_error);
cogl_object_unref (tex);
tex = NULL;
}
......@@ -605,7 +605,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
{
CoglTexture *tex;
CoglBlitData blit_data;
CoglError *ignore_error = NULL;
GError *ignore_error = NULL;
_COGL_GET_CONTEXT (ctx, NULL);
......@@ -613,7 +613,7 @@ _cogl_atlas_copy_rectangle (CoglAtlas *atlas,
tex = create_migration_texture (ctx, width, height, internal_format);
if (!cogl_texture_allocate (tex, &ignore_error))
{
cogl_error_free (ignore_error);
g_error_free (ignore_error);
cogl_object_unref (tex);
return NULL;
}
......
......@@ -71,7 +71,7 @@ cogl_attribute_buffer_new (CoglContext *context,
buffer = cogl_attribute_buffer_new_with_size (context, bytes);
/* Note: to keep the common cases simple this API doesn't throw
* CoglErrors, so developers can assume this function never returns
* GErrors, so developers can assume this function never returns
* NULL and we will simply abort on error.
*
* Developers wanting to catch errors can use
......
......@@ -361,7 +361,7 @@ _cogl_bitmap_needs_short_temp_buffer (CoglPixelFormat format)
gboolean
_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
CoglBitmap *dst_bmp,
CoglError **error)
GError **error)
{
uint8_t *src_data;
uint8_t *dst_data;
......@@ -488,7 +488,7 @@ _cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
CoglBitmap *
_cogl_bitmap_convert (CoglBitmap *src_bmp,
CoglPixelFormat dst_format,
CoglError **error)
GError **error)
{
CoglBitmap *dst_bmp;
int width, height;
......@@ -547,7 +547,7 @@ CoglBitmap *
_cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error)
GError **error)
{
CoglContext *ctx = _cogl_bitmap_get_context (src_bmp);
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
......@@ -616,7 +616,7 @@ _cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
gboolean
_cogl_bitmap_unpremult (CoglBitmap *bmp,
CoglError **error)
GError **error)
{
uint8_t *p, *data;
uint16_t *tmp_row;
......@@ -684,7 +684,7 @@ _cogl_bitmap_unpremult (CoglBitmap *bmp,
gboolean
_cogl_bitmap_premult (CoglBitmap *bmp,
CoglError **error)
GError **error)
{
uint8_t *p, *data;
uint16_t *tmp_row;
......
......@@ -34,7 +34,6 @@
#include "cogl-bitmap-private.h"
#include "cogl-context-private.h"
#include "cogl-private.h"
#include "cogl-error-private.h"
#include <string.h>
......@@ -56,7 +55,7 @@ _cogl_bitmap_get_size_from_file (const char *filename,
CoglBitmap *
_cogl_bitmap_from_file (CoglContext *ctx,
const char *filename,
CoglError **error)
GError **error)
{
static CoglUserDataKey pixbuf_key;
GdkPixbuf *pixbuf;
......@@ -75,7 +74,7 @@ _cogl_bitmap_from_file (CoglContext *ctx,
pixbuf = gdk_pixbuf_new_from_file (filename, &glib_error);
if (pixbuf == NULL)
{
_cogl_propagate_gerror (error, glib_error);
g_propagate_error (error, glib_error);
return FALSE;
}
......
......@@ -70,7 +70,7 @@ struct _CoglBitmap
* @width: width of the bitmap in pixels
* @height: height of the bitmap in pixels
* @format: the format of the pixels the array will store
* @error: A #CoglError for catching exceptional errors or %NULL
* @error: A #GError for catching exceptional errors or %NULL
*
* This is equivalent to cogl_bitmap_new_with_size() except that it
* allocated the buffer using g_malloc() instead of creating a
......@@ -87,7 +87,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
unsigned int width,
unsigned int height,
CoglPixelFormat format,
CoglError **error);
GError **error);
/* The idea of this function is that it will create a bitmap that
shares the actual data with another bitmap. This is needed for the
......@@ -103,53 +103,53 @@ _cogl_bitmap_new_shared (CoglBitmap *shared_bmp,
CoglBitmap *
_cogl_bitmap_convert (CoglBitmap *bmp,
CoglPixelFormat dst_format,
CoglError **error);
CoglPixelFormat dst_format,
GError **error);
CoglBitmap *
_cogl_bitmap_convert_for_upload (CoglBitmap *src_bmp,
CoglPixelFormat internal_format,
gboolean can_convert_in_place,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_convert_into_bitmap (CoglBitmap *src_bmp,
CoglBitmap *dst_bmp,
CoglError **error);
GError **error);
CoglBitmap *
_cogl_bitmap_from_file (CoglContext *ctx,
const char *filename,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_unpremult (CoglBitmap *dst_bmp,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_premult (CoglBitmap *dst_bmp,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglPixelFormat dst_format,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_copy_subregion (CoglBitmap *src,
CoglBitmap *dst,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height,
CoglError **error);
CoglBitmap *dst,
int src_x,
int src_y,
int dst_x,
int dst_y,
int width,
int height,
GError **error);
/* Creates a deep copy of the source bitmap */
CoglBitmap *
_cogl_bitmap_copy (CoglBitmap *src_bmp,
CoglError **error);
GError **error);
gboolean
_cogl_bitmap_get_size_from_file (const char *filename,
......@@ -172,7 +172,7 @@ uint8_t *
_cogl_bitmap_map (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
void
_cogl_bitmap_unmap (CoglBitmap *bitmap);
......@@ -190,7 +190,7 @@ uint8_t *
_cogl_bitmap_gl_bind (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error);
GError **error);
void
_cogl_bitmap_gl_unbind (CoglBitmap *bitmap);
......
......@@ -37,7 +37,6 @@
#include "cogl-buffer-private.h"
#include "cogl-pixel-buffer.h"
#include "cogl-context-private.h"
#include "cogl-error-private.h"
#include "cogl-gtype-private.h"
#include "driver/gl/cogl-buffer-gl-private.h"
......@@ -66,7 +65,7 @@ _cogl_bitmap_free (CoglBitmap *bmp)
gboolean
_cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglPixelFormat dst_format,
CoglError **error)
GError **error)
{
/* Do we need to unpremultiply? */
if ((bmp->format & COGL_PREMULT_BIT) > 0 &&
......@@ -86,7 +85,7 @@ _cogl_bitmap_convert_premult_status (CoglBitmap *bmp,
CoglBitmap *
_cogl_bitmap_copy (CoglBitmap *src_bmp,
CoglError **error)
GError **error)
{
CoglBitmap *dst_bmp;
CoglPixelFormat src_format = cogl_bitmap_get_format (src_bmp);
......@@ -124,7 +123,7 @@ _cogl_bitmap_copy_subregion (CoglBitmap *src,
int dst_y,
int width,
int height,
CoglError **error)
GError **error)
{
uint8_t *srcdata;
uint8_t *dstdata;
......@@ -209,7 +208,7 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
unsigned int width,
unsigned int height,
CoglPixelFormat format,
CoglError **error)
GError **error)
{
static CoglUserDataKey bitmap_free_key;
int bpp = _cogl_pixel_format_get_bytes_per_pixel (format);
......@@ -219,10 +218,9 @@ _cogl_bitmap_new_with_malloc_buffer (CoglContext *context,
if (!data)
{
_cogl_set_error (error,
COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Failed to allocate memory for bitmap");
g_set_error_literal (error, COGL_SYSTEM_ERROR,
COGL_SYSTEM_ERROR_NO_MEMORY,
"Failed to allocate memory for bitmap");
return NULL;
}
......@@ -261,7 +259,7 @@ _cogl_bitmap_new_shared (CoglBitmap *shared_bmp,
CoglBitmap *
cogl_bitmap_new_from_file (const char *filename,
CoglError **error)
GError **error)
{
_COGL_GET_CONTEXT (ctx, NULL);
......@@ -380,7 +378,7 @@ uint8_t *
_cogl_bitmap_map (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
/* Divert to another bitmap if this data is shared */
if (bitmap->shared_bmp)
......@@ -437,10 +435,10 @@ uint8_t *
_cogl_bitmap_gl_bind (CoglBitmap *bitmap,
CoglBufferAccess access,
CoglBufferMapHint hints,
CoglError **error)
GError **error)
{
uint8_t *ptr;
CoglError *internal_error = NULL;
GError *internal_error = NULL;
g_return_val_if_fail (access & (COGL_BUFFER_ACCESS_READ |
COGL_BUFFER_ACCESS_WRITE),
......@@ -482,7 +480,7 @@ _cogl_bitmap_gl_bind (CoglBitmap *bitmap,
* if an exception was thrown */
if (internal_error)
{
_cogl_propagate_error (error, internal_error);
g_propagate_error (error, internal_error);
return NULL;
}
......
......@@ -70,7 +70,7 @@ GType cogl_bitmap_get_gtype (void);
/**
* cogl_bitmap_new_from_file:
* @filename: the file to load.
* @error: a #CoglError or %NULL.
* @error: a #GError or %NULL.
*
* Loads an image file from disk. This function can be safely called from
* within a thread.
......@@ -82,7 +82,7 @@ GType cogl_bitmap_get_gtype (void);
*/
CoglBitmap *
cogl_bitmap_new_from_file (const char *filename,
CoglError **error);
GError **error);
/**
* cogl_bitmap_new_from_buffer: (skip)
......@@ -269,7 +269,7 @@ cogl_is_bitmap (void *object);
/**
* COGL_BITMAP_ERROR:
*
* #CoglError domain for bitmap errors.
* #GError domain for bitmap errors.
*
* Since: 1.4
*/
......
......@@ -41,7 +41,6 @@
#include "cogl-context-private.h"
#include "cogl-debug.h"
#include "cogl-blend-string.h"
#include "cogl-error-private.h"
typedef enum _ParserState
{
......@@ -166,7 +165,7 @@ _cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement,
static gboolean
validate_tex_combine_statements (CoglBlendStringStatement *statements,
int n_statements,
CoglError **error)
GError **error)
{
int i, j;
const char *error_string;
......@@ -195,11 +194,8 @@ validate_tex_combine_statements (CoglBlendStringStatement *statements,
return TRUE;
error:
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
detail,
"Invalid texture combine string: %s",
error_string);
g_set_error (error, COGL_BLEND_STRING_ERROR, detail,
"Invalid texture combine string: %s", error_string);
if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
......@@ -212,7 +208,7 @@ error:
static gboolean
validate_blend_statements (CoglBlendStringStatement *statements,
int n_statements,
CoglError **error)
GError **error)
{
int i, j;
const char *error_string;
......@@ -265,11 +261,8 @@ validate_blend_statements (CoglBlendStringStatement *statements,
return TRUE;
error:
_cogl_set_error (error,
COGL_BLEND_STRING_ERROR,
detail,
"Invalid blend string: %s",
error_string);
g_set_error (error, COGL_BLEND_STRING_ERROR, detail,
"Invalid blend string: %s", error_string);
return FALSE;
}
......@@ -277,7 +270,7 @@ static gboolean
validate_statements_for_context (CoglBlendStringStatement *statements,