From 70bacb9402fe0a84bacdc41d6e33f5ee6d6c1957 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Tue, 18 Jun 2019 08:02:10 +0200 Subject: [PATCH] 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. https://gitlab.gnome.org/GNOME/mutter/merge_requests/631 --- clutter/clutter/clutter-backend.c | 4 +- cogl/cogl-pango/cogl-pango-glyph-cache.c | 4 +- cogl/cogl/cogl-atlas-texture.c | 45 +++-- cogl/cogl/cogl-atlas-texture.h | 8 +- cogl/cogl/cogl-atlas.c | 14 +- cogl/cogl/cogl-attribute-buffer.c | 2 +- cogl/cogl/cogl-bitmap-conversion.c | 10 +- cogl/cogl/cogl-bitmap-pixbuf.c | 5 +- cogl/cogl/cogl-bitmap-private.h | 42 ++--- cogl/cogl/cogl-bitmap.c | 26 ++- cogl/cogl/cogl-bitmap.h | 6 +- cogl/cogl/cogl-blend-string.c | 68 ++++--- cogl/cogl/cogl-blend-string.h | 2 +- cogl/cogl/cogl-blit.c | 16 +- cogl/cogl/cogl-buffer-private.h | 8 +- cogl/cogl/cogl-buffer.c | 24 ++- cogl/cogl/cogl-buffer.h | 5 +- cogl/cogl/cogl-context-private.h | 2 +- cogl/cogl/cogl-context.c | 9 +- cogl/cogl/cogl-context.h | 4 +- cogl/cogl/cogl-display.c | 4 +- cogl/cogl/cogl-display.h | 4 +- cogl/cogl/cogl-driver.h | 14 +- cogl/cogl/cogl-error-private.h | 57 ------ cogl/cogl/cogl-error.c | 126 ------------- cogl/cogl/cogl-error.h | 169 ------------------ cogl/cogl/cogl-framebuffer-private.h | 2 +- cogl/cogl/cogl-framebuffer.c | 39 ++-- cogl/cogl/cogl-framebuffer.h | 4 +- cogl/cogl/cogl-gles2-context.c | 39 ++-- cogl/cogl/cogl-gles2.h | 8 +- cogl/cogl/cogl-indices.c | 4 +- cogl/cogl/cogl-journal.c | 4 +- cogl/cogl/cogl-mutter.h | 1 - cogl/cogl/cogl-offscreen.h | 2 +- cogl/cogl/cogl-pipeline-layer-state.c | 15 +- cogl/cogl/cogl-pipeline-layer-state.h | 8 +- cogl/cogl/cogl-pipeline-state.c | 15 +- cogl/cogl/cogl-pipeline-state.h | 14 +- cogl/cogl/cogl-pixel-buffer.c | 8 +- cogl/cogl/cogl-renderer.c | 55 +++--- cogl/cogl/cogl-renderer.h | 9 +- cogl/cogl/cogl-sub-texture.c | 4 +- cogl/cogl/cogl-texture-2d-sliced.c | 43 ++--- cogl/cogl/cogl-texture-2d-sliced.h | 8 +- cogl/cogl/cogl-texture-2d.c | 11 +- cogl/cogl/cogl-texture-2d.h | 12 +- cogl/cogl/cogl-texture-driver.h | 4 +- cogl/cogl/cogl-texture-private.h | 8 +- cogl/cogl/cogl-texture.c | 48 +++-- cogl/cogl/cogl-texture.h | 10 +- cogl/cogl/cogl-types.h | 2 +- cogl/cogl/cogl-xlib-renderer-private.h | 2 +- cogl/cogl/cogl-xlib-renderer.c | 7 +- cogl/cogl/cogl.h | 2 - cogl/cogl/cogl.symbols | 4 - cogl/cogl/deprecated/cogl-auto-texture.c | 29 ++- cogl/cogl/deprecated/cogl-auto-texture.h | 4 +- cogl/cogl/deprecated/cogl-material-compat.c | 8 +- cogl/cogl/deprecated/cogl-material-compat.h | 17 +- cogl/cogl/driver/gl/cogl-attribute-gl.c | 1 - cogl/cogl/driver/gl/cogl-buffer-gl-private.h | 6 +- cogl/cogl/driver/gl/cogl-buffer-gl.c | 21 ++- .../driver/gl/cogl-framebuffer-gl-private.h | 4 +- cogl/cogl/driver/gl/cogl-framebuffer-gl.c | 15 +- .../driver/gl/cogl-texture-2d-gl-private.h | 8 +- cogl/cogl/driver/gl/cogl-texture-2d-gl.c | 97 +++++----- cogl/cogl/driver/gl/cogl-util-gl-private.h | 2 +- cogl/cogl/driver/gl/cogl-util-gl.c | 9 +- cogl/cogl/driver/gl/gl/cogl-driver-gl.c | 25 ++- .../driver/gl/gl/cogl-texture-driver-gl.c | 13 +- cogl/cogl/driver/gl/gles/cogl-driver-gles.c | 5 +- .../driver/gl/gles/cogl-texture-driver-gles.c | 15 +- cogl/cogl/driver/nop/cogl-driver-nop.c | 3 +- .../driver/nop/cogl-framebuffer-nop-private.h | 4 +- cogl/cogl/driver/nop/cogl-framebuffer-nop.c | 4 +- .../driver/nop/cogl-texture-2d-nop-private.h | 4 +- cogl/cogl/driver/nop/cogl-texture-2d-nop.c | 5 +- cogl/cogl/libmutter-cogl.map.in | 1 - cogl/cogl/meson.build | 3 - cogl/cogl/winsys/cogl-texture-pixmap-x11.c | 42 ++--- cogl/cogl/winsys/cogl-texture-pixmap-x11.h | 10 +- cogl/cogl/winsys/cogl-winsys-egl-private.h | 12 +- cogl/cogl/winsys/cogl-winsys-egl-x11.c | 27 ++- cogl/cogl/winsys/cogl-winsys-egl.c | 33 ++-- cogl/cogl/winsys/cogl-winsys-glx.c | 108 ++++++----- cogl/cogl/winsys/cogl-winsys-private.h | 12 +- cogl/cogl/winsys/cogl-winsys-stub.c | 8 +- cogl/test-fixtures/test-utils.c | 24 ++- cogl/test-fixtures/test-utils.h | 2 +- cogl/tests/conform/test-blend-strings.c | 4 +- cogl/tests/conform/test-gles2-context.c | 12 +- cogl/tests/conform/test-just-vertex-shader.c | 4 +- cogl/tests/conform/test-multitexture.c | 2 +- .../tests/conform/test-pipeline-user-matrix.c | 2 +- cogl/tests/conform/test-point-sprite.c | 2 +- cogl/tests/conform/test-texture-no-allocate.c | 2 +- src/backends/meta-cursor-sprite-xcursor.c | 4 +- src/compositor/cogl-utils.c | 4 +- src/compositor/meta-background-image.c | 4 +- src/compositor/meta-background.c | 12 +- src/compositor/meta-shadow-factory.c | 4 +- src/compositor/meta-surface-actor-x11.c | 4 +- src/compositor/meta-texture-tower.c | 4 +- src/compositor/meta-window-actor.c | 4 +- 105 files changed, 648 insertions(+), 1071 deletions(-) delete mode 100644 cogl/cogl/cogl-error-private.h delete mode 100644 cogl/cogl/cogl-error.c delete mode 100644 cogl/cogl/cogl-error.h diff --git a/clutter/clutter/clutter-backend.c b/clutter/clutter/clutter-backend.c index d4b6a2d6b..82239133d 100644 --- a/clutter/clutter/clutter-backend.c +++ b/clutter/clutter/clutter-backend.c @@ -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; } } diff --git a/cogl/cogl-pango/cogl-pango-glyph-cache.c b/cogl/cogl-pango/cogl-pango-glyph-cache.c index f73074d1d..10b73d752 100644 --- a/cogl/cogl-pango/cogl-pango-glyph-cache.c +++ b/cogl/cogl-pango/cogl-pango-glyph-cache.c @@ -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; } diff --git a/cogl/cogl/cogl-atlas-texture.c b/cogl/cogl/cogl-atlas-texture.c index f73c2b9b0..e7f9c2125 100644 --- a/cogl/cogl/cogl-atlas-texture.c +++ b/cogl/cogl/cogl-atlas-texture.c @@ -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; diff --git a/cogl/cogl/cogl-atlas-texture.h b/cogl/cogl/cogl-atlas-texture.h index 34a4f86dd..2958ed0d8 100644 --- a/cogl/cogl/cogl-atlas-texture.h +++ b/cogl/cogl/cogl-atlas-texture.h @@ -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: diff --git a/cogl/cogl/cogl-atlas.c b/cogl/cogl/cogl-atlas.c index 1d52c2849..8bcb491bc 100644 --- a/cogl/cogl/cogl-atlas.c +++ b/cogl/cogl/cogl-atlas.c @@ -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; } diff --git a/cogl/cogl/cogl-attribute-buffer.c b/cogl/cogl/cogl-attribute-buffer.c index de00eb54b..6617de304 100644 --- a/cogl/cogl/cogl-attribute-buffer.c +++ b/cogl/cogl/cogl-attribute-buffer.c @@ -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 diff --git a/cogl/cogl/cogl-bitmap-conversion.c b/cogl/cogl/cogl-bitmap-conversion.c index fe71e4c71..447db00b3 100644 --- a/cogl/cogl/cogl-bitmap-conversion.c +++ b/cogl/cogl/cogl-bitmap-conversion.c @@ -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; diff --git a/cogl/cogl/cogl-bitmap-pixbuf.c b/cogl/cogl/cogl-bitmap-pixbuf.c index a47da9317..10af4966d 100644 --- a/cogl/cogl/cogl-bitmap-pixbuf.c +++ b/cogl/cogl/cogl-bitmap-pixbuf.c @@ -34,7 +34,6 @@ #include "cogl-bitmap-private.h" #include "cogl-context-private.h" #include "cogl-private.h" -#include "cogl-error-private.h" #include @@ -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; } diff --git a/cogl/cogl/cogl-bitmap-private.h b/cogl/cogl/cogl-bitmap-private.h index eb06ad0c7..e3877440a 100644 --- a/cogl/cogl/cogl-bitmap-private.h +++ b/cogl/cogl/cogl-bitmap-private.h @@ -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); diff --git a/cogl/cogl/cogl-bitmap.c b/cogl/cogl/cogl-bitmap.c index bc3ef36af..5d5dbc30a 100644 --- a/cogl/cogl/cogl-bitmap.c +++ b/cogl/cogl/cogl-bitmap.c @@ -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; } diff --git a/cogl/cogl/cogl-bitmap.h b/cogl/cogl/cogl-bitmap.h index ce9797283..6f5339ae0 100644 --- a/cogl/cogl/cogl-bitmap.h +++ b/cogl/cogl/cogl-bitmap.h @@ -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 */ diff --git a/cogl/cogl/cogl-blend-string.c b/cogl/cogl/cogl-blend-string.c index 28277ccf5..ec5ae7e8e 100644 --- a/cogl/cogl/cogl-blend-string.c +++ b/cogl/cogl/cogl-blend-string.c @@ -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, int n_statements, CoglBlendStringContext context, - CoglError **error) + GError **error) { const char *error_string; @@ -303,13 +296,12 @@ validate_statements_for_context (CoglBlendStringStatement *statements, return validate_tex_combine_statements (statements, n_statements, error); error: - _cogl_set_error (error, - COGL_BLEND_STRING_ERROR, - COGL_BLEND_STRING_ERROR_INVALID_ERROR, - "Invalid %s string: %s", - context == COGL_BLEND_STRING_CONTEXT_BLENDING ? - "blend" : "texture combine", - error_string); + g_set_error (error, COGL_BLEND_STRING_ERROR, + COGL_BLEND_STRING_ERROR_INVALID_ERROR, + "Invalid %s string: %s", + context == COGL_BLEND_STRING_CONTEXT_BLENDING ? + "blend" : "texture combine", + error_string); if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) { @@ -464,7 +456,7 @@ parse_argument (const char *string, /* original user string */ int current_arg, CoglBlendStringArgument *arg, /* OUT */ CoglBlendStringContext context, - CoglError **error) + GError **error) { const char *p = *ret_p; const char *mark = NULL; @@ -733,13 +725,13 @@ parse_argument (const char *string, /* original user string */ error: { int offset = p - string; - _cogl_set_error (error, - COGL_BLEND_STRING_ERROR, - COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR, - "Syntax error for argument %d at offset %d: %s", - current_arg, - offset, - error_string); + g_set_error (error, + COGL_BLEND_STRING_ERROR, + COGL_BLEND_STRING_ERROR_ARGUMENT_PARSE_ERROR, + "Syntax error for argument %d at offset %d: %s", + current_arg, + offset, + error_string); if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) { @@ -754,7 +746,7 @@ int _cogl_blend_string_compile (const char *string, CoglBlendStringContext context, CoglBlendStringStatement *statements, - CoglError **error) + GError **error) { const char *p = string; const char *mark = NULL; @@ -914,12 +906,12 @@ finished: error: { int offset = p - string; - _cogl_set_error (error, - COGL_BLEND_STRING_ERROR, - COGL_BLEND_STRING_ERROR_PARSE_ERROR, - "Syntax error at offset %d: %s", - offset, - error_string); + g_set_error (error, + COGL_BLEND_STRING_ERROR, + COGL_BLEND_STRING_ERROR_PARSE_ERROR, + "Syntax error at offset %d: %s", + offset, + error_string); if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS)) { @@ -971,7 +963,7 @@ _cogl_blend_string_test (void) }; int i; - CoglError *error = NULL; + GError *error = NULL; for (i = 0; strings[i].string; i++) { CoglBlendStringStatement statements[2]; @@ -984,7 +976,7 @@ _cogl_blend_string_test (void) g_print ("Failed to parse string:\n%s\n%s\n", strings[i].string, error->message); - cogl_error_free (error); + g_error_free (error); error = NULL; continue; } diff --git a/cogl/cogl/cogl-blend-string.h b/cogl/cogl/cogl-blend-string.h index ea198de1d..8333abad4 100644 --- a/cogl/cogl/cogl-blend-string.h +++ b/cogl/cogl/cogl-blend-string.h @@ -133,7 +133,7 @@ gboolean _cogl_blend_string_compile (const char *string, CoglBlendStringContext context, CoglBlendStringStatement *statements, - CoglError **error); + GError **error); void _cogl_blend_string_split_rgba_statement (CoglBlendStringStatement *statement, diff --git a/cogl/cogl/cogl-blit.c b/cogl/cogl/cogl-blit.c index c38b1a8e0..26a9b2993 100644 --- a/cogl/cogl/cogl-blit.c +++ b/cogl/cogl/cogl-blit.c @@ -52,7 +52,7 @@ _cogl_blit_texture_render_begin (CoglBlitData *data) CoglFramebuffer *fb; CoglPipeline *pipeline; unsigned int dst_width, dst_height; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; offscreen = _cogl_offscreen_new_with_texture_full (data->dst_tex, COGL_OFFSCREEN_DISABLE_DEPTH_AND_STENCIL, 0 /* level */); @@ -60,7 +60,7 @@ _cogl_blit_texture_render_begin (CoglBlitData *data) fb = COGL_FRAMEBUFFER (offscreen); if (!cogl_framebuffer_allocate (fb, &ignore_error)) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); cogl_object_unref (fb); return FALSE; } @@ -150,7 +150,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data) CoglContext *ctx = data->src_tex->context; CoglOffscreen *dst_offscreen = NULL, *src_offscreen = NULL; CoglFramebuffer *dst_fb, *src_fb; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; /* We can only blit between FBOs if both textures are the same format and the blit framebuffer extension is supported */ @@ -165,7 +165,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data) dst_fb = COGL_FRAMEBUFFER (dst_offscreen); if (!cogl_framebuffer_allocate (dst_fb, &ignore_error)) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); goto error; } @@ -177,7 +177,7 @@ _cogl_blit_framebuffer_begin (CoglBlitData *data) src_fb = COGL_FRAMEBUFFER (src_offscreen); if (!cogl_framebuffer_allocate (src_fb, &ignore_error)) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); goto error; } @@ -224,7 +224,7 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data) { CoglOffscreen *offscreen; CoglFramebuffer *fb; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; /* This will only work if the target texture is a CoglTexture2D */ if (!cogl_is_texture_2d (data->dst_tex)) @@ -236,7 +236,7 @@ _cogl_blit_copy_tex_sub_image_begin (CoglBlitData *data) fb = COGL_FRAMEBUFFER (offscreen); if (!cogl_framebuffer_allocate (fb, &ignore_error)) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); cogl_object_unref (fb); return FALSE; } @@ -292,7 +292,7 @@ _cogl_blit_get_tex_data_blit (CoglBlitData *data, int width, int height) { - CoglError *ignore = NULL; + GError *ignore = NULL; int rowstride = data->src_width * data->bpp; int offset = rowstride * src_y + src_x * data->bpp; diff --git a/cogl/cogl/cogl-buffer-private.h b/cogl/cogl/cogl-buffer-private.h index 2ac56659a..00bc06c76 100644 --- a/cogl/cogl/cogl-buffer-private.h +++ b/cogl/cogl/cogl-buffer-private.h @@ -53,7 +53,7 @@ struct _CoglBufferVtable size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error); + GError **error); void (* unmap) (CoglBuffer *buffer); @@ -61,7 +61,7 @@ struct _CoglBufferVtable unsigned int offset, const void *data, unsigned int size, - CoglError **error); + GError **error); }; typedef enum _CoglBufferFlags @@ -153,13 +153,13 @@ _cogl_buffer_set_data (CoglBuffer *buffer, size_t offset, const void *data, size_t size, - CoglError **error); + GError **error); void * _cogl_buffer_map (CoglBuffer *buffer, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error); + GError **error); /* This is a wrapper around cogl_buffer_map_range for internal use when we want to map the buffer for write only to replace the entire diff --git a/cogl/cogl/cogl-buffer.c b/cogl/cogl/cogl-buffer.c index 5df579076..620c24cb0 100644 --- a/cogl/cogl/cogl-buffer.c +++ b/cogl/cogl/cogl-buffer.c @@ -88,7 +88,7 @@ malloc_map_range (CoglBuffer *buffer, size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error) + GError **error) { buffer->flags |= COGL_BUFFER_FLAG_MAPPED; return buffer->data + offset; @@ -105,7 +105,7 @@ malloc_set_data (CoglBuffer *buffer, unsigned int offset, const void *data, unsigned int size, - CoglError **error) + GError **error) { memcpy (buffer->data + offset, data, size); return TRUE; @@ -223,7 +223,7 @@ void * _cogl_buffer_map (CoglBuffer *buffer, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error) + GError **error) { g_return_val_if_fail (cogl_is_buffer (buffer), NULL); @@ -235,12 +235,11 @@ cogl_buffer_map (CoglBuffer *buffer, CoglBufferAccess access, CoglBufferMapHint hints) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; void *ptr = cogl_buffer_map_range (buffer, 0, buffer->size, access, hints, &ignore_error); - if (!ptr) - cogl_error_free (ignore_error); + g_clear_error (&ignore_error); return ptr; } @@ -250,7 +249,7 @@ cogl_buffer_map_range (CoglBuffer *buffer, size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error) + GError **error) { g_return_val_if_fail (cogl_is_buffer (buffer), NULL); g_return_val_if_fail (!(buffer->flags & COGL_BUFFER_FLAG_MAPPED), NULL); @@ -293,7 +292,7 @@ _cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer, { CoglContext *ctx = buffer->context; void *ret; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; g_return_val_if_fail (!ctx->buffer_map_fallback_in_use, NULL); @@ -309,7 +308,7 @@ _cogl_buffer_map_range_for_fill_or_fallback (CoglBuffer *buffer, if (ret) return ret; - cogl_error_free (ignore_error); + g_error_free (ignore_error); /* If the map fails then we'll use a temporary buffer to fill the data and then upload it using cogl_buffer_set_data when @@ -364,7 +363,7 @@ _cogl_buffer_set_data (CoglBuffer *buffer, size_t offset, const void *data, size_t size, - CoglError **error) + GError **error) { g_return_val_if_fail (cogl_is_buffer (buffer), FALSE); g_return_val_if_fail ((offset + size) <= buffer->size, FALSE); @@ -381,11 +380,10 @@ cogl_buffer_set_data (CoglBuffer *buffer, const void *data, size_t size) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; gboolean status = _cogl_buffer_set_data (buffer, offset, data, size, &ignore_error); - if (!status) - cogl_error_free (ignore_error); + g_clear_error (&ignore_error); return status; } diff --git a/cogl/cogl/cogl-buffer.h b/cogl/cogl/cogl-buffer.h index b96de3f51..2964f638a 100644 --- a/cogl/cogl/cogl-buffer.h +++ b/cogl/cogl/cogl-buffer.h @@ -40,7 +40,6 @@ #define __COGL_BUFFER_H__ #include -#include G_BEGIN_DECLS @@ -258,7 +257,7 @@ cogl_buffer_map (CoglBuffer *buffer, * @access: how the mapped buffer will be used by the application * @hints: A mask of #CoglBufferMapHints that tell Cogl how * the data will be modified once mapped. - * @error: A #CoglError for catching exceptional errors + * @error: A #GError for catching exceptional errors * * Maps a sub-region of the buffer into the application's address space * for direct access. @@ -288,7 +287,7 @@ cogl_buffer_map_range (CoglBuffer *buffer, size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error); + GError **error); /** * cogl_buffer_unmap: diff --git a/cogl/cogl/cogl-context-private.h b/cogl/cogl/cogl-context-private.h index 59de2329b..7e87db7d8 100644 --- a/cogl/cogl/cogl-context-private.h +++ b/cogl/cogl/cogl-context-private.h @@ -363,7 +363,7 @@ _cogl_context_get_winsys (CoglContext *context); * return FALSE and set @error */ gboolean _cogl_context_update_features (CoglContext *context, - CoglError **error); + GError **error); /* Obtains the context and returns retval if NULL */ #define _COGL_GET_CONTEXT(ctxvar, retval) \ diff --git a/cogl/cogl/cogl-context.c b/cogl/cogl/cogl-context.c index 3f9bd11d5..d912ac429 100644 --- a/cogl/cogl/cogl-context.c +++ b/cogl/cogl/cogl-context.c @@ -47,7 +47,6 @@ #include "cogl1-context.h" #include "cogl-gpu-info-private.h" #include "cogl-config-private.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" #include "driver/gl/cogl-util-gl-private.h" @@ -123,7 +122,7 @@ _cogl_context_get_winsys (CoglContext *context) */ CoglContext * cogl_context_new (CoglDisplay *display, - CoglError **error) + GError **error) { CoglContext *context; uint8_t white_pixel[] = { 0xff, 0xff, 0xff, 0xff }; @@ -528,7 +527,7 @@ _cogl_context_free (CoglContext *context) CoglContext * _cogl_context_get_default (void) { - CoglError *error = NULL; + GError *error = NULL; /* Create if doesn't exist yet */ if (_cogl_context == NULL) { @@ -537,7 +536,7 @@ _cogl_context_get_default (void) { g_warning ("Failed to create default context: %s", error->message); - cogl_error_free (error); + g_error_free (error); } } @@ -558,7 +557,7 @@ cogl_context_get_renderer (CoglContext *context) gboolean _cogl_context_update_features (CoglContext *context, - CoglError **error) + GError **error) { return context->driver_vtable->update_features (context, error); } diff --git a/cogl/cogl/cogl-context.h b/cogl/cogl/cogl-context.h index ae501bdbb..c8dbf6622 100644 --- a/cogl/cogl/cogl-context.h +++ b/cogl/cogl/cogl-context.h @@ -104,7 +104,7 @@ GType cogl_context_get_gtype (void); /** * cogl_context_new: (constructor) * @display: (allow-none): A #CoglDisplay pointer - * @error: A CoglError return location. + * @error: A GError return location. * * Creates a new #CoglContext which acts as an application sandbox * for any state objects that are allocated. @@ -115,7 +115,7 @@ GType cogl_context_get_gtype (void); */ CoglContext * cogl_context_new (CoglDisplay *display, - CoglError **error); + GError **error); /** * cogl_context_get_display: diff --git a/cogl/cogl/cogl-display.c b/cogl/cogl/cogl-display.c index 4ce9d4315..5394dbf85 100644 --- a/cogl/cogl/cogl-display.c +++ b/cogl/cogl/cogl-display.c @@ -87,7 +87,7 @@ cogl_display_new (CoglRenderer *renderer, CoglOnscreenTemplate *onscreen_template) { CoglDisplay *display = g_slice_new0 (CoglDisplay); - CoglError *error = NULL; + GError *error = NULL; _cogl_init (); @@ -137,7 +137,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display, gboolean cogl_display_setup (CoglDisplay *display, - CoglError **error) + GError **error) { const CoglWinsysVtable *winsys; diff --git a/cogl/cogl/cogl-display.h b/cogl/cogl/cogl-display.h index 7e6310fe3..3a51dd75a 100644 --- a/cogl/cogl/cogl-display.h +++ b/cogl/cogl/cogl-display.h @@ -158,7 +158,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display, /** * cogl_display_setup: * @display: a #CoglDisplay - * @error: return location for a #CoglError + * @error: return location for a #GError * * Explicitly sets up the given @display object. Use of this api is * optional since Cogl will internally setup the display if not done @@ -188,7 +188,7 @@ cogl_display_set_onscreen_template (CoglDisplay *display, */ gboolean cogl_display_setup (CoglDisplay *display, - CoglError **error); + GError **error); /** * cogl_is_display: diff --git a/cogl/cogl/cogl-driver.h b/cogl/cogl/cogl-driver.h index 86682d8a7..295de92cf 100644 --- a/cogl/cogl/cogl-driver.h +++ b/cogl/cogl/cogl-driver.h @@ -58,11 +58,11 @@ struct _CoglDriverVtable gboolean (* update_features) (CoglContext *context, - CoglError **error); + GError **error); gboolean (* offscreen_allocate) (CoglOffscreen *offscreen, - CoglError **error); + GError **error); void (* offscreen_free) (CoglOffscreen *offscreen); @@ -118,7 +118,7 @@ struct _CoglDriverVtable int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error); + GError **error); /* Destroys any driver specific resources associated with the given * 2D texture. */ @@ -146,7 +146,7 @@ struct _CoglDriverVtable * to the configured size and format of the texture */ gboolean (* texture_2d_allocate) (CoglTexture *tex, - CoglError **error); + GError **error); /* Initialize the specified region of storage of the given texture * with the contents of the specified framebuffer region @@ -190,7 +190,7 @@ struct _CoglDriverVtable int dst_x, int dst_y, int level, - CoglError **error); + GError **error); gboolean (* texture_2d_is_get_data_supported) (CoglTexture2D *tex_2d); @@ -239,7 +239,7 @@ struct _CoglDriverVtable size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error); + GError **error); /* Unmaps a buffer */ void @@ -252,7 +252,7 @@ struct _CoglDriverVtable unsigned int offset, const void *data, unsigned int size, - CoglError **error); + GError **error); }; #define COGL_DRIVER_ERROR (_cogl_driver_error_quark ()) diff --git a/cogl/cogl/cogl-error-private.h b/cogl/cogl/cogl-error-private.h deleted file mode 100644 index 382fc449f..000000000 --- a/cogl/cogl/cogl-error-private.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2012 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#ifndef __COGL_ERROR_PRIVATE_H__ -#define __COGL_ERROR_PRIVATE_H__ - -#include "cogl-error.h" - -void -_cogl_set_error (CoglError **error, - uint32_t domain, - int code, - const char *format, - ...) G_GNUC_PRINTF (4, 5); - -void -_cogl_set_error_literal (CoglError **error, - uint32_t domain, - int code, - const char *message); - -void -_cogl_propagate_error (CoglError **dest, - CoglError *src); - -void -_cogl_propagate_gerror (CoglError **dest, - GError *src); - -#define _cogl_clear_error(X) g_clear_error ((GError **)X) - -#endif /* __COGL_ERROR_PRIVATE_H__ */ diff --git a/cogl/cogl/cogl-error.c b/cogl/cogl/cogl-error.c deleted file mode 100644 index 391a053e8..000000000 --- a/cogl/cogl/cogl-error.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2011 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Authors: - * Robert Bragg - */ - -#include "cogl-config.h" - -#include "cogl-types.h" -#include "cogl-util.h" -#include "cogl-error-private.h" - -#include - -void -cogl_error_free (CoglError *error) -{ - g_error_free ((GError *)error); -} - -CoglError * -cogl_error_copy (CoglError *error) -{ - return (CoglError *)g_error_copy ((GError *)error); -} - -gboolean -cogl_error_matches (CoglError *error, - uint32_t domain, - int code) -{ - return g_error_matches ((GError *)error, domain, code); -} - -#define ERROR_OVERWRITTEN_WARNING \ - "CoglError set over the top of a previous CoglError or " \ - "uninitialized memory.\nThis indicates a bug in someone's " \ - "code. You must ensure an error is NULL before it's set.\n" \ - "The overwriting error message was: %s" - -void -_cogl_set_error (CoglError **error, - uint32_t domain, - int code, - const char *format, - ...) -{ - GError *new; - - va_list args; - - va_start (args, format); - - if (error == NULL) - { - g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args); - va_end (args); - return; - } - - new = g_error_new_valist (domain, code, format, args); - va_end (args); - - if (*error == NULL) - *error = (CoglError *)new; - else - g_warning (ERROR_OVERWRITTEN_WARNING, new->message); -} - -void -_cogl_set_error_literal (CoglError **error, - uint32_t domain, - int code, - const char *message) -{ - _cogl_set_error (error, domain, code, "%s", message); -} - -void -_cogl_propagate_error (CoglError **dest, - CoglError *src) -{ - g_return_if_fail (src != NULL); - - if (dest == NULL) - { - g_log (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, "%s", src->message); - cogl_error_free (src); - } - else if (*dest) - g_warning (ERROR_OVERWRITTEN_WARNING, src->message); - else - *dest = src; -} - -void -_cogl_propagate_gerror (CoglError **dest, - GError *src) -{ - _cogl_propagate_error (dest, (CoglError *) src); -} diff --git a/cogl/cogl/cogl-error.h b/cogl/cogl/cogl-error.h deleted file mode 100644 index 4dc2073b3..000000000 --- a/cogl/cogl/cogl-error.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Cogl - * - * A Low Level GPU Graphics and Utilities API - * - * Copyright (C) 2012 Intel Corporation. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION) -#error "Only can be included directly." -#endif - -#ifndef __COGL_ERROR_H__ -#define __COGL_ERROR_H__ - -#include "cogl-types.h" - -G_BEGIN_DECLS - -/** - * SECTION:cogl-error - * @short_description: A way for Cogl to throw exceptions - * - * As a general rule Cogl shields non-recoverable errors from - * developers, such as most heap allocation failures (unless for - * exceptionally large resources which we might reasonably expect to - * fail) and this reduces the burden on developers. - * - * There are some Cogl apis though that can fail for exceptional - * reasons that can also potentially be recovered from at runtime - * and for these apis we use a standard convention for reporting - * runtime recoverable errors. - * - * As an example if we look at the cogl_context_new() api which - * takes an error argument: - * |[ - * CoglContext * - * cogl_context_new (CoglDisplay *display, CoglError **error); - * ]| - * - * A caller interested in catching any runtime error when creating a - * new #CoglContext would pass the address of a #CoglError pointer - * that has first been initialized to %NULL as follows: - * - * |[ - * CoglError *error = NULL; - * CoglContext *context; - * - * context = cogl_context_new (NULL, &error); - * ]| - * - * The return status should usually be enough to determine if there - * was an error set (in this example we can check if context == %NULL) - * but if it's not possible to tell from the function's return status - * you can instead look directly at the error pointer which you - * initialized to %NULL. In this example we now check the error, - * report any error to the user, free the error and then simply - * abort without attempting to recover. - * - * |[ - * if (context == NULL) - * { - * fprintf (stderr, "Failed to create a Cogl context: %s\n", - * error->message); - * cogl_error_free (error); - * abort (); - * } - * ]| - * - * All Cogl APIs that accept an error argument can also be passed a - * %NULL pointer. In this case if an exceptional error condition is hit - * then Cogl will simply log the error message and abort the - * application. This can be compared to language execeptions where the - * developer has not attempted to catch the exception. This means the - * above example is essentially redundant because it's what Cogl would - * have done automatically and so, similarly, if your application has - * no way to recover from a particular error you might just as well - * pass a %NULL #CoglError pointer to save a bit of typing. - * - * If you are used to using the GLib API you will probably - * recognize that #CoglError is just like a #GError. In fact if Cogl - * has been built with --enable-glib then it is safe to cast a - * #CoglError to a #GError. - * - * An important detail to be aware of if you are used to using - * GLib's GError API is that Cogl deviates from the GLib GError - * conventions in one noteable way which is that a %NULL error pointer - * does not mean you want to ignore the details of an error, it means - * you are not trying to catch any exceptional errors the function might - * throw which will result in the program aborting with a log message - * if an error is thrown. - */ - -#define CoglError GError - -/** - * cogl_error_free: - * @error: A #CoglError thrown by the Cogl api - * - * Frees a #CoglError and associated resources. - */ -void -cogl_error_free (CoglError *error); - -/** - * cogl_error_copy: - * @error: A #CoglError thrown by the Cogl api - * - * Makes a copy of @error which can later be freed using - * cogl_error_free(). - * - * Return value: A newly allocated #CoglError initialized to match the - * contents of @error. - */ -CoglError * -cogl_error_copy (CoglError *error); - -/** - * cogl_error_matches: - * @error: A #CoglError thrown by the Cogl api or %NULL - * @domain: The error domain - * @code: The error code - * - * Returns %TRUE if error matches @domain and @code, %FALSE otherwise. - * In particular, when error is %NULL, FALSE will be returned. - * - * Return value: whether the @error corresponds to the given @domain - * and @code. - */ -gboolean -cogl_error_matches (CoglError *error, - uint32_t domain, - int code); - -/** - * COGL_GLIB_ERROR: - * @COGL_ERROR: A #CoglError thrown by the Cogl api or %NULL - * - * Simply casts a #CoglError to a #CoglError - * - * If Cogl is built with GLib support then it can safely be assumed - * that a CoglError is a GError and can be used directly with the - * GError api. - */ -#define COGL_GLIB_ERROR(COGL_ERROR) ((CoglError *)COGL_ERROR) - -G_END_DECLS - -#endif /* __COGL_ERROR_H__ */ diff --git a/cogl/cogl/cogl-framebuffer-private.h b/cogl/cogl/cogl-framebuffer-private.h index 94667c6cf..0c361e2be 100644 --- a/cogl/cogl/cogl-framebuffer-private.h +++ b/cogl/cogl/cogl-framebuffer-private.h @@ -497,7 +497,7 @@ _cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error); + GError **error); /* * _cogl_framebuffer_get_stencil_bits: diff --git a/cogl/cogl/cogl-framebuffer.c b/cogl/cogl/cogl-framebuffer.c index c991e28f4..de9bfb451 100644 --- a/cogl/cogl/cogl-framebuffer.c +++ b/cogl/cogl/cogl-framebuffer.c @@ -50,7 +50,6 @@ #include "cogl1-context.h" #include "cogl-private.h" #include "cogl-primitives-private.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-texture-gl-private.h" #include "winsys/cogl-winsys-private.h" @@ -650,12 +649,12 @@ CoglOffscreen * cogl_offscreen_new_to_texture (CoglTexture *texture) { CoglOffscreen *ret = _cogl_offscreen_new_with_texture_full (texture, 0, 0); - CoglError *error = NULL; + GError *error = NULL; if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (ret), &error)) { cogl_object_unref (ret); - cogl_error_free (error); + g_error_free (error); ret = NULL; } @@ -696,7 +695,7 @@ _cogl_offscreen_free (CoglOffscreen *offscreen) gboolean cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, - CoglError **error) + GError **error) { CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer); const CoglWinsysVtable *winsys = _cogl_framebuffer_get_winsys (framebuffer); @@ -709,10 +708,10 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, { if (framebuffer->config.depth_texture_enabled) { - _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, - COGL_FRAMEBUFFER_ERROR_ALLOCATE, - "Can't allocate onscreen framebuffer with a " - "texture based depth buffer"); + g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Can't allocate onscreen framebuffer with a " + "texture based depth buffer"); return FALSE; } @@ -732,9 +731,9 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) { - _cogl_set_error (error, COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Offscreen framebuffers not supported by system"); + g_set_error_literal (error, COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Offscreen framebuffers not supported by system"); return FALSE; } @@ -745,10 +744,9 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, * determine whether a texture needs slicing... */ if (cogl_texture_is_sliced (offscreen->texture)) { - _cogl_set_error (error, COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Can't create offscreen framebuffer from " - "sliced texture"); + g_set_error (error, COGL_SYSTEM_ERROR, COGL_SYSTEM_ERROR_UNSUPPORTED, + "Can't create offscreen framebuffer from " + "sliced texture"); return FALSE; } @@ -1212,7 +1210,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer, y < framebuffer->clear_clip_y1) { uint8_t *pixel; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; /* we currently only care about cases where the premultiplied or * unpremultipled colors are equivalent... */ @@ -1225,7 +1223,7 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer, &ignore_error); if (pixel == NULL) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); return FALSE; } @@ -1248,7 +1246,7 @@ _cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error) + GError **error) { CoglContext *ctx; int width; @@ -1299,13 +1297,12 @@ cogl_framebuffer_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, CoglReadPixelsFlags source, CoglBitmap *bitmap) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; gboolean status = _cogl_framebuffer_read_pixels_into_bitmap (framebuffer, x, y, source, bitmap, &ignore_error); - if (!status) - cogl_error_free (ignore_error); + g_clear_error (&ignore_error); return status; } diff --git a/cogl/cogl/cogl-framebuffer.h b/cogl/cogl/cogl-framebuffer.h index 867971bcf..eeaff0f6f 100644 --- a/cogl/cogl/cogl-framebuffer.h +++ b/cogl/cogl/cogl-framebuffer.h @@ -106,7 +106,7 @@ GType cogl_framebuffer_get_gtype (void); /** * cogl_framebuffer_allocate: * @framebuffer: A #CoglFramebuffer - * @error: A pointer to a #CoglError for returning exceptions. + * @error: A pointer to a #GError for returning exceptions. * * Explicitly allocates a configured #CoglFramebuffer allowing developers to * check and handle any errors that might arise from an unsupported @@ -125,7 +125,7 @@ GType cogl_framebuffer_get_gtype (void); */ gboolean cogl_framebuffer_allocate (CoglFramebuffer *framebuffer, - CoglError **error); + GError **error); /** * cogl_framebuffer_get_width: diff --git a/cogl/cogl/cogl-gles2-context.c b/cogl/cogl/cogl-gles2-context.c index 79d77a9bf..e51b72276 100644 --- a/cogl/cogl/cogl-gles2-context.c +++ b/cogl/cogl/cogl-gles2-context.c @@ -48,7 +48,6 @@ #include "cogl-swap-chain-private.h" #include "cogl-texture-2d-gl.h" #include "cogl-texture-2d-private.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-framebuffer-gl-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" @@ -1566,16 +1565,16 @@ free_texture_object_data (CoglGLES2TextureObjectData *data) } CoglGLES2Context * -cogl_gles2_context_new (CoglContext *ctx, CoglError **error) +cogl_gles2_context_new (CoglContext *ctx, GError **error) { CoglGLES2Context *gles2_ctx; const CoglWinsysVtable *winsys; if (!cogl_has_feature (ctx, COGL_FEATURE_ID_GLES2_CONTEXT)) { - _cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR, - COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, - "Backend doesn't support creating GLES2 contexts"); + g_set_error_literal (error, COGL_GLES2_CONTEXT_ERROR, + COGL_GLES2_CONTEXT_ERROR_UNSUPPORTED, + "Backend doesn't support creating GLES2 contexts"); return NULL; } @@ -1693,11 +1692,11 @@ cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx) static CoglGLES2Offscreen * _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen, CoglGLES2Context *gles2_context, - CoglError **error) + GError **error) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (offscreen); const CoglWinsysVtable *winsys; - CoglError *internal_error = NULL; + GError *internal_error = NULL; CoglGLES2Offscreen *gles2_offscreen; int level_width; int level_height; @@ -1722,10 +1721,10 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen, { winsys->restore_context (framebuffer->context); - cogl_error_free (internal_error); - _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, - COGL_FRAMEBUFFER_ERROR_ALLOCATE, - "Failed to bind gles2 context to create framebuffer"); + g_error_free (internal_error); + g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to bind gles2 context to create framebuffer"); return NULL; } @@ -1751,9 +1750,9 @@ _cogl_gles2_offscreen_allocate (CoglOffscreen *offscreen, g_slice_free (CoglGLES2Offscreen, gles2_offscreen); - _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, - COGL_FRAMEBUFFER_ERROR_ALLOCATE, - "Failed to create an OpenGL framebuffer object"); + g_set_error_literal (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to create an OpenGL framebuffer object"); return NULL; } @@ -1781,10 +1780,10 @@ cogl_push_gles2_context (CoglContext *ctx, CoglGLES2Context *gles2_ctx, CoglFramebuffer *read_buffer, CoglFramebuffer *write_buffer, - CoglError **error) + GError **error) { const CoglWinsysVtable *winsys = ctx->display->renderer->winsys_vtable; - CoglError *internal_error = NULL; + GError *internal_error = NULL; g_return_val_if_fail (gles2_ctx != NULL, FALSE); @@ -1863,10 +1862,10 @@ cogl_push_gles2_context (CoglContext *ctx, { winsys->restore_context (ctx); - cogl_error_free (internal_error); - _cogl_set_error (error, COGL_GLES2_CONTEXT_ERROR, - COGL_GLES2_CONTEXT_ERROR_DRIVER, - "Driver failed to make GLES2 context current"); + g_error_free (internal_error); + g_set_error_literal (error, COGL_GLES2_CONTEXT_ERROR, + COGL_GLES2_CONTEXT_ERROR_DRIVER, + "Driver failed to make GLES2 context current"); return FALSE; } diff --git a/cogl/cogl/cogl-gles2.h b/cogl/cogl/cogl-gles2.h index 46daf62ac..587880e70 100644 --- a/cogl/cogl/cogl-gles2.h +++ b/cogl/cogl/cogl-gles2.h @@ -189,7 +189,7 @@ typedef enum /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/ /** * cogl_gles2_context_new: * @ctx: A #CoglContext - * @error: A pointer to a #CoglError for returning exceptions + * @error: A pointer to a #GError for returning exceptions * * Allocates a new OpenGLES 2.0 context that can be used to render to * #CoglOffscreen framebuffers (Rendering to #CoglOnscreen @@ -216,7 +216,7 @@ typedef enum /*< prefix=COGL_GLES2_CONTEXT_ERROR >*/ * Stability: unstable */ CoglGLES2Context * -cogl_gles2_context_new (CoglContext *ctx, CoglError **error); +cogl_gles2_context_new (CoglContext *ctx, GError **error); /** * cogl_gles2_context_get_vtable: @@ -248,7 +248,7 @@ cogl_gles2_context_get_vtable (CoglGLES2Context *gles2_ctx); * @write_buffer: A #CoglFramebuffer to access for drawing operations * such as glDrawArrays. (must be a #CoglOffscreen * framebuffer currently) - * @error: A pointer to a #CoglError for returning exceptions + * @error: A pointer to a #GError for returning exceptions * * Pushes the given @gles2_ctx onto a stack associated with @ctx so * that the OpenGLES 2.0 api can be used instead of the Cogl @@ -272,7 +272,7 @@ cogl_push_gles2_context (CoglContext *ctx, CoglGLES2Context *gles2_ctx, CoglFramebuffer *read_buffer, CoglFramebuffer *write_buffer, - CoglError **error); + GError **error); /** * cogl_pop_gles2_context: diff --git a/cogl/cogl/cogl-indices.c b/cogl/cogl/cogl-indices.c index a24c9a0a4..5fac91a2e 100644 --- a/cogl/cogl/cogl-indices.c +++ b/cogl/cogl/cogl-indices.c @@ -91,7 +91,7 @@ cogl_indices_new (CoglContext *context, CoglIndexBuffer *index_buffer = cogl_index_buffer_new (context, buffer_bytes); CoglBuffer *buffer = COGL_BUFFER (index_buffer); CoglIndices *indices; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; _cogl_buffer_set_data (buffer, 0, @@ -100,7 +100,7 @@ cogl_indices_new (CoglContext *context, &ignore_error); if (ignore_error) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); cogl_object_unref (index_buffer); return NULL; } diff --git a/cogl/cogl/cogl-journal.c b/cogl/cogl/cogl-journal.c index 46b1fae36..083f4a3d4 100644 --- a/cogl/cogl/cogl-journal.c +++ b/cogl/cogl/cogl-journal.c @@ -1786,7 +1786,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal, float poly[16]; CoglFramebuffer *framebuffer = journal->framebuffer; uint8_t *pixel; - CoglError *ignore_error; + GError *ignore_error; entry_to_screen_polygon (framebuffer, entry, vertices, poly); @@ -1831,7 +1831,7 @@ _cogl_journal_try_read_pixel (CoglJournal *journal, &ignore_error); if (pixel == NULL) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); return FALSE; } diff --git a/cogl/cogl/cogl-mutter.h b/cogl/cogl/cogl-mutter.h index 854e0fd09..ab1d0094b 100644 --- a/cogl/cogl/cogl-mutter.h +++ b/cogl/cogl/cogl-mutter.h @@ -36,7 +36,6 @@ #include #include -#include #include #include #if defined (COGL_HAS_EGL_SUPPORT) diff --git a/cogl/cogl/cogl-offscreen.h b/cogl/cogl/cogl-offscreen.h index dd2fae58f..461b364f0 100644 --- a/cogl/cogl/cogl-offscreen.h +++ b/cogl/cogl/cogl-offscreen.h @@ -90,7 +90,7 @@ GType cogl_offscreen_get_gtype (void); * message. If you need to be able to catch such exceptions at runtime * then you can explicitly allocate your framebuffer when you have * finished configuring it by calling cogl_framebuffer_allocate() and - * passing in a #CoglError argument to catch any exceptions. + * passing in a #GError argument to catch any exceptions. * * Return value: (transfer full): a newly instantiated #CoglOffscreen * framebuffer. diff --git a/cogl/cogl/cogl-pipeline-layer-state.c b/cogl/cogl/cogl-pipeline-layer-state.c index 3bf82cde3..9b3feaa0f 100644 --- a/cogl/cogl/cogl-pipeline-layer-state.c +++ b/cogl/cogl/cogl-pipeline-layer-state.c @@ -41,7 +41,6 @@ #include "cogl-snippet-private.h" #include "cogl-texture-private.h" #include "cogl-pipeline-layer-state-private.h" -#include "cogl-error-private.h" #include "string.h" #if 0 @@ -602,7 +601,7 @@ gboolean cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, int layer_index, gboolean enable, - CoglError **error) + GError **error) { CoglPipelineLayerState change = COGL_PIPELINE_LAYER_STATE_POINT_SPRITE_COORDS; @@ -620,11 +619,11 @@ cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, { if (error) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Point sprite texture coordinates are enabled for " - "a layer but the GL driver does not support it."); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Point sprite texture coordinates are enabled for " + "a layer but the GL driver does not support it."); } else { @@ -1029,7 +1028,7 @@ gboolean cogl_pipeline_set_layer_combine (CoglPipeline *pipeline, int layer_index, const char *combine_description, - CoglError **error) + GError **error) { CoglPipelineLayerState state = COGL_PIPELINE_LAYER_STATE_COMBINE; CoglPipelineLayer *authority; diff --git a/cogl/cogl/cogl-pipeline-layer-state.h b/cogl/cogl/cogl-pipeline-layer-state.h index 5fb1da03c..106f50f38 100644 --- a/cogl/cogl/cogl-pipeline-layer-state.h +++ b/cogl/cogl/cogl-pipeline-layer-state.h @@ -209,7 +209,7 @@ cogl_pipeline_remove_layer (CoglPipeline *pipeline, * @layer_index: Specifies the layer you want define a combine function for * @blend_string: A Cogl blend string * describing the desired texture combine function. - * @error: A #CoglError that may report parse errors or lack of GPU/driver + * @error: A #GError that may report parse errors or lack of GPU/driver * support. May be %NULL, in which case a warning will be printed out if an * error is encountered. * @@ -301,7 +301,7 @@ gboolean cogl_pipeline_set_layer_combine (CoglPipeline *pipeline, int layer_index, const char *blend_string, - CoglError **error); + GError **error); /** * cogl_pipeline_set_layer_combine_constant: @@ -423,7 +423,7 @@ cogl_pipeline_get_layer_mag_filter (CoglPipeline *pipeline, * @pipeline: A #CoglPipeline object * @layer_index: the layer number to change. * @enable: whether to enable point sprite coord generation. - * @error: A return location for a CoglError, or NULL to ignore errors. + * @error: A return location for a #GError, or NULL to ignore errors. * * When rendering points, if @enable is %TRUE then the texture * coordinates for this layer will be replaced with coordinates that @@ -444,7 +444,7 @@ gboolean cogl_pipeline_set_layer_point_sprite_coords_enabled (CoglPipeline *pipeline, int layer_index, gboolean enable, - CoglError **error); + GError **error); /** * cogl_pipeline_get_layer_point_sprite_coords_enabled: diff --git a/cogl/cogl/cogl-pipeline-state.c b/cogl/cogl/cogl-pipeline-state.c index 93e7dbf8f..245e2c872 100644 --- a/cogl/cogl/cogl-pipeline-state.c +++ b/cogl/cogl/cogl-pipeline-state.c @@ -40,7 +40,6 @@ #include "cogl-depth-state-private.h" #include "cogl-pipeline-state-private.h" #include "cogl-snippet-private.h" -#include "cogl-error-private.h" #include @@ -946,7 +945,7 @@ setup_blend_state (CoglBlendStringStatement *statement, gboolean cogl_pipeline_set_blend (CoglPipeline *pipeline, const char *blend_description, - CoglError **error) + GError **error) { CoglPipelineState state = COGL_PIPELINE_STATE_BLEND; CoglPipeline *authority; @@ -1144,7 +1143,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline, gboolean cogl_pipeline_set_depth_state (CoglPipeline *pipeline, const CoglDepthState *depth_state, - CoglError **error) + GError **error) { CoglPipelineState state = COGL_PIPELINE_STATE_DEPTH; CoglPipeline *authority; @@ -1389,7 +1388,7 @@ cogl_pipeline_set_point_size (CoglPipeline *pipeline, gboolean cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline, gboolean enable, - CoglError **error) + GError **error) { CoglPipelineState state = COGL_PIPELINE_STATE_PER_VERTEX_POINT_SIZE; CoglPipeline *authority; @@ -1406,10 +1405,10 @@ cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline, if (enable && !cogl_has_feature (ctx, COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE)) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Per-vertex point size is not supported"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Per-vertex point size is not supported"); return FALSE; } diff --git a/cogl/cogl/cogl-pipeline-state.h b/cogl/cogl/cogl-pipeline-state.h index 5ac9bc9d3..6e45da3cf 100644 --- a/cogl/cogl/cogl-pipeline-state.h +++ b/cogl/cogl/cogl-pipeline-state.h @@ -390,7 +390,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline); * @pipeline: A #CoglPipeline object * @blend_string: A Cogl blend string * describing the desired blend function. - * @error: return location for a #CoglError that may report lack of driver + * @error: return location for a #GError that may report lack of driver * support if you give separate blend string statements for the alpha * channel and RGB channels since some drivers, or backends such as * GLES 1.1, don't support this feature. May be %NULL, in which case a @@ -470,7 +470,7 @@ cogl_pipeline_get_alpha_test_reference (CoglPipeline *pipeline); gboolean cogl_pipeline_set_blend (CoglPipeline *pipeline, const char *blend_string, - CoglError **error); + GError **error); /** * cogl_pipeline_set_blend_constant: @@ -531,7 +531,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline); * cogl_pipeline_set_per_vertex_point_size: * @pipeline: a #CoglPipeline pointer * @enable: whether to enable per-vertex point size - * @error: a location to store a #CoglError if the change failed + * @error: a location to store a #GError if the change failed * * Sets whether to use a per-vertex point size or to use the value set * by cogl_pipeline_set_point_size(). If per-vertex point size is @@ -547,7 +547,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline); * Note that enabling this will only work if the * %COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE feature is available. If * this is not available then the function will return %FALSE and set - * a #CoglError. + * a #GError. * * Since: 2.0 * Stability: Unstable @@ -556,7 +556,7 @@ cogl_pipeline_get_point_size (CoglPipeline *pipeline); gboolean cogl_pipeline_set_per_vertex_point_size (CoglPipeline *pipeline, gboolean enable, - CoglError **error); + GError **error); /** * cogl_pipeline_get_per_vertex_point_size: @@ -637,7 +637,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline, * cogl_pipeline_set_depth_state: (skip) * @pipeline: A #CoglPipeline object * @state: A #CoglDepthState struct - * @error: A #CoglError to report failures to setup the given @state. + * @error: A #GError to report failures to setup the given @state. * * This commits all the depth state configured in @state struct to the * given @pipeline. The configuration values are copied into the @@ -656,7 +656,7 @@ cogl_pipeline_set_user_program (CoglPipeline *pipeline, gboolean cogl_pipeline_set_depth_state (CoglPipeline *pipeline, const CoglDepthState *state, - CoglError **error); + GError **error); /** * cogl_pipeline_get_depth_state: (skip) diff --git a/cogl/cogl/cogl-pixel-buffer.c b/cogl/cogl/cogl-pixel-buffer.c index 7deb0f504..7abebaccc 100644 --- a/cogl/cogl/cogl-pixel-buffer.c +++ b/cogl/cogl/cogl-pixel-buffer.c @@ -77,7 +77,7 @@ static CoglPixelBuffer * _cogl_pixel_buffer_new (CoglContext *context, size_t size, const void *data, - CoglError **error) + GError **error) { CoglPixelBuffer *pixel_buffer = g_slice_new0 (CoglPixelBuffer); CoglBuffer *buffer = COGL_BUFFER (pixel_buffer); @@ -113,11 +113,11 @@ cogl_pixel_buffer_new (CoglContext *context, size_t size, const void *data) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; CoglPixelBuffer *buffer = _cogl_pixel_buffer_new (context, size, data, &ignore_error); - if (!buffer) - cogl_error_free (ignore_error); + + g_clear_error (&ignore_error); return buffer; } diff --git a/cogl/cogl/cogl-renderer.c b/cogl/cogl/cogl-renderer.c index af1054b05..e4319bac5 100644 --- a/cogl/cogl/cogl-renderer.c +++ b/cogl/cogl/cogl-renderer.c @@ -44,7 +44,6 @@ #include "cogl-renderer-private.h" #include "cogl-display-private.h" #include "cogl-config-private.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-util-gl-private.h" @@ -284,7 +283,7 @@ cogl_xlib_renderer_set_threaded_swap_wait_enabled (CoglRenderer *renderer, gboolean cogl_renderer_check_onscreen_template (CoglRenderer *renderer, CoglOnscreenTemplate *onscreen_template, - CoglError **error) + GError **error) { CoglDisplay *display; @@ -432,7 +431,7 @@ satisfy_constraints (CoglDriverDescription *description, static gboolean _cogl_renderer_choose_driver (CoglRenderer *renderer, - CoglError **error) + GError **error) { const char *driver_name = g_getenv ("COGL_DRIVER"); CoglDriver driver_override = COGL_DRIVER_ANY; @@ -457,11 +456,10 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer, if (driver_override != COGL_DRIVER_ANY && renderer->driver_override != driver_override) { - _cogl_set_error (error, - COGL_RENDERER_ERROR, - COGL_RENDERER_ERROR_BAD_CONSTRAINT, - "Application driver selection conflicts with driver " - "specified in configuration"); + g_set_error (error, COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "Application driver selection conflicts with driver " + "specified in configuration"); return FALSE; } @@ -487,11 +485,10 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer, if (invalid_override) { - _cogl_set_error (error, - COGL_RENDERER_ERROR, - COGL_RENDERER_ERROR_BAD_CONSTRAINT, - "Driver \"%s\" is not available", - invalid_override); + g_set_error (error, COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "Driver \"%s\" is not available", + invalid_override); return FALSE; } @@ -504,10 +501,9 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer, if (!state.driver_description) { - _cogl_set_error (error, - COGL_RENDERER_ERROR, - COGL_RENDERER_ERROR_BAD_CONSTRAINT, - "No suitable driver found"); + g_set_error (error, COGL_RENDERER_ERROR, + COGL_RENDERER_ERROR_BAD_CONSTRAINT, + "No suitable driver found"); return FALSE; } @@ -530,7 +526,7 @@ _cogl_renderer_choose_driver (CoglRenderer *renderer, if (renderer->libgl_module == NULL) { - _cogl_set_error (error, COGL_DRIVER_ERROR, + g_set_error (error, COGL_DRIVER_ERROR, COGL_DRIVER_ERROR_FAILED_TO_LOAD_LIBRARY, "Failed to dynamically open the GL library \"%s\"", libgl_name); @@ -554,10 +550,10 @@ cogl_renderer_set_custom_winsys (CoglRenderer *renderer, static gboolean connect_custom_winsys (CoglRenderer *renderer, - CoglError **error) + GError **error) { const CoglWinsysVtable *winsys; - CoglError *tmp_error = NULL; + GError *tmp_error = NULL; GString *error_message; winsys = renderer->custom_winsys_vtable_getter (renderer); @@ -568,7 +564,7 @@ connect_custom_winsys (CoglRenderer *renderer, { g_string_append_c (error_message, '\n'); g_string_append (error_message, tmp_error->message); - cogl_error_free (tmp_error); + g_error_free (tmp_error); } else { @@ -578,16 +574,14 @@ connect_custom_winsys (CoglRenderer *renderer, } renderer->winsys_vtable = NULL; - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, - "Failed to connected to any renderer: %s", - error_message->str); + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT, + "Failed to connected to any renderer: %s", error_message->str); g_string_free (error_message, TRUE); return FALSE; } gboolean -cogl_renderer_connect (CoglRenderer *renderer, CoglError **error) +cogl_renderer_connect (CoglRenderer *renderer, GError **error) { int i; GString *error_message; @@ -609,7 +603,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error) for (i = 0; i < G_N_ELEMENTS (_cogl_winsys_vtable_getters); i++) { const CoglWinsysVtable *winsys = _cogl_winsys_vtable_getters[i](); - CoglError *tmp_error = NULL; + GError *tmp_error = NULL; GList *l; gboolean skip_due_to_constraints = FALSE; @@ -652,7 +646,7 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error) { g_string_append_c (error_message, '\n'); g_string_append (error_message, tmp_error->message); - cogl_error_free (tmp_error); + g_error_free (tmp_error); } else { @@ -666,15 +660,14 @@ cogl_renderer_connect (CoglRenderer *renderer, CoglError **error) { if (constraints_failed) { - _cogl_set_error (error, COGL_RENDERER_ERROR, + g_set_error (error, COGL_RENDERER_ERROR, COGL_RENDERER_ERROR_BAD_CONSTRAINT, "Failed to connected to any renderer due to constraints"); return FALSE; } renderer->winsys_vtable = NULL; - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT, "Failed to connected to any renderer: %s", error_message->str); g_string_free (error_message, TRUE); diff --git a/cogl/cogl/cogl-renderer.h b/cogl/cogl/cogl-renderer.h index 0b3ddb8f2..09ccbb899 100644 --- a/cogl/cogl/cogl-renderer.h +++ b/cogl/cogl/cogl-renderer.h @@ -35,7 +35,6 @@ #include #include -#include #include #include @@ -221,7 +220,7 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer); * cogl_renderer_check_onscreen_template: (skip) * @renderer: A #CoglRenderer * @onscreen_template: A #CoglOnscreenTemplate - * @error: A pointer to a #CoglError for reporting exceptions + * @error: A pointer to a #GError for reporting exceptions * * Tests if a given @onscreen_template can be supported with the given * @renderer. @@ -234,14 +233,14 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer); gboolean cogl_renderer_check_onscreen_template (CoglRenderer *renderer, CoglOnscreenTemplate *onscreen_template, - CoglError **error); + GError **error); /* Final connection API */ /** * cogl_renderer_connect: * @renderer: An unconnected #CoglRenderer - * @error: a pointer to a #CoglError for reporting exceptions + * @error: a pointer to a #GError for reporting exceptions * * Connects the configured @renderer. Renderer connection isn't a * very active process, it basically just means validating that @@ -254,7 +253,7 @@ cogl_renderer_check_onscreen_template (CoglRenderer *renderer, * Stability: unstable */ gboolean -cogl_renderer_connect (CoglRenderer *renderer, CoglError **error); +cogl_renderer_connect (CoglRenderer *renderer, GError **error); /** * CoglRendererConstraint: diff --git a/cogl/cogl/cogl-sub-texture.c b/cogl/cogl/cogl-sub-texture.c index abe94bd3f..c77b083a2 100644 --- a/cogl/cogl/cogl-sub-texture.c +++ b/cogl/cogl/cogl-sub-texture.c @@ -233,7 +233,7 @@ cogl_sub_texture_new (CoglContext *ctx, static gboolean _cogl_sub_texture_allocate (CoglTexture *tex, - CoglError **error) + GError **error) { CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); gboolean status = cogl_texture_allocate (sub_tex->full_texture, error); @@ -364,7 +364,7 @@ _cogl_sub_texture_set_region (CoglTexture *tex, int dst_height, int level, CoglBitmap *bmp, - CoglError **error) + GError **error) { CoglSubTexture *sub_tex = COGL_SUB_TEXTURE (tex); diff --git a/cogl/cogl/cogl-texture-2d-sliced.c b/cogl/cogl/cogl-texture-2d-sliced.c index a5cd57b0b..c651557a8 100644 --- a/cogl/cogl/cogl-texture-2d-sliced.c +++ b/cogl/cogl/cogl-texture-2d-sliced.c @@ -50,7 +50,6 @@ #include "cogl-spans.h" #include "cogl-journal-private.h" #include "cogl-primitive-texture.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-texture-gl-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" @@ -191,7 +190,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds, int src_y, int dst_x, int dst_y, - CoglError **error) + GError **error) { gboolean need_x, need_y; CoglContext *ctx = COGL_TEXTURE (tex_2ds)->context; @@ -342,7 +341,7 @@ _cogl_texture_2d_sliced_set_waste (CoglTexture2DSliced *tex_2ds, static gboolean _cogl_texture_2d_sliced_upload_bitmap (CoglTexture2DSliced *tex_2ds, CoglBitmap *bmp, - CoglError **error) + GError **error) { CoglSpan *x_span; CoglSpan *y_span; @@ -438,7 +437,7 @@ _cogl_texture_2d_sliced_upload_subregion (CoglTexture2DSliced *tex_2ds, int width, int height, CoglBitmap *source_bmp, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2ds); CoglSpan *x_span; @@ -631,7 +630,7 @@ setup_spans (CoglContext *ctx, int height, int max_waste, CoglPixelFormat internal_format, - CoglError **error) + GError **error) { int max_width; int max_height; @@ -656,13 +655,11 @@ setup_spans (CoglContext *ctx, max_height, internal_format)) { - _cogl_set_error (error, - COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_SIZE, - "Sliced texture size of %d x %d not possible " - "with max waste set to -1", - width, - height); + g_set_error (error, COGL_TEXTURE_ERROR, COGL_TEXTURE_ERROR_SIZE, + "Sliced texture size of %d x %d not possible " + "with max waste set to -1", + width, + height); return FALSE; } @@ -706,10 +703,8 @@ setup_spans (CoglContext *ctx, { /* Maybe it would be ok to just g_warn_if_reached() for this * codepath */ - _cogl_set_error (error, - COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_SIZE, - "No suitable slice geometry found"); + g_set_error (error, COGL_TEXTURE_ERROR, COGL_TEXTURE_ERROR_SIZE, + "No suitable slice geometry found"); free_spans (tex_2ds); return FALSE; } @@ -772,7 +767,7 @@ allocate_slices (CoglTexture2DSliced *tex_2ds, int height, int max_waste, CoglPixelFormat internal_format, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2ds); CoglContext *ctx = tex->context; @@ -967,7 +962,7 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx, CoglPixelFormat format, int rowstride, const uint8_t *data, - CoglError **error) + GError **error) { CoglBitmap *bmp; CoglTexture2DSliced *tex_2ds; @@ -1004,7 +999,7 @@ CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_file (CoglContext *ctx, const char *filename, int max_waste, - CoglError **error) + GError **error) { CoglBitmap *bmp; CoglTexture2DSliced *tex_2ds = NULL; @@ -1027,7 +1022,7 @@ cogl_texture_2d_sliced_new_from_file (CoglContext *ctx, static gboolean allocate_with_size (CoglTexture2DSliced *tex_2ds, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2ds); CoglPixelFormat internal_format = @@ -1053,7 +1048,7 @@ allocate_with_size (CoglTexture2DSliced *tex_2ds, static gboolean allocate_from_bitmap (CoglTexture2DSliced *tex_2ds, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2ds); CoglBitmap *bmp = loader->src.bitmap.bitmap; @@ -1106,7 +1101,7 @@ allocate_from_bitmap (CoglTexture2DSliced *tex_2ds, static gboolean allocate_from_gl_foreign (CoglTexture2DSliced *tex_2ds, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2ds); CoglContext *ctx = tex->context; @@ -1170,7 +1165,7 @@ allocate_from_gl_foreign (CoglTexture2DSliced *tex_2ds, static gboolean _cogl_texture_2d_sliced_allocate (CoglTexture *tex, - CoglError **error) + GError **error) { CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); CoglTextureLoader *loader = tex->loader; @@ -1395,7 +1390,7 @@ _cogl_texture_2d_sliced_set_region (CoglTexture *tex, int dst_height, int level, CoglBitmap *bmp, - CoglError **error) + GError **error) { CoglTexture2DSliced *tex_2ds = COGL_TEXTURE_2D_SLICED (tex); CoglBitmap *upload_bmp; diff --git a/cogl/cogl/cogl-texture-2d-sliced.h b/cogl/cogl/cogl-texture-2d-sliced.h index 12ce7108a..8569f76fb 100644 --- a/cogl/cogl/cogl-texture-2d-sliced.h +++ b/cogl/cogl/cogl-texture-2d-sliced.h @@ -132,7 +132,7 @@ cogl_texture_2d_sliced_new_with_size (CoglContext *ctx, * are allowed along the right and bottom textures before * they must be sliced to reduce the amount of waste. A * negative can be passed to disable slicing. - * @error: A #CoglError to catch exceptional errors or %NULL + * @error: A #GError to catch exceptional errors or %NULL * * Creates a #CoglTexture2DSliced from an image file. * @@ -170,7 +170,7 @@ CoglTexture2DSliced * cogl_texture_2d_sliced_new_from_file (CoglContext *ctx, const char *filename, int max_waste, - CoglError **error); + GError **error); /** * cogl_texture_2d_sliced_new_from_data: (skip) @@ -186,7 +186,7 @@ cogl_texture_2d_sliced_new_from_file (CoglContext *ctx, * row in @data. A value of 0 will make Cogl automatically * calculate @rowstride from @width and @format. * @data: pointer 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 #CoglTexture2DSliced texture based on data residing * in memory. @@ -235,7 +235,7 @@ cogl_texture_2d_sliced_new_from_data (CoglContext *ctx, CoglPixelFormat format, int rowstride, const uint8_t *data, - CoglError **error); + GError **error); /** * cogl_texture_2d_sliced_new_from_bitmap: diff --git a/cogl/cogl/cogl-texture-2d.c b/cogl/cogl/cogl-texture-2d.c index 2d003ab60..05cfff42a 100644 --- a/cogl/cogl/cogl-texture-2d.c +++ b/cogl/cogl/cogl-texture-2d.c @@ -42,7 +42,6 @@ #include "cogl-object-private.h" #include "cogl-journal-private.h" #include "cogl-framebuffer-private.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-texture-2d-gl-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" @@ -135,7 +134,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx, static gboolean _cogl_texture_2d_allocate (CoglTexture *tex, - CoglError **error) + GError **error) { CoglContext *ctx = tex->context; @@ -172,7 +171,7 @@ cogl_texture_2d_new_from_bitmap (CoglBitmap *bmp) CoglTexture2D * cogl_texture_2d_new_from_file (CoglContext *ctx, const char *filename, - CoglError **error) + GError **error) { CoglBitmap *bmp; CoglTexture2D *tex_2d = NULL; @@ -198,7 +197,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx, CoglPixelFormat format, int rowstride, const uint8_t *data, - CoglError **error) + GError **error) { CoglBitmap *bmp; CoglTexture2D *tex_2d; @@ -241,7 +240,7 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx, int height, CoglPixelFormat format, EGLImageKHR image, - CoglError **error) + GError **error) { CoglTextureLoader *loader; CoglTexture2D *tex; @@ -421,7 +420,7 @@ _cogl_texture_2d_set_region (CoglTexture *tex, int height, int level, CoglBitmap *bmp, - CoglError **error) + GError **error) { CoglContext *ctx = tex->context; CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); diff --git a/cogl/cogl/cogl-texture-2d.h b/cogl/cogl/cogl-texture-2d.h index e649f24f7..5fc97179e 100644 --- a/cogl/cogl/cogl-texture-2d.h +++ b/cogl/cogl/cogl-texture-2d.h @@ -113,7 +113,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx, * cogl_texture_2d_new_from_file: (skip) * @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 low-level #CoglTexture2D texture from an image file. * @@ -136,7 +136,7 @@ cogl_texture_2d_new_with_size (CoglContext *ctx, CoglTexture2D * cogl_texture_2d_new_from_file (CoglContext *ctx, const char *filename, - CoglError **error); + GError **error); /** * cogl_texture_2d_new_from_data: (skip) @@ -148,7 +148,7 @@ cogl_texture_2d_new_from_file (CoglContext *ctx, * scanlines in @data. A value of 0 will make Cogl automatically * calculate @rowstride from @width and @format. * @data: pointer the memory region where the source buffer resides - * @error: A #CoglError for exceptions + * @error: A #GError for exceptions * * Creates a low-level #CoglTexture2D texture based on data residing * in memory. @@ -178,7 +178,7 @@ cogl_texture_2d_new_from_data (CoglContext *ctx, CoglPixelFormat format, int rowstride, const uint8_t *data, - CoglError **error); + GError **error); /** * cogl_texture_2d_new_from_bitmap: @@ -219,7 +219,7 @@ cogl_egl_texture_2d_new_from_image (CoglContext *ctx, int height, CoglPixelFormat format, EGLImageKHR image, - CoglError **error); + GError **error); typedef gboolean (*CoglTexture2DEGLImageExternalAlloc) (CoglTexture2D *tex_2d, gpointer user_data, @@ -235,7 +235,7 @@ cogl_texture_2d_new_from_egl_image_external (CoglContext *ctx, CoglTexture2DEGLImageExternalAlloc alloc, gpointer user_data, GDestroyNotify destroy, - CoglError **error); + GError **error); void cogl_texture_2d_egl_image_external_bind (CoglTexture2D *tex_2d); diff --git a/cogl/cogl/cogl-texture-driver.h b/cogl/cogl/cogl-texture-driver.h index e5932a98f..f37abb518 100644 --- a/cogl/cogl/cogl-texture-driver.h +++ b/cogl/cogl/cogl-texture-driver.h @@ -84,7 +84,7 @@ struct _CoglTextureDriver CoglBitmap *source_bmp, GLuint source_gl_format, GLuint source_gl_type, - CoglError **error); + GError **error); /* * Replaces the contents of the GL texture with the entire bitmap. On @@ -101,7 +101,7 @@ struct _CoglTextureDriver GLint internal_gl_format, GLuint source_gl_format, GLuint source_gl_type, - CoglError **error); + GError **error); /* * This sets up the glPixelStore state for an download to a destination with diff --git a/cogl/cogl/cogl-texture-private.h b/cogl/cogl/cogl-texture-private.h index f3b4ce3d0..481e436dd 100644 --- a/cogl/cogl/cogl-texture-private.h +++ b/cogl/cogl/cogl-texture-private.h @@ -75,7 +75,7 @@ struct _CoglTextureVtable gboolean is_primitive; gboolean (* allocate) (CoglTexture *tex, - CoglError **error); + GError **error); /* This should update the specified sub region of the texture with a sub region of the given bitmap. The bitmap is not converted @@ -91,7 +91,7 @@ struct _CoglTextureVtable int dst_height, int level, CoglBitmap *bitmap, - CoglError **error); + GError **error); gboolean (* is_get_data_supported) (CoglTexture *texture); @@ -362,7 +362,7 @@ _cogl_texture_set_region (CoglTexture *texture, int dst_x, int dst_y, int level, - CoglError **error); + GError **error); gboolean _cogl_texture_set_region_from_bitmap (CoglTexture *texture, @@ -374,7 +374,7 @@ _cogl_texture_set_region_from_bitmap (CoglTexture *texture, int dst_x, int dst_y, int level, - CoglError **error); + GError **error); gboolean _cogl_texture_needs_premult_conversion (CoglPixelFormat src_format, diff --git a/cogl/cogl/cogl-texture.c b/cogl/cogl/cogl-texture.c index 7b5e860ca..96bada164 100644 --- a/cogl/cogl/cogl-texture.c +++ b/cogl/cogl/cogl-texture.c @@ -58,7 +58,6 @@ #include "cogl1-context.h" #include "cogl-sub-texture.h" #include "cogl-primitive-texture.h" -#include "cogl-error-private.h" #include "cogl-gtype-private.h" #include @@ -363,7 +362,7 @@ _cogl_texture_set_region_from_bitmap (CoglTexture *texture, int dst_x, int dst_y, int level, - CoglError **error) + GError **error) { g_return_val_if_fail (cogl_bitmap_get_width (bmp) - src_x >= width, FALSE); g_return_val_if_fail (cogl_bitmap_get_height (bmp) - src_y >= height, FALSE); @@ -400,7 +399,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture, unsigned int dst_height, CoglBitmap *bitmap) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; gboolean status = _cogl_texture_set_region_from_bitmap (texture, src_x, src_y, @@ -410,8 +409,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture, 0, /* level */ &ignore_error); - if (!status) - cogl_error_free (ignore_error); + g_clear_error (&ignore_error); return status; } @@ -425,7 +423,7 @@ _cogl_texture_set_region (CoglTexture *texture, int dst_x, int dst_y, int level, - CoglError **error) + GError **error) { CoglContext *ctx = texture->context; CoglBitmap *source_bmp; @@ -471,7 +469,7 @@ cogl_texture_set_region (CoglTexture *texture, unsigned int rowstride, const uint8_t *data) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; const uint8_t *first_pixel; int bytes_per_pixel = _cogl_pixel_format_get_bytes_per_pixel (format); gboolean status; @@ -492,8 +490,7 @@ cogl_texture_set_region (CoglTexture *texture, dst_y, 0, &ignore_error); - if (!status) - cogl_error_free (ignore_error); + g_clear_error (&ignore_error); return status; } @@ -503,7 +500,7 @@ cogl_texture_set_data (CoglTexture *texture, int rowstride, const uint8_t *data, int level, - CoglError **error) + GError **error) { int level_width; int level_height; @@ -541,7 +538,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture, CoglFramebuffer *framebuffer; CoglBitmap *bitmap; gboolean ret; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; CoglPixelFormat real_format; if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) @@ -555,7 +552,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture, framebuffer = COGL_FRAMEBUFFER (offscreen); if (!cogl_framebuffer_allocate (framebuffer, &ignore_error)) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); return FALSE; } @@ -584,8 +581,7 @@ get_texture_bits_via_offscreen (CoglTexture *meta_texture, bitmap, &ignore_error); - if (!ret) - cogl_error_free (ignore_error); + g_clear_error (&ignore_error); cogl_object_unref (bitmap); @@ -650,7 +646,7 @@ typedef struct CoglBitmap *target_bmp; uint8_t *target_bits; gboolean success; - CoglError *error; + GError *error; } CoglTextureGetData; static void @@ -738,7 +734,7 @@ cogl_texture_get_data (CoglTexture *texture, int tex_width; int tex_height; CoglPixelFormat texture_format; - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; CoglTextureGetData tg_data; @@ -818,7 +814,7 @@ cogl_texture_get_data (CoglTexture *texture, &ignore_error); if (!target_bmp) { - cogl_error_free (ignore_error); + g_error_free (ignore_error); return 0; } } @@ -855,7 +851,7 @@ cogl_texture_get_data (CoglTexture *texture, } else { - cogl_error_free (ignore_error); + g_error_free (ignore_error); tg_data.success = FALSE; } @@ -873,7 +869,7 @@ cogl_texture_get_data (CoglTexture *texture, { CoglBitmap *new_bmp; gboolean result; - CoglError *error = NULL; + GError *error = NULL; /* Convert to requested format directly into the user's buffer */ new_bmp = cogl_bitmap_new_for_data (ctx, @@ -885,7 +881,7 @@ cogl_texture_get_data (CoglTexture *texture, if (!result) { - cogl_error_free (error); + g_error_free (error); /* Return failure after cleaning up */ byte_size = 0; } @@ -1075,18 +1071,18 @@ _cogl_texture_set_allocated (CoglTexture *texture, gboolean cogl_texture_allocate (CoglTexture *texture, - CoglError **error) + GError **error) { if (texture->allocated) return TRUE; if (texture->components == COGL_TEXTURE_COMPONENTS_RG && !cogl_has_feature (texture->context, COGL_FEATURE_ID_TEXTURE_RG)) - _cogl_set_error (error, - COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_FORMAT, - "A red-green texture was requested but the driver " - "does not support them"); + g_set_error (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_FORMAT, + "A red-green texture was requested but the driver " + "does not support them"); texture->allocated = texture->vtable->allocate (texture, error); diff --git a/cogl/cogl/cogl-texture.h b/cogl/cogl/cogl-texture.h index 87612b810..924912d02 100644 --- a/cogl/cogl/cogl-texture.h +++ b/cogl/cogl/cogl-texture.h @@ -81,7 +81,7 @@ GType cogl_texture_get_gtype (void); /** * COGL_TEXTURE_ERROR: * - * #CoglError domain for texture errors. + * #GError domain for texture errors. * * Since: 1.8 * Stability: Unstable @@ -387,7 +387,7 @@ cogl_texture_set_region (CoglTexture *texture, * @data: the source data, pointing to the first top-left pixel to set * @level: The mipmap level to update (Normally 0 for the largest, * base texture) - * @error: A #CoglError to return exceptional errors + * @error: A #GError to return exceptional errors * * Sets all the pixels for a given mipmap @level by copying the pixel * data pointed to by the @data argument into the given @texture. @@ -436,7 +436,7 @@ cogl_texture_set_data (CoglTexture *texture, int rowstride, const uint8_t *data, int level, - CoglError **error); + GError **error); /** * cogl_texture_set_region_from_bitmap: @@ -476,7 +476,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture, /** * cogl_texture_allocate: * @texture: A #CoglTexture - * @error: A #CoglError to return exceptional errors or %NULL + * @error: A #GError to return exceptional errors or %NULL * * Explicitly allocates the storage for the given @texture which * allows you to be sure that there is enough memory for the @@ -493,7 +493,7 @@ cogl_texture_set_region_from_bitmap (CoglTexture *texture, */ gboolean cogl_texture_allocate (CoglTexture *texture, - CoglError **error); + GError **error); /** * cogl_texture_is_get_data_supported: (skip) diff --git a/cogl/cogl/cogl-types.h b/cogl/cogl/cogl-types.h index a7e5d25e2..71e4fd53c 100644 --- a/cogl/cogl/cogl-types.h +++ b/cogl/cogl/cogl-types.h @@ -323,7 +323,7 @@ typedef enum /** * COGL_BLEND_STRING_ERROR: * - * #CoglError domain for blend string parser errors + * #GError domain for blend string parser errors * * Since: 1.0 */ diff --git a/cogl/cogl/cogl-xlib-renderer-private.h b/cogl/cogl/cogl-xlib-renderer-private.h index 59e761111..625323bdb 100644 --- a/cogl/cogl/cogl-xlib-renderer-private.h +++ b/cogl/cogl/cogl-xlib-renderer-private.h @@ -55,7 +55,7 @@ typedef struct _CoglXlibRenderer } CoglXlibRenderer; gboolean -_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error); +_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error); void _cogl_xlib_renderer_disconnect (CoglRenderer *renderer); diff --git a/cogl/cogl/cogl-xlib-renderer.c b/cogl/cogl/cogl-xlib-renderer.c index 2e88b5522..53b4b050a 100644 --- a/cogl/cogl/cogl-xlib-renderer.c +++ b/cogl/cogl/cogl-xlib-renderer.c @@ -39,7 +39,6 @@ #include "cogl-renderer-private.h" #include "cogl-xlib-renderer-private.h" #include "cogl-x11-renderer-private.h" -#include "cogl-error-private.h" #include "cogl-poll-private.h" #include "winsys/cogl-winsys-private.h" @@ -162,7 +161,7 @@ _cogl_xlib_renderer_untrap_errors (CoglRenderer *renderer, } static Display * -assert_xlib_display (CoglRenderer *renderer, CoglError **error) +assert_xlib_display (CoglRenderer *renderer, GError **error) { Display *xdpy = cogl_xlib_renderer_get_foreign_display (renderer); CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); @@ -177,7 +176,7 @@ assert_xlib_display (CoglRenderer *renderer, CoglError **error) xdpy = XOpenDisplay (_cogl_x11_display_name); if (xdpy == NULL) { - _cogl_set_error (error, + g_set_error (error, COGL_RENDERER_ERROR, COGL_RENDERER_ERROR_XLIB_DISPLAY_OPEN, "Failed to open X Display %s", _cogl_x11_display_name); @@ -489,7 +488,7 @@ dispatch_xlib_events (void *user_data, int revents) } gboolean -_cogl_xlib_renderer_connect (CoglRenderer *renderer, CoglError **error) +_cogl_xlib_renderer_connect (CoglRenderer *renderer, GError **error) { CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (renderer); diff --git a/cogl/cogl/cogl.h b/cogl/cogl/cogl.h index 14ccf5748..1c251cc88 100644 --- a/cogl/cogl/cogl.h +++ b/cogl/cogl/cogl.h @@ -55,8 +55,6 @@ #include #include -#include - #include #include #include diff --git a/cogl/cogl/cogl.symbols b/cogl/cogl/cogl.symbols index 2a5966cd5..fda1397d5 100644 --- a/cogl/cogl/cogl.symbols +++ b/cogl/cogl/cogl.symbols @@ -200,10 +200,6 @@ cogl_double_to_fixed cogl_end_gl -cogl_error_copy -cogl_error_free -cogl_error_matches - cogl_euler_copy cogl_euler_equal cogl_euler_free diff --git a/cogl/cogl/deprecated/cogl-auto-texture.c b/cogl/cogl/deprecated/cogl-auto-texture.c index e24409dc1..a13020c0d 100644 --- a/cogl/cogl/deprecated/cogl-auto-texture.c +++ b/cogl/cogl/deprecated/cogl-auto-texture.c @@ -47,7 +47,6 @@ #include "cogl-object.h" #include "cogl-bitmap-private.h" #include "cogl-atlas-texture-private.h" -#include "cogl-error-private.h" #include "cogl-sub-texture.h" #include "cogl-texture-2d-gl.h" @@ -58,7 +57,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap, CoglTextureFlags flags, CoglPixelFormat internal_format, gboolean can_convert_in_place, - CoglError **error); + GError **error); static void set_auto_mipmap_cb (CoglTexture *sub_texture, @@ -77,7 +76,7 @@ cogl_texture_new_with_size (unsigned int width, CoglPixelFormat internal_format) { CoglTexture *tex; - CoglError *skip_error = NULL; + GError *skip_error = NULL; _COGL_GET_CONTEXT (ctx, NULL); @@ -88,7 +87,7 @@ cogl_texture_new_with_size (unsigned int width, if (!cogl_texture_allocate (tex, &skip_error)) { - cogl_error_free (skip_error); + g_error_free (skip_error); skip_error = NULL; cogl_object_unref (tex); tex = NULL; @@ -111,7 +110,7 @@ cogl_texture_new_with_size (unsigned int width, * semantics and return NULL if allocation fails... */ if (!cogl_texture_allocate (tex, &skip_error)) { - cogl_error_free (skip_error); + g_error_free (skip_error); cogl_object_unref (tex); return NULL; } @@ -139,7 +138,7 @@ _cogl_texture_new_from_data (CoglContext *ctx, CoglPixelFormat internal_format, int rowstride, const uint8_t *data, - CoglError **error) + GError **error) { CoglBitmap *bmp; CoglTexture *tex; @@ -178,7 +177,7 @@ cogl_texture_new_from_data (int width, int rowstride, const uint8_t *data) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; CoglTexture *tex; _COGL_GET_CONTEXT (ctx, NULL); @@ -191,7 +190,7 @@ cogl_texture_new_from_data (int width, data, &ignore_error); if (!tex) - cogl_error_free (ignore_error); + g_error_free (ignore_error); return tex; } @@ -200,10 +199,10 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap, CoglTextureFlags flags, CoglPixelFormat internal_format, gboolean can_convert_in_place, - CoglError **error) + GError **error) { CoglTexture *tex; - CoglError *internal_error = NULL; + GError *internal_error = NULL; if (!flags && !COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS)) @@ -219,7 +218,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap, if (cogl_texture_allocate (COGL_TEXTURE (atlas_tex), &internal_error)) return COGL_TEXTURE (atlas_tex); - cogl_error_free (internal_error); + g_error_free (internal_error); internal_error = NULL; cogl_object_unref (atlas_tex); } @@ -232,7 +231,7 @@ _cogl_texture_new_from_bitmap (CoglBitmap *bitmap, if (!cogl_texture_allocate (tex, &internal_error)) { - cogl_error_free (internal_error); + g_error_free (internal_error); internal_error = NULL; cogl_object_unref (tex); tex = NULL; @@ -274,7 +273,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap, CoglTextureFlags flags, CoglPixelFormat internal_format) { - CoglError *ignore_error = NULL; + GError *ignore_error = NULL; CoglTexture *tex = _cogl_texture_new_from_bitmap (bitmap, flags, @@ -282,7 +281,7 @@ cogl_texture_new_from_bitmap (CoglBitmap *bitmap, FALSE, /* can't convert in-place */ &ignore_error); if (!tex) - cogl_error_free (ignore_error); + g_error_free (ignore_error); return tex; } @@ -290,7 +289,7 @@ CoglTexture * cogl_texture_new_from_file (const char *filename, CoglTextureFlags flags, CoglPixelFormat internal_format, - CoglError **error) + GError **error) { CoglBitmap *bmp; CoglTexture *texture = NULL; diff --git a/cogl/cogl/deprecated/cogl-auto-texture.h b/cogl/cogl/deprecated/cogl-auto-texture.h index 47fda828b..b184ee364 100644 --- a/cogl/cogl/deprecated/cogl-auto-texture.h +++ b/cogl/cogl/deprecated/cogl-auto-texture.h @@ -70,7 +70,7 @@ cogl_texture_new_with_size (unsigned int width, * have non-premultiplied source data and are going to adjust the blend * mode (see cogl_material_set_blend()) or use the data for something * other than straight blending. - * @error: return location for a #CoglError or %NULL + * @error: return location for a #GError or %NULL * * Creates a #CoglTexture from an image file. * @@ -86,7 +86,7 @@ CoglTexture * cogl_texture_new_from_file (const char *filename, CoglTextureFlags flags, CoglPixelFormat internal_format, - CoglError **error); + GError **error); /** * cogl_texture_new_from_data: diff --git a/cogl/cogl/deprecated/cogl-material-compat.c b/cogl/cogl/deprecated/cogl-material-compat.c index a7e653f54..35607d1dc 100644 --- a/cogl/cogl/deprecated/cogl-material-compat.c +++ b/cogl/cogl/deprecated/cogl-material-compat.c @@ -200,7 +200,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material, gboolean cogl_material_set_blend (CoglMaterial *material, const char *blend_string, - CoglError **error) + GError **error) { return cogl_pipeline_set_blend (COGL_PIPELINE (material), blend_string, @@ -260,7 +260,7 @@ gboolean cogl_material_set_layer_combine (CoglMaterial *material, int layer_index, const char *blend_string, - CoglError **error) + GError **error) { return cogl_pipeline_set_layer_combine (COGL_PIPELINE (material), layer_index, @@ -339,7 +339,7 @@ gboolean cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, int layer_index, gboolean enable, - CoglError **error) + GError **error) { CoglPipeline *pipeline = COGL_PIPELINE (material); return cogl_pipeline_set_layer_point_sprite_coords_enabled (pipeline, @@ -447,7 +447,7 @@ cogl_material_foreach_layer (CoglMaterial *material, gboolean cogl_material_set_depth_state (CoglMaterial *material, const CoglDepthState *state, - CoglError **error) + GError **error) { return cogl_pipeline_set_depth_state (COGL_PIPELINE (material), state, error); diff --git a/cogl/cogl/deprecated/cogl-material-compat.h b/cogl/cogl/deprecated/cogl-material-compat.h index 31c9c0f95..96d451d5c 100644 --- a/cogl/cogl/deprecated/cogl-material-compat.h +++ b/cogl/cogl/deprecated/cogl-material-compat.h @@ -38,7 +38,6 @@ #include #include #include -#include #include #include @@ -560,7 +559,7 @@ cogl_material_set_alpha_test_function (CoglMaterial *material, * @material: A #CoglMaterial object * @blend_string: A Cogl blend string * describing the desired blend function. - * @error: return location for a #CoglError that may report lack of driver + * @error: return location for a #GError that may report lack of driver * support if you give separate blend string statements for the alpha * channel and RGB channels since some drivers, or backends such as * GLES 1.1, don't support this feature. May be %NULL, in which case a @@ -644,7 +643,7 @@ COGL_DEPRECATED_FOR (cogl_pipeline_set_blend) gboolean cogl_material_set_blend (CoglMaterial *material, const char *blend_string, - CoglError **error); + GError **error); /** * cogl_material_set_blend_constant: @@ -810,7 +809,7 @@ cogl_material_remove_layer (CoglMaterial *material, * @layer_index: Specifies the layer you want define a combine function for * @blend_string: A Cogl blend string * describing the desired texture combine function. - * @error: A #CoglError that may report parse errors or lack of GPU/driver + * @error: A #GError that may report parse errors or lack of GPU/driver * support. May be %NULL, in which case a warning will be printed out if an * error is encountered. * @@ -902,7 +901,7 @@ gboolean cogl_material_set_layer_combine (CoglMaterial *material, int layer_index, const char *blend_string, - CoglError **error); + GError **error); /** * cogl_material_set_layer_combine_constant: @@ -1083,7 +1082,7 @@ cogl_material_set_layer_filters (CoglMaterial *material, * @material: a #CoglHandle to a material. * @layer_index: the layer number to change. * @enable: whether to enable point sprite coord generation. - * @error: A return location for a CoglError, or NULL to ignore errors. + * @error: A return location for a GError, or NULL to ignore errors. * * When rendering points, if @enable is %TRUE then the texture * coordinates for this layer will be replaced with coordinates that @@ -1106,7 +1105,7 @@ gboolean cogl_material_set_layer_point_sprite_coords_enabled (CoglMaterial *material, int layer_index, gboolean enable, - CoglError **error); + GError **error); /** * cogl_material_get_layer_point_sprite_coords_enabled: @@ -1310,7 +1309,7 @@ cogl_material_layer_get_wrap_mode_p (CoglMaterialLayer *layer); * cogl_material_set_depth_state: (skip) * @material: A #CoglMaterial object * @state: A #CoglDepthState struct - * @error: A #CoglError to report failures to setup the given @state. + * @error: A #GError to report failures to setup the given @state. * * This commits all the depth state configured in @state struct to the * given @material. The configuration values are copied into the @@ -1331,7 +1330,7 @@ COGL_DEPRECATED_FOR (cogl_pipeline_set_depth_state) gboolean cogl_material_set_depth_state (CoglMaterial *material, const CoglDepthState *state, - CoglError **error); + GError **error); /** * cogl_material_get_depth_state: (skip) diff --git a/cogl/cogl/driver/gl/cogl-attribute-gl.c b/cogl/cogl/driver/gl/cogl-attribute-gl.c index c1d91480c..e198a9830 100644 --- a/cogl/cogl/driver/gl/cogl-attribute-gl.c +++ b/cogl/cogl/driver/gl/cogl-attribute-gl.c @@ -37,7 +37,6 @@ #include #include "cogl-private.h" -#include "cogl-error-private.h" #include "cogl-context-private.h" #include "cogl-attribute.h" #include "cogl-attribute-private.h" diff --git a/cogl/cogl/driver/gl/cogl-buffer-gl-private.h b/cogl/cogl/driver/gl/cogl-buffer-gl-private.h index 140e34569..61807f17e 100644 --- a/cogl/cogl/driver/gl/cogl-buffer-gl-private.h +++ b/cogl/cogl/driver/gl/cogl-buffer-gl-private.h @@ -51,7 +51,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer, size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error); + GError **error); void _cogl_buffer_gl_unmap (CoglBuffer *buffer); @@ -61,12 +61,12 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer, unsigned int offset, const void *data, unsigned int size, - CoglError **error); + GError **error); void * _cogl_buffer_gl_bind (CoglBuffer *buffer, CoglBufferBindTarget target, - CoglError **error); + GError **error); void _cogl_buffer_gl_unbind (CoglBuffer *buffer); diff --git a/cogl/cogl/driver/gl/cogl-buffer-gl.c b/cogl/cogl/driver/gl/cogl-buffer-gl.c index dfab62746..b2119d7b0 100644 --- a/cogl/cogl/driver/gl/cogl-buffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-buffer-gl.c @@ -36,7 +36,6 @@ #include "cogl-context-private.h" #include "driver/gl/cogl-buffer-gl-private.h" -#include "cogl-error-private.h" #include "driver/gl/cogl-util-gl-private.h" /* @@ -135,7 +134,7 @@ convert_bind_target_to_gl_target (CoglBufferBindTarget target) static gboolean recreate_store (CoglBuffer *buffer, - CoglError **error) + GError **error) { CoglContext *ctx = buffer->context; GLenum gl_target; @@ -206,7 +205,7 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer, size_t size, CoglBufferAccess access, CoglBufferMapHint hints, - CoglError **error) + GError **error) { uint8_t *data; CoglBufferBindTarget target; @@ -218,10 +217,10 @@ _cogl_buffer_gl_map_range (CoglBuffer *buffer, ((access & COGL_BUFFER_ACCESS_WRITE) && !cogl_has_feature (ctx, COGL_FEATURE_ID_MAP_BUFFER_FOR_WRITE))) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Tried to map a buffer with unsupported access mode"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Tried to map a buffer with unsupported access mode"); return NULL; } @@ -351,13 +350,13 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer, unsigned int offset, const void *data, unsigned int size, - CoglError **error) + GError **error) { CoglBufferBindTarget target; GLenum gl_target; CoglContext *ctx = buffer->context; gboolean status = TRUE; - CoglError *internal_error = NULL; + GError *internal_error = NULL; target = buffer->last_target; @@ -369,7 +368,7 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer, */ if (internal_error) { - _cogl_propagate_error (error, internal_error); + g_propagate_error (error, internal_error); return FALSE; } @@ -391,7 +390,7 @@ _cogl_buffer_gl_set_data (CoglBuffer *buffer, void * _cogl_buffer_gl_bind (CoglBuffer *buffer, CoglBufferBindTarget target, - CoglError **error) + GError **error) { void *ret; diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h b/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h index 214f45f0f..57c146b39 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl-private.h @@ -36,7 +36,7 @@ gboolean _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen, - CoglError **error); + GError **error); void _cogl_offscreen_gl_free (CoglOffscreen *offscreen); @@ -95,7 +95,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error); + GError **error); #endif /* __COGL_FRAMEBUFFER_GL_PRIVATE_H__ */ diff --git a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c index 325541408..b8fd2f689 100644 --- a/cogl/cogl/driver/gl/cogl-framebuffer-gl.c +++ b/cogl/cogl/driver/gl/cogl-framebuffer-gl.c @@ -33,7 +33,6 @@ #include "cogl-context-private.h" #include "cogl-framebuffer-private.h" -#include "cogl-error-private.h" #include "cogl-texture-private.h" #include "driver/gl/cogl-util-gl-private.h" #include "driver/gl/cogl-framebuffer-gl-private.h" @@ -770,7 +769,7 @@ _cogl_framebuffer_try_creating_gl_fbo (CoglContext *ctx, gboolean _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen, - CoglError **error) + GError **error) { CoglFramebuffer *fb = COGL_FRAMEBUFFER (offscreen); CoglContext *ctx = fb->context; @@ -919,9 +918,9 @@ _cogl_offscreen_gl_allocate (CoglOffscreen *offscreen, } else { - _cogl_set_error (error, COGL_FRAMEBUFFER_ERROR, - COGL_FRAMEBUFFER_ERROR_ALLOCATE, - "Failed to create an OpenGL framebuffer object"); + g_set_error (error, COGL_FRAMEBUFFER_ERROR, + COGL_FRAMEBUFFER_ERROR_ALLOCATE, + "Failed to create an OpenGL framebuffer object"); return FALSE; } } @@ -1216,7 +1215,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error) + GError **error) { CoglContext *ctx = framebuffer->context; int framebuffer_height = cogl_framebuffer_get_height (framebuffer); @@ -1340,7 +1339,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int bpp, rowstride; gboolean succeeded = FALSE; uint8_t *pixels; - CoglError *internal_error = NULL; + GError *internal_error = NULL; rowstride = cogl_bitmap_get_rowstride (bitmap); @@ -1378,7 +1377,7 @@ _cogl_framebuffer_gl_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, if (internal_error) { cogl_object_unref (shared_bmp); - _cogl_propagate_error (error, internal_error); + g_propagate_error (error, internal_error); goto EXIT; } diff --git a/cogl/cogl/driver/gl/cogl-texture-2d-gl-private.h b/cogl/cogl/driver/gl/cogl-texture-2d-gl-private.h index 429f02408..40e197c1a 100644 --- a/cogl/cogl/driver/gl/cogl-texture-2d-gl-private.h +++ b/cogl/cogl/driver/gl/cogl-texture-2d-gl-private.h @@ -52,13 +52,13 @@ _cogl_texture_2d_gl_init (CoglTexture2D *tex_2d); gboolean _cogl_texture_2d_gl_allocate (CoglTexture *tex, - CoglError **error); + GError **error); CoglTexture2D * _cogl_texture_2d_gl_new_from_bitmap (CoglBitmap *bmp, CoglPixelFormat internal_format, gboolean can_convert_in_place, - CoglError **error); + GError **error); #if defined (COGL_HAS_EGL_SUPPORT) && defined (EGL_KHR_image_base) CoglTexture2D * @@ -67,7 +67,7 @@ _cogl_egl_texture_2d_gl_new_from_image (CoglContext *ctx, int height, CoglPixelFormat format, EGLImageKHR image, - CoglError **error); + GError **error); #endif void @@ -108,7 +108,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, int dst_x, int dst_y, int level, - CoglError **error); + GError **error); gboolean _cogl_texture_2d_gl_is_get_data_supported (CoglTexture2D *tex_2d); diff --git a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c index cc9c7eb73..57d40f3a3 100644 --- a/cogl/cogl/driver/gl/cogl-texture-2d-gl.c +++ b/cogl/cogl/driver/gl/cogl-texture-2d-gl.c @@ -40,7 +40,6 @@ #include "cogl-texture-private.h" #include "cogl-texture-2d-gl.h" #include "cogl-texture-2d-private.h" -#include "cogl-error-private.h" #include "driver/gl/cogl-texture-2d-gl-private.h" #include "driver/gl/cogl-texture-gl-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" @@ -122,7 +121,7 @@ _cogl_texture_2d_gl_init (CoglTexture2D *tex_2d) static gboolean allocate_with_size (CoglTexture2D *tex_2d, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2d); CoglPixelFormat internal_format; @@ -142,10 +141,10 @@ allocate_with_size (CoglTexture2D *tex_2d, height, internal_format)) { - _cogl_set_error (error, COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_SIZE, - "Failed to create texture 2d due to size/format" - " constraints"); + g_set_error_literal (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Failed to create texture 2d due to size/format" + " constraints"); return FALSE; } @@ -188,7 +187,7 @@ allocate_with_size (CoglTexture2D *tex_2d, static gboolean allocate_from_bitmap (CoglTexture2D *tex_2d, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2d); CoglBitmap *bmp = loader->src.bitmap.bitmap; @@ -210,10 +209,10 @@ allocate_from_bitmap (CoglTexture2D *tex_2d, height, internal_format)) { - _cogl_set_error (error, COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_SIZE, - "Failed to create texture 2d due to size/format" - " constraints"); + g_set_error_literal (error, COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_SIZE, + "Failed to create texture 2d due to size/format" + " constraints"); return FALSE; } @@ -239,7 +238,7 @@ allocate_from_bitmap (CoglTexture2D *tex_2d, supported we can fallback to using GL_GENERATE_MIPMAP */ if (!cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) { - CoglError *ignore = NULL; + GError *ignore = NULL; uint8_t *data = _cogl_bitmap_map (upload_bmp, COGL_BUFFER_ACCESS_READ, 0, &ignore); @@ -258,7 +257,7 @@ allocate_from_bitmap (CoglTexture2D *tex_2d, { g_warning ("Failed to read first pixel of bitmap for " "glGenerateMipmap fallback"); - cogl_error_free (ignore); + g_error_free (ignore); memset (tex_2d->first_pixel.data, 0, _cogl_pixel_format_get_bytes_per_pixel (format)); } @@ -295,7 +294,7 @@ allocate_from_bitmap (CoglTexture2D *tex_2d, static gboolean allocate_from_egl_image (CoglTexture2D *tex_2d, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2d); CoglContext *ctx = tex->context; @@ -311,11 +310,11 @@ allocate_from_egl_image (CoglTexture2D *tex_2d, ctx->glEGLImageTargetTexture2D (GL_TEXTURE_2D, loader->src.egl_image.image); if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) { - _cogl_set_error (error, - COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_BAD_PARAMETER, - "Could not create a CoglTexture2D from a given " - "EGLImage"); + g_set_error_literal (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_BAD_PARAMETER, + "Could not create a CoglTexture2D from a given " + "EGLImage"); GE( ctx, glDeleteTextures (1, &tex_2d->gl_texture) ); return FALSE; } @@ -334,7 +333,7 @@ allocate_from_egl_image (CoglTexture2D *tex_2d, static gboolean allocate_from_gl_foreign (CoglTexture2D *tex_2d, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2d); CoglContext *ctx = tex->context; @@ -344,11 +343,11 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, if (!ctx->texture_driver->allows_foreign_gl_target (ctx, GL_TEXTURE_2D)) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Foreign GL_TEXTURE_2D textures are not " - "supported by your system"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Foreign GL_TEXTURE_2D textures are not " + "supported by your system"); return FALSE; } @@ -359,10 +358,10 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, loader->src.gl_foreign.gl_handle, TRUE); if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Failed to bind foreign GL_TEXTURE_2D texture"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Failed to bind foreign GL_TEXTURE_2D texture"); return FALSE; } @@ -393,10 +392,11 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, gl_int_format, &format)) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Unsupported internal format for foreign texture"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Unsupported internal format for foreign " + "texture"); return FALSE; } } @@ -415,10 +415,11 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, /* Compressed texture images not supported */ if (gl_compressed == GL_TRUE) { - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Compressed foreign textures aren't currently supported"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Compressed foreign textures aren't currently" + " supported"); return FALSE; } @@ -459,7 +460,7 @@ allocate_from_gl_foreign (CoglTexture2D *tex_2d, static gboolean allocate_custom_egl_image_external (CoglTexture2D *tex_2d, CoglTextureLoader *loader, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2d); CoglContext *ctx = tex->context; @@ -480,11 +481,11 @@ allocate_custom_egl_image_external (CoglTexture2D *tex_2d, if (_cogl_gl_util_get_error (ctx) != GL_NO_ERROR) { - _cogl_set_error (error, - COGL_TEXTURE_ERROR, - COGL_TEXTURE_ERROR_BAD_PARAMETER, - "Could not create a CoglTexture2D from a given " - "EGLImage"); + g_set_error_literal (error, + COGL_TEXTURE_ERROR, + COGL_TEXTURE_ERROR_BAD_PARAMETER, + "Could not create a CoglTexture2D from a given " + "EGLImage"); GE( ctx, glDeleteTextures (1, &tex_2d->gl_texture) ); return FALSE; } @@ -518,7 +519,7 @@ cogl_texture_2d_new_from_egl_image_external (CoglContext *ctx, CoglTexture2DEGLImageExternalAlloc alloc, gpointer user_data, GDestroyNotify destroy, - CoglError **error) + GError **error) { CoglTextureLoader *loader; CoglTexture2D *tex_2d; @@ -552,7 +553,7 @@ cogl_texture_2d_new_from_egl_image_external (CoglContext *ctx, gboolean _cogl_texture_2d_gl_allocate (CoglTexture *tex, - CoglError **error) + GError **error) { CoglTexture2D *tex_2d = COGL_TEXTURE_2D (tex); CoglTextureLoader *loader = tex->loader; @@ -754,7 +755,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, int dst_x, int dst_y, int level, - CoglError **error) + GError **error) { CoglTexture *tex = COGL_TEXTURE (tex_2d); CoglContext *ctx = tex->context; @@ -784,7 +785,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, if (dst_x == 0 && dst_y == 0 && !cogl_has_feature (ctx, COGL_FEATURE_ID_OFFSCREEN)) { - CoglError *ignore = NULL; + GError *ignore = NULL; uint8_t *data = _cogl_bitmap_map (upload_bmp, COGL_BUFFER_ACCESS_READ, 0, &ignore); CoglPixelFormat bpp = @@ -806,7 +807,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d, { g_warning ("Failed to read first bitmap pixel for " "glGenerateMipmap fallback"); - cogl_error_free (ignore); + g_error_free (ignore); memset (tex_2d->first_pixel.data, 0, bpp); } } diff --git a/cogl/cogl/driver/gl/cogl-util-gl-private.h b/cogl/cogl/driver/gl/cogl-util-gl-private.h index 5c570bb92..a3de93980 100644 --- a/cogl/cogl/driver/gl/cogl-util-gl-private.h +++ b/cogl/cogl/driver/gl/cogl-util-gl-private.h @@ -83,7 +83,7 @@ void _cogl_gl_util_clear_gl_errors (CoglContext *ctx); gboolean -_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error); +_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, GError **error); /* Parses a GL version number stored in a string. @version_string must * point to the beginning of the version number (ie, it can't point to diff --git a/cogl/cogl/driver/gl/cogl-util-gl.c b/cogl/cogl/driver/gl/cogl-util-gl.c index 6119b69e8..7939deabc 100644 --- a/cogl/cogl/driver/gl/cogl-util-gl.c +++ b/cogl/cogl/driver/gl/cogl-util-gl.c @@ -34,7 +34,6 @@ #include "cogl-types.h" #include "cogl-context-private.h" -#include "cogl-error-private.h" #include "driver/gl/cogl-util-gl-private.h" #ifdef COGL_GL_DEBUG @@ -96,7 +95,7 @@ _cogl_gl_util_clear_gl_errors (CoglContext *ctx) } gboolean -_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error) +_cogl_gl_util_catch_out_of_memory (CoglContext *ctx, GError **error) { GLenum gl_error; gboolean out_of_memory = FALSE; @@ -118,9 +117,9 @@ _cogl_gl_util_catch_out_of_memory (CoglContext *ctx, CoglError **error) if (out_of_memory) { - _cogl_set_error (error, COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_NO_MEMORY, - "Out of memory"); + g_set_error_literal (error, COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_NO_MEMORY, + "Out of memory"); return TRUE; } diff --git a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c index fb36df2b8..cc870762a 100644 --- a/cogl/cogl/driver/gl/gl/cogl-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-driver-gl.c @@ -36,7 +36,6 @@ #include "cogl-context-private.h" #include "cogl-feature-private.h" #include "cogl-renderer-private.h" -#include "cogl-error-private.h" #include "driver/gl/cogl-util-gl-private.h" #include "driver/gl/cogl-framebuffer-gl-private.h" #include "driver/gl/cogl-texture-2d-gl-private.h" @@ -304,13 +303,13 @@ _cogl_get_gl_version (CoglContext *ctx, static gboolean check_gl_version (CoglContext *ctx, char **gl_extensions, - CoglError **error) + GError **error) { int major, minor; if (!_cogl_get_gl_version (ctx, &major, &minor)) { - _cogl_set_error (error, + g_set_error (error, COGL_DRIVER_ERROR, COGL_DRIVER_ERROR_UNKNOWN_VERSION, "The OpenGL version could not be determined"); @@ -320,10 +319,10 @@ check_gl_version (CoglContext *ctx, /* We require GLSL 1.20, which is implied by OpenGL 2.1. */ if (!COGL_CHECK_GL_VERSION (major, minor, 2, 1)) { - _cogl_set_error (error, - COGL_DRIVER_ERROR, - COGL_DRIVER_ERROR_INVALID_VERSION, - "OpenGL 2.1 or better is required"); + g_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_INVALID_VERSION, + "OpenGL 2.1 or better is required"); return FALSE; } @@ -332,7 +331,7 @@ check_gl_version (CoglContext *ctx, static gboolean _cogl_driver_update_features (CoglContext *ctx, - CoglError **error) + GError **error) { CoglFeatureFlags flags = 0; unsigned long private_features @@ -527,11 +526,11 @@ _cogl_driver_update_features (CoglContext *ctx, if (!COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_ALPHA_TEXTURES) && !COGL_FLAGS_GET (private_features, COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE)) { - _cogl_set_error (error, - COGL_DRIVER_ERROR, - COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND, - "The GL_ARB_texture_swizzle extension is required " - "to use the GL3 driver"); + g_set_error (error, + COGL_DRIVER_ERROR, + COGL_DRIVER_ERROR_NO_SUITABLE_DRIVER_FOUND, + "The GL_ARB_texture_swizzle extension is required " + "to use the GL3 driver"); return FALSE; } diff --git a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c index c2270124f..1505a2af7 100644 --- a/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c +++ b/cogl/cogl/driver/gl/gl/cogl-texture-driver-gl.c @@ -44,7 +44,6 @@ #include "cogl-context-private.h" #include "cogl-object-private.h" #include "cogl-primitives.h" -#include "cogl-error-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" #include "driver/gl/cogl-util-gl-private.h" #include "driver/gl/cogl-texture-gl-private.h" @@ -191,7 +190,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, CoglBitmap *source_bmp, GLuint source_gl_format, GLuint source_gl_type, - CoglError **error) + GError **error) { GLenum gl_target; GLuint gl_handle; @@ -199,7 +198,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); gboolean status = TRUE; - CoglError *internal_error = NULL; + GError *internal_error = NULL; int level_width; int level_height; @@ -212,7 +211,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, * problems... */ if (internal_error) { - _cogl_propagate_error (error, internal_error); + g_propagate_error (error, internal_error); return FALSE; } @@ -299,13 +298,13 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, GLint internal_gl_format, GLuint source_gl_format, GLuint source_gl_type, - CoglError **error) + GError **error) { uint8_t *data; CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); gboolean status = TRUE; - CoglError *internal_error = NULL; + GError *internal_error = NULL; data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, @@ -317,7 +316,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, * problems... */ if (internal_error) { - _cogl_propagate_error (error, internal_error); + g_propagate_error (error, internal_error); return FALSE; } diff --git a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c index d2769a805..1583ad335 100644 --- a/cogl/cogl/driver/gl/gles/cogl-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-driver-gles.c @@ -33,7 +33,6 @@ #include #include "cogl-context-private.h" -#include "cogl-error-private.h" #include "cogl-feature-private.h" #include "cogl-renderer-private.h" #include "cogl-private.h" @@ -239,7 +238,7 @@ _cogl_get_gl_version (CoglContext *ctx, static gboolean _cogl_driver_update_features (CoglContext *context, - CoglError **error) + GError **error) { unsigned long private_features [COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_N_PRIVATE_FEATURES)] = { 0 }; @@ -290,7 +289,7 @@ _cogl_driver_update_features (CoglContext *context, if (!COGL_CHECK_GL_VERSION (gl_major, gl_minor, 2, 0)) { - _cogl_set_error (error, + g_set_error (error, COGL_DRIVER_ERROR, COGL_DRIVER_ERROR_INVALID_VERSION, "OpenGL ES 2.0 or better is required"); diff --git a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c index b8ed95704..22130784b 100644 --- a/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c +++ b/cogl/cogl/driver/gl/gles/cogl-texture-driver-gles.c @@ -44,7 +44,6 @@ #include "cogl-context-private.h" #include "cogl-object-private.h" #include "cogl-primitives.h" -#include "cogl-error-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" #include "driver/gl/cogl-util-gl-private.h" #include "driver/gl/cogl-texture-gl-private.h" @@ -150,7 +149,7 @@ _cogl_texture_driver_prep_gl_for_pixels_download (CoglContext *ctx, static CoglBitmap * prepare_bitmap_alignment_for_upload (CoglContext *ctx, CoglBitmap *src_bmp, - CoglError **error) + GError **error) { CoglPixelFormat format = cogl_bitmap_get_format (src_bmp); int bpp = _cogl_pixel_format_get_bytes_per_pixel (format); @@ -190,7 +189,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, CoglBitmap *source_bmp, GLuint source_gl_format, GLuint source_gl_type, - CoglError **error) + GError **error) { GLenum gl_target; GLuint gl_handle; @@ -200,7 +199,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, CoglBitmap *slice_bmp; int rowstride; gboolean status = TRUE; - CoglError *internal_error = NULL; + GError *internal_error = NULL; int level_width; int level_height; @@ -254,7 +253,7 @@ _cogl_texture_driver_upload_subregion_to_gl (CoglContext *ctx, * problems... */ if (internal_error) { - _cogl_propagate_error (error, internal_error); + g_propagate_error (error, internal_error); cogl_object_unref (slice_bmp); return FALSE; } @@ -335,7 +334,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, GLint internal_gl_format, GLuint source_gl_format, GLuint source_gl_type, - CoglError **error) + GError **error) { CoglPixelFormat source_format = cogl_bitmap_get_format (source_bmp); int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format); @@ -344,7 +343,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, int bmp_height = cogl_bitmap_get_height (source_bmp); CoglBitmap *bmp; uint8_t *data; - CoglError *internal_error = NULL; + GError *internal_error = NULL; gboolean status = TRUE; bmp = prepare_bitmap_alignment_for_upload (ctx, source_bmp, error); @@ -369,7 +368,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx, if (internal_error) { cogl_object_unref (bmp); - _cogl_propagate_error (error, internal_error); + g_propagate_error (error, internal_error); return FALSE; } diff --git a/cogl/cogl/driver/nop/cogl-driver-nop.c b/cogl/cogl/driver/nop/cogl-driver-nop.c index b41a2bcc5..7f3bea03b 100644 --- a/cogl/cogl/driver/nop/cogl-driver-nop.c +++ b/cogl/cogl/driver/nop/cogl-driver-nop.c @@ -36,7 +36,6 @@ #include "cogl-context-private.h" #include "cogl-feature-private.h" #include "cogl-renderer-private.h" -#include "cogl-error-private.h" #include "cogl-framebuffer-nop-private.h" #include "cogl-texture-2d-nop-private.h" #include "cogl-attribute-nop-private.h" @@ -44,7 +43,7 @@ static gboolean _cogl_driver_update_features (CoglContext *ctx, - CoglError **error) + GError **error) { /* _cogl_gpu_info_init (ctx, &ctx->gpu); */ diff --git a/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h b/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h index 05bbde6b4..c04da9d6a 100644 --- a/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h +++ b/cogl/cogl/driver/nop/cogl-framebuffer-nop-private.h @@ -39,7 +39,7 @@ gboolean _cogl_offscreen_nop_allocate (CoglOffscreen *offscreen, - CoglError **error); + GError **error); void _cogl_offscreen_nop_free (CoglOffscreen *offscreen); @@ -95,6 +95,6 @@ _cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error); + GError **error); #endif /* _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ */ diff --git a/cogl/cogl/driver/nop/cogl-framebuffer-nop.c b/cogl/cogl/driver/nop/cogl-framebuffer-nop.c index 643e304ea..f94bab641 100644 --- a/cogl/cogl/driver/nop/cogl-framebuffer-nop.c +++ b/cogl/cogl/driver/nop/cogl-framebuffer-nop.c @@ -44,7 +44,7 @@ _cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer, gboolean _cogl_offscreen_nop_allocate (CoglOffscreen *offscreen, - CoglError **error) + GError **error) { return TRUE; } @@ -113,7 +113,7 @@ _cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, - CoglError **error) + GError **error) { return TRUE; } diff --git a/cogl/cogl/driver/nop/cogl-texture-2d-nop-private.h b/cogl/cogl/driver/nop/cogl-texture-2d-nop-private.h index 499c65b1e..552975959 100644 --- a/cogl/cogl/driver/nop/cogl-texture-2d-nop-private.h +++ b/cogl/cogl/driver/nop/cogl-texture-2d-nop-private.h @@ -52,7 +52,7 @@ _cogl_texture_2d_nop_init (CoglTexture2D *tex_2d); gboolean _cogl_texture_2d_nop_allocate (CoglTexture *tex, - CoglError **error); + GError **error); void _cogl_texture_2d_nop_flush_legacy_texobj_filters (CoglTexture *tex, @@ -92,7 +92,7 @@ _cogl_texture_2d_nop_copy_from_bitmap (CoglTexture2D *tex_2d, int dst_x, int dst_y, int level, - CoglError **error); + GError **error); void _cogl_texture_2d_nop_get_data (CoglTexture2D *tex_2d, diff --git a/cogl/cogl/driver/nop/cogl-texture-2d-nop.c b/cogl/cogl/driver/nop/cogl-texture-2d-nop.c index 66a02c22a..eb07b6e89 100644 --- a/cogl/cogl/driver/nop/cogl-texture-2d-nop.c +++ b/cogl/cogl/driver/nop/cogl-texture-2d-nop.c @@ -39,7 +39,6 @@ #include "cogl-private.h" #include "cogl-texture-2d-nop-private.h" #include "cogl-texture-2d-private.h" -#include "cogl-error-private.h" void _cogl_texture_2d_nop_free (CoglTexture2D *tex_2d) @@ -62,7 +61,7 @@ _cogl_texture_2d_nop_init (CoglTexture2D *tex_2d) gboolean _cogl_texture_2d_nop_allocate (CoglTexture *tex, - CoglError **error) + GError **error) { return TRUE; } @@ -116,7 +115,7 @@ _cogl_texture_2d_nop_copy_from_bitmap (CoglTexture2D *tex_2d, int dst_x, int dst_y, int level, - CoglError **error) + GError **error) { return TRUE; } diff --git a/cogl/cogl/libmutter-cogl.map.in b/cogl/cogl/libmutter-cogl.map.in index 4e31a157b..12ae32d6d 100644 --- a/cogl/cogl/libmutter-cogl.map.in +++ b/cogl/cogl/libmutter-cogl.map.in @@ -37,7 +37,6 @@ global: _cogl_onscreen_notify_frame_sync; _cogl_winsys_egl_renderer_connect_common; _cogl_winsys_error_quark; - _cogl_set_error; _cogl_poll_renderer_add_fd; _cogl_poll_renderer_add_idle; _cogl_framebuffer_winsys_update_size; diff --git a/cogl/cogl/meson.build b/cogl/cogl/meson.build index f89b4fb7d..dab2674c4 100644 --- a/cogl/cogl/meson.build +++ b/cogl/cogl/meson.build @@ -131,7 +131,6 @@ cogl_nonintrospected_headers = [ 'cogl-macros.h', 'cogl-fence.h', 'cogl-version.h', - 'cogl-error.h', 'cogl-gtype-private.h', 'cogl-glib-source.h', ] @@ -365,8 +364,6 @@ cogl_sources = [ 'cogl-magazine.c', 'cogl-gles2-context-private.h', 'cogl-gles2-context.c', - 'cogl-error-private.h', - 'cogl-error.c', 'cogl-closure-list-private.h', 'cogl-closure-list.c', 'cogl-fence.c', diff --git a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c index d15a69ad9..df8295685 100644 --- a/cogl/cogl/winsys/cogl-texture-pixmap-x11.c +++ b/cogl/cogl/winsys/cogl-texture-pixmap-x11.c @@ -49,7 +49,6 @@ #include "cogl-renderer-private.h" #include "cogl-object-private.h" #include "cogl-xlib.h" -#include "cogl-error-private.h" #include "cogl-private.h" #include "cogl-gtype-private.h" #include "driver/gl/cogl-pipeline-opengl-private.h" @@ -287,7 +286,7 @@ _cogl_texture_pixmap_x11_new (CoglContext *ctxt, uint32_t pixmap, gboolean automatic_updates, CoglTexturePixmapStereoMode stereo_mode, - CoglError **error) + GError **error) { CoglTexturePixmapX11 *tex_pixmap = g_new (CoglTexturePixmapX11, 1); Display *display = cogl_xlib_renderer_get_display (ctxt->display->renderer); @@ -307,10 +306,10 @@ _cogl_texture_pixmap_x11_new (CoglContext *ctxt, &pixmap_border_width, &tex_pixmap->depth)) { g_free (tex_pixmap); - _cogl_set_error (error, - COGL_TEXTURE_PIXMAP_X11_ERROR, - COGL_TEXTURE_PIXMAP_X11_ERROR_X11, - "Unable to query pixmap size"); + g_set_error_literal (error, + COGL_TEXTURE_PIXMAP_X11_ERROR, + COGL_TEXTURE_PIXMAP_X11_ERROR_X11, + "Unable to query pixmap size"); return NULL; } @@ -339,10 +338,10 @@ _cogl_texture_pixmap_x11_new (CoglContext *ctxt, if (!XGetWindowAttributes (display, pixmap_root_window, &window_attributes)) { g_free (tex_pixmap); - _cogl_set_error (error, - COGL_TEXTURE_PIXMAP_X11_ERROR, - COGL_TEXTURE_PIXMAP_X11_ERROR_X11, - "Unable to query root window attributes"); + g_set_error_literal (error, + COGL_TEXTURE_PIXMAP_X11_ERROR, + COGL_TEXTURE_PIXMAP_X11_ERROR_X11, + "Unable to query root window attributes"); return NULL; } @@ -392,7 +391,7 @@ CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new (CoglContext *ctxt, uint32_t pixmap, gboolean automatic_updates, - CoglError **error) + GError **error) { return _cogl_texture_pixmap_x11_new (ctxt, pixmap, @@ -404,7 +403,7 @@ CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new_left (CoglContext *ctxt, uint32_t pixmap, gboolean automatic_updates, - CoglError **error) + GError **error) { return _cogl_texture_pixmap_x11_new (ctxt, pixmap, automatic_updates, COGL_TEXTURE_PIXMAP_LEFT, @@ -443,7 +442,7 @@ cogl_texture_pixmap_x11_new_right (CoglTexturePixmapX11 *tfp_left) static gboolean _cogl_texture_pixmap_x11_allocate (CoglTexture *tex, - CoglError **error) + GError **error) { return TRUE; } @@ -579,7 +578,7 @@ create_fallback_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)); @@ -592,7 +591,7 @@ create_fallback_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; } @@ -624,7 +623,7 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap) int x, y, width, height; int bpp; int offset; - CoglError *ignore = NULL; + GError *ignore = NULL; _COGL_GET_CONTEXT (ctx, NO_RETVAL); @@ -846,14 +845,15 @@ _cogl_texture_pixmap_x11_set_region (CoglTexture *tex, int dst_height, int level, CoglBitmap *bmp, - CoglError **error) + GError **error) { /* This doesn't make much sense for texture from pixmap so it's not supported */ - _cogl_set_error (error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_UNSUPPORTED, - "Explicitly setting a region of a TFP texture unsupported"); + g_set_error_literal (error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_UNSUPPORTED, + "Explicitly setting a region of a TFP texture " + "unsupported"); return FALSE; } diff --git a/cogl/cogl/winsys/cogl-texture-pixmap-x11.h b/cogl/cogl/winsys/cogl-texture-pixmap-x11.h index f23f5168b..844f0cd83 100644 --- a/cogl/cogl/winsys/cogl-texture-pixmap-x11.h +++ b/cogl/cogl/winsys/cogl-texture-pixmap-x11.h @@ -86,7 +86,7 @@ typedef enum /** * COGL_TEXTURE_PIXMAP_X11_ERROR: * - * #CoglError domain for texture-pixmap-x11 errors. + * #GError domain for texture-pixmap-x11 errors. * * Since: 1.10 */ @@ -114,7 +114,7 @@ uint32_t cogl_texture_pixmap_x11_error_quark (void); * @pixmap: A X11 pixmap ID * @automatic_updates: Whether to automatically copy the contents of * the pixmap to the texture. - * @error: A #CoglError for exceptions + * @error: A #GError for exceptions * * Creates a texture that contains the contents of @pixmap. If * @automatic_updates is %TRUE then Cogl will attempt to listen for @@ -130,7 +130,7 @@ CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new (CoglContext *context, uint32_t pixmap, gboolean automatic_updates, - CoglError **error); + GError **error); /** * cogl_texture_pixmap_x11_new_left: @@ -138,7 +138,7 @@ cogl_texture_pixmap_x11_new (CoglContext *context, * @pixmap: A X11 pixmap ID * @automatic_updates: Whether to automatically copy the contents of * the pixmap to the texture. - * @error: A #CoglError for exceptions + * @error: A #GError for exceptions * * Creates one of a pair of textures to contain the contents of @pixmap, * which has stereo content. (Different images for the right and left eyes.) @@ -169,7 +169,7 @@ CoglTexturePixmapX11 * cogl_texture_pixmap_x11_new_left (CoglContext *context, uint32_t pixmap, gboolean automatic_updates, - CoglError **error); + GError **error); /** * cogl_texture_pixmap_x11_new_right: diff --git a/cogl/cogl/winsys/cogl-winsys-egl-private.h b/cogl/cogl/winsys/cogl-winsys-egl-private.h index 89fe585b9..9b5350e41 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl-private.h +++ b/cogl/cogl/winsys/cogl-winsys-egl-private.h @@ -62,19 +62,19 @@ typedef struct _CoglWinsysEGLVtable { gboolean (* display_setup) (CoglDisplay *display, - CoglError **error); + GError **error); void (* display_destroy) (CoglDisplay *display); gboolean (* context_created) (CoglDisplay *display, - CoglError **error); + GError **error); void (* cleanup_context) (CoglDisplay *display); gboolean - (* context_init) (CoglContext *context, CoglError **error); + (* context_init) (CoglContext *context, GError **error); void (* context_deinit) (CoglContext *context); @@ -82,7 +82,7 @@ typedef struct _CoglWinsysEGLVtable gboolean (* onscreen_init) (CoglOnscreen *onscreen, EGLConfig config, - CoglError **error); + GError **error); void (* onscreen_deinit) (CoglOnscreen *onscreen); @@ -94,7 +94,7 @@ typedef struct _CoglWinsysEGLVtable (* choose_config) (CoglDisplay *display, EGLint *attributes, EGLConfig *out_config, - CoglError **error); + GError **error); } CoglWinsysEGLVtable; typedef enum _CoglEGLWinsysFeature @@ -207,6 +207,6 @@ _cogl_egl_query_wayland_buffer (CoglContext *ctx, gboolean _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, - CoglError **error); + GError **error); #endif /* __COGL_WINSYS_EGL_PRIVATE_H */ diff --git a/cogl/cogl/winsys/cogl-winsys-egl-x11.c b/cogl/cogl/winsys/cogl-winsys-egl-x11.c index 4f0a12543..9735c7605 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl-x11.c +++ b/cogl/cogl/winsys/cogl-winsys-egl-x11.c @@ -44,7 +44,6 @@ #include "cogl-texture-pixmap-x11-private.h" #include "cogl-texture-2d-private.h" #include "cogl-texture-2d.h" -#include "cogl-error-private.h" #include "cogl-poll-private.h" #include "winsys/cogl-winsys-egl-x11-private.h" #include "winsys/cogl-winsys-egl-private.h" @@ -294,7 +293,7 @@ _cogl_winsys_egl_get_display (void *native) static gboolean _cogl_winsys_renderer_connect (CoglRenderer *renderer, - CoglError **error) + GError **error) { CoglRendererEGL *egl_renderer; CoglXlibRenderer *xlib_renderer; @@ -337,7 +336,7 @@ static gboolean _cogl_winsys_egl_choose_config (CoglDisplay *display, EGLint *attributes, EGLConfig *out_config, - CoglError **error) + GError **error) { CoglRenderer *renderer = display->renderer; CoglRendererEGL *egl_renderer = renderer->winsys; @@ -350,9 +349,9 @@ _cogl_winsys_egl_choose_config (CoglDisplay *display, &config_count); if (status != EGL_TRUE || config_count == 0) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "No compatible EGL configs found"); + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "No compatible EGL configs found"); return FALSE; } @@ -361,7 +360,7 @@ _cogl_winsys_egl_choose_config (CoglDisplay *display, static gboolean _cogl_winsys_egl_display_setup (CoglDisplay *display, - CoglError **error) + GError **error) { CoglDisplayEGL *egl_display = display->winsys; CoglDisplayXlib *xlib_display; @@ -382,7 +381,7 @@ _cogl_winsys_egl_display_destroy (CoglDisplay *display) static gboolean _cogl_winsys_egl_context_init (CoglContext *context, - CoglError **error) + GError **error) { cogl_xlib_renderer_add_filter (context->display->renderer, event_filter_cb, @@ -415,7 +414,7 @@ _cogl_winsys_egl_context_deinit (CoglContext *context) static gboolean _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, EGLConfig egl_config, - CoglError **error) + GError **error) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = framebuffer->context; @@ -456,7 +455,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, char message[1000]; XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof (message)); - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_ONSCREEN, "Unable to query geometry of foreign " "xid 0x%08lX: %s", @@ -491,7 +490,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, xvisinfo = get_visual_info (display, egl_config); if (xvisinfo == NULL) { - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_ONSCREEN, "Unable to retrieve the X11 visual of context's " "fbconfig"); @@ -533,7 +532,7 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen, char message[1000]; XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof (message)); - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_ONSCREEN, "X error while creating Window for CoglOnscreen: %s", message); @@ -654,7 +653,7 @@ _cogl_winsys_onscreen_x11_get_window_xid (CoglOnscreen *onscreen) static gboolean _cogl_winsys_egl_context_created (CoglDisplay *display, - CoglError **error) + GError **error) { CoglRenderer *renderer = display->renderer; CoglDisplayEGL *egl_display = display->winsys; @@ -727,7 +726,7 @@ _cogl_winsys_egl_context_created (CoglDisplay *display, return TRUE; fail: - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, "%s", error_message); return FALSE; diff --git a/cogl/cogl/winsys/cogl-winsys-egl.c b/cogl/cogl/winsys/cogl-winsys-egl.c index b9a484bfa..a5a665f03 100644 --- a/cogl/cogl/winsys/cogl-winsys-egl.c +++ b/cogl/cogl/winsys/cogl-winsys-egl.c @@ -42,7 +42,6 @@ #include "cogl-renderer-private.h" #include "cogl-onscreen-template-private.h" #include "cogl-gles2-context-private.h" -#include "cogl-error-private.h" #include "cogl-egl.h" #include "cogl-private.h" #include "winsys/cogl-winsys-egl-private.h" @@ -201,7 +200,7 @@ check_egl_extensions (CoglRenderer *renderer) gboolean _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, - CoglError **error) + GError **error) { CoglRendererEGL *egl_renderer = renderer->winsys; @@ -209,7 +208,7 @@ _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, &egl_renderer->egl_version_major, &egl_renderer->egl_version_minor)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_INIT, "Couldn't initialize EGL"); return FALSE; @@ -222,7 +221,7 @@ _cogl_winsys_egl_renderer_connect_common (CoglRenderer *renderer, static gboolean _cogl_winsys_renderer_connect (CoglRenderer *renderer, - CoglError **error) + GError **error) { /* This function must be overridden by a platform winsys */ g_assert_not_reached (); @@ -346,7 +345,7 @@ cleanup_context (CoglDisplay *display) static gboolean try_create_context (CoglDisplay *display, - CoglError **error) + GError **error) { CoglRenderer *renderer = display->renderer; CoglDisplayEGL *egl_display = display->winsys; @@ -376,9 +375,9 @@ try_create_context (CoglDisplay *display, &config, &config_error)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Couldn't choose config: %s", config_error->message); + g_set_error (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Couldn't choose config: %s", config_error->message); g_error_free (config_error); goto err; } @@ -451,7 +450,7 @@ try_create_context (CoglDisplay *display, return TRUE; fail: - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, "%s", error_message); @@ -480,7 +479,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display) static gboolean _cogl_winsys_display_setup (CoglDisplay *display, - CoglError **error) + GError **error) { CoglDisplayEGL *egl_display; CoglRenderer *renderer = display->renderer; @@ -520,7 +519,7 @@ error: } static gboolean -_cogl_winsys_context_init (CoglContext *context, CoglError **error) +_cogl_winsys_context_init (CoglContext *context, GError **error) { CoglRenderer *renderer = context->display->renderer; CoglDisplayEGL *egl_display = context->display->winsys; @@ -591,7 +590,7 @@ typedef struct _CoglGLES2ContextEGL } CoglGLES2ContextEGL; static void * -_cogl_winsys_context_create_gles2_context (CoglContext *ctx, CoglError **error) +_cogl_winsys_context_create_gles2_context (CoglContext *ctx, GError **error) { CoglRendererEGL *egl_renderer = ctx->display->renderer->winsys; CoglDisplayEGL *egl_display = ctx->display->winsys; @@ -608,7 +607,7 @@ _cogl_winsys_context_create_gles2_context (CoglContext *ctx, CoglError **error) attribs); if (egl_context == EGL_NO_CONTEXT) { - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_GLES2_CONTEXT, "%s", get_error_string ()); return NULL; @@ -634,7 +633,7 @@ _cogl_winsys_destroy_gles2_context (CoglGLES2Context *gles2_ctx) static gboolean _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, - CoglError **error) + GError **error) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = framebuffer->context; @@ -659,7 +658,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, &config_count); if (status != EGL_TRUE || config_count == 0) { - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_ONSCREEN, "Failed to find a suitable EGL configuration"); return FALSE; @@ -890,7 +889,7 @@ _cogl_winsys_save_context (CoglContext *ctx) } static gboolean -_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **error) +_cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, GError **error) { CoglContext *ctx = gles2_ctx->context; CoglDisplayEGL *egl_display = ctx->display->winsys; @@ -909,7 +908,7 @@ _cogl_winsys_set_gles2_context (CoglGLES2Context *gles2_ctx, CoglError **error) if (!status) { - _cogl_set_error (error, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_MAKE_CURRENT, "Failed to make gles2 context current"); diff --git a/cogl/cogl/winsys/cogl-winsys-glx.c b/cogl/cogl/winsys/cogl-winsys-glx.c index cc4a5e3ca..a97cc5b14 100644 --- a/cogl/cogl/winsys/cogl-winsys-glx.c +++ b/cogl/cogl/winsys/cogl-winsys-glx.c @@ -50,7 +50,6 @@ #include "cogl-swap-chain-private.h" #include "cogl-xlib-renderer.h" #include "cogl-util.h" -#include "cogl-error-private.h" #include "cogl-poll-private.h" #include "cogl-version.h" #include "cogl-glx.h" @@ -660,7 +659,7 @@ _cogl_winsys_renderer_outputs_changed (CoglRenderer *renderer) static gboolean resolve_core_glx_functions (CoglRenderer *renderer, - CoglError **error) + GError **error) { CoglGLXRenderer *glx_renderer; @@ -679,9 +678,9 @@ resolve_core_glx_functions (CoglRenderer *renderer, !g_module_symbol (glx_renderer->libgl_module, "glXQueryDrawable", (void **) &glx_renderer->glXQueryDrawable)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, - "Failed to resolve required GLX symbol"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to resolve required GLX symbol"); return FALSE; } @@ -753,7 +752,7 @@ update_base_winsys_features (CoglRenderer *renderer) static gboolean _cogl_winsys_renderer_connect (CoglRenderer *renderer, - CoglError **error) + GError **error) { CoglGLXRenderer *glx_renderer; CoglXlibRenderer *xlib_renderer; @@ -769,9 +768,9 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, if (renderer->driver != COGL_DRIVER_GL && renderer->driver != COGL_DRIVER_GL3) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, - "GLX Backend can only be used in conjunction with OpenGL"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "GLX Backend can only be used in conjunction with OpenGL"); goto error; } @@ -780,9 +779,9 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, if (glx_renderer->libgl_module == NULL) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, - "Failed to dynamically open the OpenGL library"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "Failed to dynamically open the OpenGL library"); goto error; } @@ -793,9 +792,9 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, &glx_renderer->glx_error_base, &glx_renderer->glx_event_base)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, - "XServer appears to lack required GLX support"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "XServer appears to lack required GLX support"); goto error; } @@ -807,9 +806,9 @@ _cogl_winsys_renderer_connect (CoglRenderer *renderer, &glx_renderer->glx_minor) || !(glx_renderer->glx_major == 1 && glx_renderer->glx_minor >= 2)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_INIT, - "XServer appears to lack required GLX 1.2 support"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_INIT, + "XServer appears to lack required GLX 1.2 support"); goto error; } @@ -825,7 +824,7 @@ error: } static gboolean -update_winsys_features (CoglContext *context, CoglError **error) +update_winsys_features (CoglContext *context, GError **error) { CoglGLXDisplay *glx_display = context->display->winsys; CoglGLXRenderer *glx_renderer = context->display->renderer->winsys; @@ -986,7 +985,7 @@ static gboolean find_fbconfig (CoglDisplay *display, CoglFramebufferConfig *config, GLXFBConfig *config_ret, - CoglError **error) + GError **error) { CoglXlibRenderer *xlib_renderer = _cogl_xlib_renderer_get_data (display->renderer); @@ -1006,9 +1005,9 @@ find_fbconfig (CoglDisplay *display, if (!configs || n_configs == 0) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Failed to find any compatible fbconfigs"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Failed to find any compatible fbconfigs"); ret = FALSE; goto done; } @@ -1036,9 +1035,9 @@ find_fbconfig (CoglDisplay *display, } } - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Unable to find fbconfig with rgba visual"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to find fbconfig with rgba visual"); ret = FALSE; goto done; } @@ -1122,7 +1121,7 @@ create_gl3_context (CoglDisplay *display, } static gboolean -create_context (CoglDisplay *display, CoglError **error) +create_context (CoglDisplay *display, GError **error) { CoglGLXDisplay *glx_display = display->winsys; CoglXlibRenderer *xlib_renderer = @@ -1131,7 +1130,7 @@ create_context (CoglDisplay *display, CoglError **error) gboolean support_transparent_windows = display->onscreen_template->config.swap_chain->has_alpha; GLXFBConfig config; - CoglError *fbconfig_error = NULL; + GError *fbconfig_error = NULL; XSetWindowAttributes attrs; XVisualInfo *xvisinfo; GLXDrawable dummy_drawable; @@ -1144,11 +1143,11 @@ create_context (CoglDisplay *display, CoglError **error) &fbconfig_error); if (!glx_display->found_fbconfig) { - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, "Unable to find suitable fbconfig for the GLX context: %s", fbconfig_error->message); - cogl_error_free (fbconfig_error); + g_error_free (fbconfig_error); return FALSE; } @@ -1173,9 +1172,9 @@ create_context (CoglDisplay *display, CoglError **error) if (_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state) || glx_display->glx_context == NULL) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Unable to create suitable GL context"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to create suitable GL context"); return FALSE; } @@ -1196,9 +1195,9 @@ create_context (CoglDisplay *display, CoglError **error) config); if (xvisinfo == NULL) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Unable to retrieve the X11 visual"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to retrieve the X11 visual"); return FALSE; } @@ -1251,9 +1250,9 @@ create_context (CoglDisplay *display, CoglError **error) if (_cogl_xlib_renderer_untrap_errors (display->renderer, &old_state)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_CONTEXT, - "Unable to select the newly created GLX context"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_CONTEXT, + "Unable to select the newly created GLX context"); return FALSE; } @@ -1298,7 +1297,7 @@ _cogl_winsys_display_destroy (CoglDisplay *display) static gboolean _cogl_winsys_display_setup (CoglDisplay *display, - CoglError **error) + GError **error) { CoglGLXDisplay *glx_display; int i; @@ -1322,7 +1321,7 @@ error: } static gboolean -_cogl_winsys_context_init (CoglContext *context, CoglError **error) +_cogl_winsys_context_init (CoglContext *context, GError **error) { context->winsys = g_new0 (CoglContextGLX, 1); @@ -1343,7 +1342,7 @@ _cogl_winsys_context_deinit (CoglContext *context) static gboolean _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, - CoglError **error) + GError **error) { CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen); CoglContext *context = framebuffer->context; @@ -1356,7 +1355,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, CoglOnscreenXlib *xlib_onscreen; CoglOnscreenGLX *glx_onscreen; GLXFBConfig fbconfig; - CoglError *fbconfig_error = NULL; + GError *fbconfig_error = NULL; g_return_val_if_fail (glx_display->glx_context, FALSE); @@ -1364,11 +1363,11 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, &fbconfig, &fbconfig_error)) { - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT, "Unable to find suitable fbconfig for the GLX context: %s", fbconfig_error->message); - cogl_error_free (fbconfig_error); + g_error_free (fbconfig_error); return FALSE; } @@ -1412,7 +1411,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, { char message[1000]; XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof(message)); - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_ONSCREEN, "Unable to query geometry of foreign xid 0x%08lX: %s", xwin, message); @@ -1446,10 +1445,10 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, fbconfig); if (xvisinfo == NULL) { - _cogl_set_error (error, COGL_WINSYS_ERROR, - COGL_WINSYS_ERROR_CREATE_ONSCREEN, - "Unable to retrieve the X11 visual of context's " - "fbconfig"); + g_set_error_literal (error, COGL_WINSYS_ERROR, + COGL_WINSYS_ERROR_CREATE_ONSCREEN, + "Unable to retrieve the X11 visual of context's " + "fbconfig"); return FALSE; } @@ -1485,7 +1484,7 @@ _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, char message[1000]; XGetErrorText (xlib_renderer->xdpy, xerror, message, sizeof (message)); - _cogl_set_error (error, COGL_WINSYS_ERROR, + g_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_ONSCREEN, "X error while creating Window for CoglOnscreen: %s", message); @@ -1688,8 +1687,7 @@ _cogl_winsys_onscreen_bind (CoglOnscreen *onscreen) XSync (xlib_renderer->xdpy, False); - /* FIXME: We should be reporting a CoglError here - */ + /* FIXME: We should be reporting a GError here */ if (_cogl_xlib_renderer_untrap_errors (context->display->renderer, &old_state)) { @@ -2757,7 +2755,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, if (texture_info->glx_tex == NULL) { CoglPixelFormat texture_format; - CoglError *error = NULL; + GError *error = NULL; texture_format = (tex_pixmap->depth >= 32 ? COGL_PIXEL_FORMAT_RGBA_8888_PRE : @@ -2775,7 +2773,7 @@ _cogl_winsys_texture_pixmap_x11_update (CoglTexturePixmapX11 *tex_pixmap, COGL_NOTE (TEXTURE_PIXMAP, "Falling back for %p because a " "texture 2d could not be created: %s", tex_pixmap, error->message); - cogl_error_free (error); + g_error_free (error); free_glx_pixmap (ctx, glx_tex_pixmap); return FALSE; } diff --git a/cogl/cogl/winsys/cogl-winsys-private.h b/cogl/cogl/winsys/cogl-winsys-private.h index 759d8615c..e855afd45 100644 --- a/cogl/cogl/winsys/cogl-winsys-private.h +++ b/cogl/cogl/winsys/cogl-winsys-private.h @@ -79,7 +79,7 @@ typedef struct _CoglWinsysVtable gboolean in_core); gboolean - (*renderer_connect) (CoglRenderer *renderer, CoglError **error); + (*renderer_connect) (CoglRenderer *renderer, GError **error); void (*renderer_disconnect) (CoglRenderer *renderer); @@ -88,22 +88,22 @@ typedef struct _CoglWinsysVtable (*renderer_outputs_changed) (CoglRenderer *renderer); gboolean - (*display_setup) (CoglDisplay *display, CoglError **error); + (*display_setup) (CoglDisplay *display, GError **error); void (*display_destroy) (CoglDisplay *display); gboolean - (*context_init) (CoglContext *context, CoglError **error); + (*context_init) (CoglContext *context, GError **error); void (*context_deinit) (CoglContext *context); void * - (*context_create_gles2_context) (CoglContext *ctx, CoglError **error); + (*context_create_gles2_context) (CoglContext *ctx, GError **error); gboolean - (*onscreen_init) (CoglOnscreen *onscreen, CoglError **error); + (*onscreen_init) (CoglOnscreen *onscreen, GError **error); void (*onscreen_deinit) (CoglOnscreen *onscreen); @@ -162,7 +162,7 @@ typedef struct _CoglWinsysVtable (*save_context) (CoglContext *ctx); gboolean - (*set_gles2_context) (CoglGLES2Context *gles2_ctx, CoglError **error); + (*set_gles2_context) (CoglGLES2Context *gles2_ctx, GError **error); void (*restore_context) (CoglContext *ctx); diff --git a/cogl/cogl/winsys/cogl-winsys-stub.c b/cogl/cogl/winsys/cogl-winsys-stub.c index 6edebadcd..fee65ab71 100644 --- a/cogl/cogl/winsys/cogl-winsys-stub.c +++ b/cogl/cogl/winsys/cogl-winsys-stub.c @@ -80,7 +80,7 @@ _cogl_winsys_renderer_disconnect (CoglRenderer *renderer) static gboolean _cogl_winsys_renderer_connect (CoglRenderer *renderer, - CoglError **error) + GError **error) { renderer->winsys = &_cogl_winsys_stub_dummy_ptr; return TRUE; @@ -94,14 +94,14 @@ _cogl_winsys_display_destroy (CoglDisplay *display) static gboolean _cogl_winsys_display_setup (CoglDisplay *display, - CoglError **error) + GError **error) { display->winsys = &_cogl_winsys_stub_dummy_ptr; return TRUE; } static gboolean -_cogl_winsys_context_init (CoglContext *context, CoglError **error) +_cogl_winsys_context_init (CoglContext *context, GError **error) { context->winsys = &_cogl_winsys_stub_dummy_ptr; @@ -121,7 +121,7 @@ _cogl_winsys_context_deinit (CoglContext *context) static gboolean _cogl_winsys_onscreen_init (CoglOnscreen *onscreen, - CoglError **error) + GError **error) { return TRUE; } diff --git a/cogl/test-fixtures/test-utils.c b/cogl/test-fixtures/test-utils.c index b8af0b6d1..e0dce2505 100644 --- a/cogl/test-fixtures/test-utils.c +++ b/cogl/test-fixtures/test-utils.c @@ -106,7 +106,7 @@ test_utils_init (TestFlags requirement_flags, TestFlags known_failure_flags) { static int counter = 0; - CoglError *error = NULL; + GError *error = NULL; CoglOnscreen *onscreen = NULL; CoglDisplay *display; CoglRenderer *renderer; @@ -347,7 +347,7 @@ test_utils_texture_new_with_size (CoglContext *ctx, CoglTextureComponents components) { 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)); @@ -356,7 +356,7 @@ test_utils_texture_new_with_size (CoglContext *ctx, if (!cogl_texture_allocate (tex, &skip_error)) { - cogl_error_free (skip_error); + g_error_free (skip_error); cogl_object_unref (tex); tex = NULL; } @@ -402,7 +402,7 @@ test_utils_texture_new_from_bitmap (CoglBitmap *bitmap, { CoglAtlasTexture *atlas_tex; CoglTexture *tex; - CoglError *internal_error = NULL; + GError *internal_error = NULL; if (!flags) { @@ -414,29 +414,25 @@ test_utils_texture_new_from_bitmap (CoglBitmap *bitmap, if (cogl_texture_allocate (COGL_TEXTURE (atlas_tex), &internal_error)) return COGL_TEXTURE (atlas_tex); - cogl_error_free (internal_error); cogl_object_unref (atlas_tex); - internal_error = NULL; } + g_clear_error (&internal_error); + /* If that doesn't work try a fast path 2D texture */ tex = COGL_TEXTURE (cogl_texture_2d_new_from_bitmap (bitmap)); cogl_texture_set_premultiplied (tex, premultiplied); - if (cogl_error_matches (internal_error, - COGL_SYSTEM_ERROR, - COGL_SYSTEM_ERROR_NO_MEMORY)) + if (g_error_matches (internal_error, + COGL_SYSTEM_ERROR, + COGL_SYSTEM_ERROR_NO_MEMORY)) { g_assert_not_reached (); return NULL; } - if (!tex) - { - cogl_error_free (internal_error); - internal_error = NULL; - } + g_clear_error (&internal_error); if (!tex) { diff --git a/cogl/test-fixtures/test-utils.h b/cogl/test-fixtures/test-utils.h index 3ce68895b..485c12375 100644 --- a/cogl/test-fixtures/test-utils.h +++ b/cogl/test-fixtures/test-utils.h @@ -112,7 +112,7 @@ test_utils_texture_new_with_size (CoglContext *ctx, * @rowstride: the memory offset in bytes between the starts of * scanlines in @data * @data: pointer 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 #CoglTexture based on data residing in memory. * diff --git a/cogl/tests/conform/test-blend-strings.c b/cogl/tests/conform/test-blend-strings.c index 08537fcaf..bf7f1be0e 100644 --- a/cogl/tests/conform/test-blend-strings.c +++ b/cogl/tests/conform/test-blend-strings.c @@ -56,7 +56,7 @@ test_blend_paint (TestState *state, CoglHandle material; CoglPipeline *pipeline; gboolean status; - CoglError *error = NULL; + GError *error = NULL; int y_off; int x_off; @@ -231,7 +231,7 @@ test_tex_combine (TestState *state, CoglHandle material; gboolean status; - CoglError *error = NULL; + GError *error = NULL; int y_off; int x_off; diff --git a/cogl/tests/conform/test-gles2-context.c b/cogl/tests/conform/test-gles2-context.c index 1560dbaaa..922564488 100644 --- a/cogl/tests/conform/test-gles2-context.c +++ b/cogl/tests/conform/test-gles2-context.c @@ -22,7 +22,7 @@ test_push_pop_single_context (void) CoglPipeline *pipeline; CoglGLES2Context *gles2_ctx; const CoglGLES2Vtable *gles2; - CoglError *error = NULL; + GError *error = NULL; offscreen_texture = cogl_texture_2d_new_with_size (test_ctx, @@ -145,7 +145,7 @@ create_gles2_context (CoglTexture **offscreen_texture, CoglGLES2Context **gles2_ctx, const CoglGLES2Vtable **gles2) { - CoglError *error = NULL; + GError *error = NULL; *offscreen_texture = cogl_texture_2d_new_with_size (test_ctx, @@ -176,7 +176,7 @@ test_push_pop_multi_context (void) CoglPipeline *pipeline1; CoglGLES2Context *gles2_ctx1; const CoglGLES2Vtable *gles21; - CoglError *error = NULL; + GError *error = NULL; create_gles2_context (&offscreen_texture0, &offscreen0, @@ -275,7 +275,7 @@ test_gles2_read_pixels (void) CoglPipeline *pipeline; CoglGLES2Context *gles2_ctx; const CoglGLES2Vtable *gles2; - CoglError *error = NULL; + GError *error = NULL; GLubyte pixel[4]; GLuint fbo_handle; @@ -671,7 +671,7 @@ test_gles2_context_fbo (void) CoglPipeline *pipeline; CoglGLES2Context *gles2_ctx; GLuint program; - CoglError *error = NULL; + GError *error = NULL; create_gles2_context (&offscreen_texture, &offscreen, @@ -801,7 +801,7 @@ test_gles2_context_copy_tex_image (void) CoglPipeline *pipeline; CoglGLES2Context *gles2_ctx; const CoglGLES2Vtable *gles2; - CoglError *error = NULL; + GError *error = NULL; GLuint tex; GLint tex_uniform_location; GLint pos_location; diff --git a/cogl/tests/conform/test-just-vertex-shader.c b/cogl/tests/conform/test-just-vertex-shader.c index d4e6ca807..a6ec9975d 100644 --- a/cogl/tests/conform/test-just-vertex-shader.c +++ b/cogl/tests/conform/test-just-vertex-shader.c @@ -33,7 +33,7 @@ paint_legacy (TestState *state) CoglHandle material = cogl_material_new (); CoglTexture *tex; CoglColor color; - CoglError *error = NULL; + GError *error = NULL; CoglHandle shader, program; cogl_color_init_from_4ub (&color, 0, 0, 0, 255); @@ -103,7 +103,7 @@ paint (TestState *state) CoglPipeline *pipeline = cogl_pipeline_new (test_ctx); CoglTexture *tex; CoglColor color; - CoglError *error = NULL; + GError *error = NULL; CoglHandle shader, program; cogl_color_init_from_4ub (&color, 0, 0, 0, 255); diff --git a/cogl/tests/conform/test-multitexture.c b/cogl/tests/conform/test-multitexture.c index b7abb6e48..4e130574c 100644 --- a/cogl/tests/conform/test-multitexture.c +++ b/cogl/tests/conform/test-multitexture.c @@ -104,7 +104,7 @@ on_paint (ClutterActor *actor, TestState *state) CoglHandle tex0, tex1; CoglHandle material; gboolean status; - CoglError *error = NULL; + GError *error = NULL; float tex_coords[] = { 0, 0, 0.5, 0.5, /* tex0 */ 0.5, 0.5, 1, 1 /* tex1 */ diff --git a/cogl/tests/conform/test-pipeline-user-matrix.c b/cogl/tests/conform/test-pipeline-user-matrix.c index 7771073f3..37304688a 100644 --- a/cogl/tests/conform/test-pipeline-user-matrix.c +++ b/cogl/tests/conform/test-pipeline-user-matrix.c @@ -55,7 +55,7 @@ paint (TestState *state) CoglTexture *tex0, *tex1; CoglPipeline *pipeline; CoglMatrix matrix; - CoglError *error = NULL; + GError *error = NULL; cogl_framebuffer_orthographic (test_fb, 0, 0, diff --git a/cogl/tests/conform/test-point-sprite.c b/cogl/tests/conform/test-point-sprite.c index bbf6a21bb..ab4391ceb 100644 --- a/cogl/tests/conform/test-point-sprite.c +++ b/cogl/tests/conform/test-point-sprite.c @@ -26,7 +26,7 @@ do_test (gboolean check_orientation, int fb_width = cogl_framebuffer_get_width (test_fb); int fb_height = cogl_framebuffer_get_height (test_fb); CoglPrimitive *prim; - CoglError *error = NULL; + GError *error = NULL; CoglTexture2D *tex_2d; CoglPipeline *pipeline, *solid_pipeline; int tex_height; diff --git a/cogl/tests/conform/test-texture-no-allocate.c b/cogl/tests/conform/test-texture-no-allocate.c index 1f65552b6..de2f6e0e3 100644 --- a/cogl/tests/conform/test-texture-no-allocate.c +++ b/cogl/tests/conform/test-texture-no-allocate.c @@ -44,7 +44,7 @@ test_texture_no_allocate (void) * crash */ if (texture == NULL) - cogl_error_free (error); + g_error_free (error); else cogl_object_unref (texture); diff --git a/src/backends/meta-cursor-sprite-xcursor.c b/src/backends/meta-cursor-sprite-xcursor.c index 49d10b94c..120ccb598 100644 --- a/src/backends/meta-cursor-sprite-xcursor.c +++ b/src/backends/meta-cursor-sprite-xcursor.c @@ -123,7 +123,7 @@ load_from_current_xcursor_image (MetaCursorSpriteXcursor *sprite_xcursor) ClutterBackend *clutter_backend; CoglContext *cogl_context; CoglTexture2D *texture; - CoglError *error = NULL; + GError *error = NULL; g_assert (!meta_cursor_sprite_get_cogl_texture (sprite)); @@ -149,7 +149,7 @@ load_from_current_xcursor_image (MetaCursorSpriteXcursor *sprite_xcursor) if (!texture) { g_warning ("Failed to allocate cursor texture: %s\n", error->message); - cogl_error_free (error); + g_error_free (error); } meta_cursor_sprite_set_texture (sprite, diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c index fe92818bf..0a39755a5 100644 --- a/src/compositor/cogl-utils.c +++ b/src/compositor/cogl-utils.c @@ -100,10 +100,10 @@ meta_create_texture (int width, /* To find out if we need to slice the texture, we have to go ahead and force storage * to be allocated */ - CoglError *catch_error = NULL; + GError *catch_error = NULL; if (!cogl_texture_allocate (texture, &catch_error)) { - cogl_error_free (catch_error); + g_error_free (catch_error); cogl_object_unref (texture); texture = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, width, height, COGL_TEXTURE_MAX_WASTE)); cogl_texture_set_components (texture, components); diff --git a/src/compositor/meta-background-image.c b/src/compositor/meta-background-image.c index 14d3baf57..a29e74380 100644 --- a/src/compositor/meta-background-image.c +++ b/src/compositor/meta-background-image.c @@ -156,7 +156,7 @@ file_loaded (GObject *source_object, { MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object); GError *error = NULL; - CoglError *catch_error = NULL; + GError *catch_error = NULL; GTask *task; CoglTexture *texture; GdkPixbuf *pixbuf, *rotated; @@ -201,7 +201,7 @@ file_loaded (GObject *source_object, &catch_error)) { g_warning ("Failed to create texture for background"); - cogl_error_free (catch_error); + g_error_free (catch_error); cogl_object_unref (texture); } diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index c033395fe..4efc1ed54 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -539,7 +539,7 @@ ensure_color_texture (MetaBackground *self) { ClutterBackend *backend = clutter_get_default_backend (); CoglContext *ctx = clutter_backend_get_cogl_context (backend); - CoglError *error = NULL; + GError *error = NULL; uint8_t pixels[6]; int width, height; @@ -585,7 +585,7 @@ ensure_color_texture (MetaBackground *self) if (error != NULL) { meta_warning ("Failed to allocate color texture: %s\n", error->message); - cogl_error_free (error); + g_error_free (error); } } } @@ -652,7 +652,7 @@ ensure_wallpaper_texture (MetaBackground *self, int height = cogl_texture_get_height (texture); CoglOffscreen *offscreen; CoglFramebuffer *fbo; - CoglError *catch_error = NULL; + GError *catch_error = NULL; CoglPipeline *pipeline; self->wallpaper_texture = meta_create_texture (width, height, @@ -667,7 +667,7 @@ ensure_wallpaper_texture (MetaBackground *self, * than the maximum texture size; we treat it as permanent until the * background is changed again. */ - cogl_error_free (catch_error); + g_error_free (catch_error); cogl_object_unref (self->wallpaper_texture); self->wallpaper_texture = NULL; @@ -771,7 +771,7 @@ meta_background_get_texture (MetaBackground *self, if (monitor->dirty) { - CoglError *catch_error = NULL; + GError *catch_error = NULL; gboolean bare_region_visible = FALSE; if (self->style != G_DESKTOP_BACKGROUND_STYLE_WALLPAPER) @@ -804,7 +804,7 @@ meta_background_get_texture (MetaBackground *self, cogl_object_unref (monitor->fbo); monitor->fbo = NULL; - cogl_error_free (catch_error); + g_error_free (catch_error); return NULL; } diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c index 0eb14c981..aa83b8629 100644 --- a/src/compositor/meta-shadow-factory.c +++ b/src/compositor/meta-shadow-factory.c @@ -715,7 +715,7 @@ make_shadow (MetaShadow *shadow, { ClutterBackend *backend = clutter_get_default_backend (); CoglContext *ctx = clutter_backend_get_cogl_context (backend); - CoglError *error = NULL; + GError *error = NULL; int d = get_box_filter_size (shadow->key.radius); int spread = get_shadow_spread (shadow->key.radius); cairo_rectangle_int_t extents; @@ -818,7 +818,7 @@ make_shadow (MetaShadow *shadow, if (error) { meta_warning ("Failed to allocate shadow texture: %s\n", error->message); - cogl_error_free (error); + g_error_free (error); } cairo_region_destroy (row_convolve_region); diff --git a/src/compositor/meta-surface-actor-x11.c b/src/compositor/meta-surface-actor-x11.c index 244b1e885..bdc5501f5 100644 --- a/src/compositor/meta-surface-actor-x11.c +++ b/src/compositor/meta-surface-actor-x11.c @@ -113,7 +113,7 @@ set_pixmap (MetaSurfaceActorX11 *self, { CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self)); - CoglError *error = NULL; + GError *error = NULL; CoglTexture *texture; g_assert (self->pixmap == None); @@ -124,7 +124,7 @@ set_pixmap (MetaSurfaceActorX11 *self, if (error != NULL) { g_warning ("Failed to allocate stex texture: %s", error->message); - cogl_error_free (error); + g_error_free (error); } else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture)))) g_warning ("NOTE: Not using GLX TFP!\n"); diff --git a/src/compositor/meta-texture-tower.c b/src/compositor/meta-texture-tower.c index a95ee5ccf..867fc16a4 100644 --- a/src/compositor/meta-texture-tower.c +++ b/src/compositor/meta-texture-tower.c @@ -373,7 +373,7 @@ texture_tower_revalidate (MetaTextureTower *tower, int dest_texture_height = cogl_texture_get_height (dest_texture); Box *invalid = &tower->invalid[level]; CoglFramebuffer *fb; - CoglError *catch_error = NULL; + GError *catch_error = NULL; CoglPipeline *pipeline; if (tower->fbos[level] == NULL) @@ -383,7 +383,7 @@ texture_tower_revalidate (MetaTextureTower *tower, if (!cogl_framebuffer_allocate (fb, &catch_error)) { - cogl_error_free (catch_error); + g_error_free (catch_error); return; } diff --git a/src/compositor/meta-window-actor.c b/src/compositor/meta-window-actor.c index 837a4c3e9..2588c74e4 100644 --- a/src/compositor/meta-window-actor.c +++ b/src/compositor/meta-window-actor.c @@ -1506,7 +1506,7 @@ build_and_scan_frame_mask (MetaWindowActor *self, int stride; cairo_t *cr; cairo_surface_t *surface; - CoglError *error = NULL; + GError *error = NULL; stex = meta_surface_actor_get_texture (priv->surface); g_return_if_fail (stex); @@ -1566,7 +1566,7 @@ build_and_scan_frame_mask (MetaWindowActor *self, if (error) { g_warning ("Failed to allocate mask texture: %s", error->message); - cogl_error_free (error); + g_error_free (error); } meta_shaped_texture_set_mask_texture (stex, mask_texture);