From 312d5c367e4bf5c14c63ed1882f172d3975a6204 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 17 Aug 2023 13:16:14 +0200 Subject: [PATCH] cogl: Port Snippet away from CoglObject Part-of: --- clutter/clutter/clutter-blur-effect.c | 2 +- clutter/clutter/clutter-blur.c | 2 +- .../clutter-brightness-contrast-effect.c | 2 +- clutter/clutter/clutter-colorize-effect.c | 2 +- clutter/clutter/clutter-desaturate-effect.c | 2 +- cogl/cogl/cogl-pipeline-layer-state.c | 2 +- cogl/cogl/cogl-pipeline-snippet.c | 6 +- cogl/cogl/cogl-pipeline-state.c | 2 +- cogl/cogl/cogl-snippet-private.h | 3 +- cogl/cogl/cogl-snippet.c | 63 +++++++++++-------- cogl/cogl/cogl-snippet.h | 36 ++++------- src/compositor/meta-multi-texture-format.c | 4 +- src/compositor/meta-shaped-texture.c | 10 +-- src/compositor/meta-texture-mipmap.c | 4 +- .../cogl/conform/test-custom-attributes.c | 2 +- .../cogl/conform/test-pipeline-shader-state.c | 4 +- .../cogl/conform/test-point-size-attribute.c | 2 +- .../conform/test-point-sprite-known-failure.c | 2 +- src/tests/cogl/conform/test-point-sprite.c | 2 +- src/tests/cogl/conform/test-snippets.c | 50 +++++++-------- src/tests/cogl/unit/test-pipeline-cache.c | 2 +- src/wayland/meta-wayland-actor-surface.c | 2 +- src/wayland/meta-wayland-egl-stream.c | 4 +- 23 files changed, 104 insertions(+), 106 deletions(-) diff --git a/clutter/clutter/clutter-blur-effect.c b/clutter/clutter/clutter-blur-effect.c index 4f672d712..67f66d1f8 100644 --- a/clutter/clutter/clutter-blur-effect.c +++ b/clutter/clutter/clutter-blur-effect.c @@ -189,7 +189,7 @@ clutter_blur_effect_init (ClutterBlurEffect *self) NULL); cogl_snippet_set_replace (snippet, box_blur_glsl_shader); cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0); } diff --git a/clutter/clutter/clutter-blur.c b/clutter/clutter/clutter-blur.c index 806bdca23..7f355c6a2 100644 --- a/clutter/clutter/clutter-blur.c +++ b/clutter/clutter/clutter-blur.c @@ -161,7 +161,7 @@ create_blur_pipeline (void) NULL); cogl_snippet_set_replace (snippet, gaussian_blur_glsl); cogl_pipeline_add_layer_snippet (blur_pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_context_set_named_pipeline (ctx, &blur_pipeline_key, blur_pipeline); } diff --git a/clutter/clutter/clutter-brightness-contrast-effect.c b/clutter/clutter/clutter-brightness-contrast-effect.c index a50abc7ae..61c2f9182 100644 --- a/clutter/clutter/clutter-brightness-contrast-effect.c +++ b/clutter/clutter/clutter-brightness-contrast-effect.c @@ -381,7 +381,7 @@ clutter_brightness_contrast_effect_init (ClutterBrightnessContrastEffect *self) brightness_contrast_decls, brightness_contrast_source); cogl_pipeline_add_snippet (klass->base_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0); } diff --git a/clutter/clutter/clutter-colorize-effect.c b/clutter/clutter/clutter-colorize-effect.c index d552fc6dc..810903ebe 100644 --- a/clutter/clutter/clutter-colorize-effect.c +++ b/clutter/clutter/clutter-colorize-effect.c @@ -225,7 +225,7 @@ clutter_colorize_effect_init (ClutterColorizeEffect *self) colorize_glsl_declarations, colorize_glsl_source); cogl_pipeline_add_snippet (klass->base_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0); } diff --git a/clutter/clutter/clutter-desaturate-effect.c b/clutter/clutter/clutter-desaturate-effect.c index 80693ac1f..61319f2d5 100644 --- a/clutter/clutter/clutter-desaturate-effect.c +++ b/clutter/clutter/clutter-desaturate-effect.c @@ -228,7 +228,7 @@ clutter_desaturate_effect_init (ClutterDesaturateEffect *self) desaturate_glsl_declarations, desaturate_glsl_source); cogl_pipeline_add_snippet (klass->base_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_pipeline_set_layer_null_texture (klass->base_pipeline, 0); } diff --git a/cogl/cogl/cogl-pipeline-layer-state.c b/cogl/cogl/cogl-pipeline-layer-state.c index 087bf05b2..29c855f58 100644 --- a/cogl/cogl/cogl-pipeline-layer-state.c +++ b/cogl/cogl/cogl-pipeline-layer-state.c @@ -681,7 +681,7 @@ cogl_pipeline_add_layer_snippet (CoglPipeline *pipeline, CoglSnippet *snippet) { g_return_if_fail (cogl_is_pipeline (pipeline)); - g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (COGL_IS_SNIPPET (snippet)); g_return_if_fail (snippet->hook >= COGL_SNIPPET_FIRST_LAYER_HOOK); if (snippet->hook < COGL_SNIPPET_FIRST_LAYER_FRAGMENT_HOOK) diff --git a/cogl/cogl/cogl-pipeline-snippet.c b/cogl/cogl/cogl-pipeline-snippet.c index ced15ce94..c4d2fcb9b 100644 --- a/cogl/cogl/cogl-pipeline-snippet.c +++ b/cogl/cogl/cogl-pipeline-snippet.c @@ -225,7 +225,7 @@ _cogl_pipeline_snippet_list_free (CoglPipelineSnippetList *list) { tmp = l->next; - cogl_object_unref (l->data); + g_object_unref (l->data); g_list_free_1 (l); } } @@ -234,7 +234,7 @@ void _cogl_pipeline_snippet_list_add (CoglPipelineSnippetList *list, CoglSnippet *snippet) { - list->entries = g_list_append (list->entries, cogl_object_ref (snippet)); + list->entries = g_list_append (list->entries, g_object_ref (snippet)); _cogl_snippet_make_immutable (snippet); } @@ -247,7 +247,7 @@ _cogl_pipeline_snippet_list_copy (CoglPipelineSnippetList *dst, const GList *l; for (l = src->entries; l; l = l->next) - g_queue_push_tail (&queue, cogl_object_ref (l->data)); + g_queue_push_tail (&queue, g_object_ref (l->data)); dst->entries = queue.head; } diff --git a/cogl/cogl/cogl-pipeline-state.c b/cogl/cogl/cogl-pipeline-state.c index 900855080..4156213c8 100644 --- a/cogl/cogl/cogl-pipeline-state.c +++ b/cogl/cogl/cogl-pipeline-state.c @@ -1218,7 +1218,7 @@ cogl_pipeline_add_snippet (CoglPipeline *pipeline, CoglSnippet *snippet) { g_return_if_fail (cogl_is_pipeline (pipeline)); - g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (COGL_IS_SNIPPET (snippet)); g_return_if_fail (snippet->hook < COGL_SNIPPET_FIRST_LAYER_HOOK); if (snippet->hook < COGL_SNIPPET_FIRST_PIPELINE_FRAGMENT_HOOK) diff --git a/cogl/cogl/cogl-snippet-private.h b/cogl/cogl/cogl-snippet-private.h index fa6c842c6..ead730387 100644 --- a/cogl/cogl/cogl-snippet-private.h +++ b/cogl/cogl/cogl-snippet-private.h @@ -36,7 +36,6 @@ #include #include "cogl/cogl-snippet.h" -#include "cogl/cogl-object-private.h" /* These values are also used in the enum for CoglSnippetHook. They are copied here because we don't really want these names to be part @@ -54,7 +53,7 @@ struct _CoglSnippet { - CoglObject _parent; + GObject parent_instance; CoglSnippetHook hook; diff --git a/cogl/cogl/cogl-snippet.c b/cogl/cogl/cogl-snippet.c index 7b494cd61..47ddfc79d 100644 --- a/cogl/cogl/cogl-snippet.c +++ b/cogl/cogl/cogl-snippet.c @@ -36,22 +36,43 @@ #include "cogl/cogl-types.h" #include "cogl/cogl-snippet-private.h" #include "cogl/cogl-util.h" -#include "cogl/cogl-gtype-private.h" + +G_DEFINE_TYPE (CoglSnippet, cogl_snippet, G_TYPE_OBJECT); + static void -_cogl_snippet_free (CoglSnippet *snippet); +cogl_snippet_dispose (GObject *object) +{ + CoglSnippet *snippet = COGL_SNIPPET (object); + + g_free (snippet->declarations); + g_free (snippet->pre); + g_free (snippet->replace); + g_free (snippet->post); + + G_OBJECT_CLASS (cogl_snippet_parent_class)->dispose (object); +} + +static void +cogl_snippet_init (CoglSnippet *display) +{ +} + +static void +cogl_snippet_class_init (CoglSnippetClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + + object_class->dispose = cogl_snippet_dispose; +} -COGL_OBJECT_DEFINE (Snippet, snippet); -COGL_GTYPE_DEFINE_CLASS (Snippet, snippet); CoglSnippet * cogl_snippet_new (CoglSnippetHook hook, const char *declarations, const char *post) { - CoglSnippet *snippet = g_new0 (CoglSnippet, 1); - - _cogl_snippet_object_new (snippet); + CoglSnippet *snippet = g_object_new (COGL_TYPE_SNIPPET, NULL); snippet->hook = hook; @@ -64,7 +85,7 @@ cogl_snippet_new (CoglSnippetHook hook, CoglSnippetHook cogl_snippet_get_hook (CoglSnippet *snippet) { - g_return_val_if_fail (cogl_is_snippet (snippet), 0); + g_return_val_if_fail (COGL_IS_SNIPPET (snippet), 0); return snippet->hook; } @@ -88,7 +109,7 @@ void cogl_snippet_set_declarations (CoglSnippet *snippet, const char *declarations) { - g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (COGL_IS_SNIPPET (snippet)); if (!_cogl_snippet_modify (snippet)) return; @@ -100,7 +121,7 @@ cogl_snippet_set_declarations (CoglSnippet *snippet, const char * cogl_snippet_get_declarations (CoglSnippet *snippet) { - g_return_val_if_fail (cogl_is_snippet (snippet), NULL); + g_return_val_if_fail (COGL_IS_SNIPPET (snippet), NULL); return snippet->declarations; } @@ -109,7 +130,7 @@ void cogl_snippet_set_pre (CoglSnippet *snippet, const char *pre) { - g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (COGL_IS_SNIPPET (snippet)); if (!_cogl_snippet_modify (snippet)) return; @@ -121,7 +142,7 @@ cogl_snippet_set_pre (CoglSnippet *snippet, const char * cogl_snippet_get_pre (CoglSnippet *snippet) { - g_return_val_if_fail (cogl_is_snippet (snippet), NULL); + g_return_val_if_fail (COGL_IS_SNIPPET (snippet), NULL); return snippet->pre; } @@ -130,7 +151,7 @@ void cogl_snippet_set_replace (CoglSnippet *snippet, const char *replace) { - g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (COGL_IS_SNIPPET (snippet)); if (!_cogl_snippet_modify (snippet)) return; @@ -142,7 +163,7 @@ cogl_snippet_set_replace (CoglSnippet *snippet, const char * cogl_snippet_get_replace (CoglSnippet *snippet) { - g_return_val_if_fail (cogl_is_snippet (snippet), NULL); + g_return_val_if_fail (COGL_IS_SNIPPET (snippet), NULL); return snippet->replace; } @@ -151,7 +172,7 @@ void cogl_snippet_set_post (CoglSnippet *snippet, const char *post) { - g_return_if_fail (cogl_is_snippet (snippet)); + g_return_if_fail (COGL_IS_SNIPPET (snippet)); if (!_cogl_snippet_modify (snippet)) return; @@ -163,7 +184,7 @@ cogl_snippet_set_post (CoglSnippet *snippet, const char * cogl_snippet_get_post (CoglSnippet *snippet) { - g_return_val_if_fail (cogl_is_snippet (snippet), NULL); + g_return_val_if_fail (COGL_IS_SNIPPET (snippet), NULL); return snippet->post; } @@ -173,13 +194,3 @@ _cogl_snippet_make_immutable (CoglSnippet *snippet) { snippet->immutable = TRUE; } - -static void -_cogl_snippet_free (CoglSnippet *snippet) -{ - g_free (snippet->declarations); - g_free (snippet->pre); - g_free (snippet->replace); - g_free (snippet->post); - g_free (snippet); -} diff --git a/cogl/cogl/cogl-snippet.h b/cogl/cogl/cogl-snippet.h index 5bb512d09..cfeb4d1e9 100644 --- a/cogl/cogl/cogl-snippet.h +++ b/cogl/cogl/cogl-snippet.h @@ -40,8 +40,9 @@ G_BEGIN_DECLS /** - * SECTION:cogl-snippet - * @short_description: Functions for creating and manipulating shader snippets + * CoglSnippet: + * + * Functions for creating and manipulating shader snippets * * #CoglSnippets are used to modify or replace parts of a * #CoglPipeline using GLSL. GLSL is a programming language supported @@ -301,7 +302,7 @@ G_BEGIN_DECLS * Here is an example of using a snippet to add a desaturate effect to the * generated color on a pipeline. * - * + * ```c * CoglPipeline *pipeline = cogl_pipeline_new (); * * /* Set up the pipeline here, ie by adding a texture or other @@ -323,7 +324,7 @@ G_BEGIN_DECLS * cogl_pipeline_add_snippet (pipeline, snippet); * /* The pipeline keeps a reference to the snippet * so we don't need to */ - * cogl_object_unref (snippet); + * g_object_unref (snippet); * * /* Update the custom uniform on the pipeline */ * int location = cogl_pipeline_get_uniform_location (pipeline, "factor"); @@ -333,19 +334,18 @@ G_BEGIN_DECLS * cogl_push_source (pipeline); * cogl_rectangle (0, 0, 10, 10); * cogl_pop_source (); - * + * ``` */ typedef struct _CoglSnippet CoglSnippet; -#define COGL_SNIPPET(OBJECT) ((CoglSnippet *)OBJECT) +#define COGL_TYPE_SNIPPET (cogl_snippet_get_type ()) -/** - * cogl_snippet_get_gtype: - * - * Returns: a #GType that can be used with the GLib type system. - */ COGL_EXPORT -GType cogl_snippet_get_gtype (void); +G_DECLARE_FINAL_TYPE (CoglSnippet, + cogl_snippet, + COGL, + SNIPPET, + GObject) /* Enumeration of all the hook points that a snippet can be attached to within a pipeline. */ @@ -699,18 +699,6 @@ cogl_snippet_new (CoglSnippetHook hook, COGL_EXPORT CoglSnippetHook cogl_snippet_get_hook (CoglSnippet *snippet); -/** - * cogl_is_snippet: - * @object: A #CoglObject pointer - * - * Gets whether the given @object references an existing snippet object. - * - * Returns: %TRUE if the @object references a #CoglSnippet, - * %FALSE otherwise - */ -COGL_EXPORT gboolean -cogl_is_snippet (void *object); - /** * cogl_snippet_set_declarations: * @snippet: A #CoglSnippet diff --git a/src/compositor/meta-multi-texture-format.c b/src/compositor/meta-multi-texture-format.c index 9f338e584..6d8045de1 100644 --- a/src/compositor/meta-multi-texture-format.c +++ b/src/compositor/meta-multi-texture-format.c @@ -249,7 +249,7 @@ meta_multi_texture_format_get_snippets (MetaMultiTextureFormat format, CoglSnippet *globals_snippet; globals_snippet = g_once (&globals_once, create_globals_snippet, NULL); - *fragment_globals_snippet = cogl_object_ref (globals_snippet); + *fragment_globals_snippet = g_object_ref (globals_snippet); } if (fragment_snippet) @@ -259,7 +259,7 @@ meta_multi_texture_format_get_snippets (MetaMultiTextureFormat format, format_snippet = g_once (&multi_format_table[format].snippet_once, create_format_snippet, GINT_TO_POINTER (format)); - *fragment_snippet = cogl_object_ref (format_snippet); + *fragment_snippet = g_object_ref (format_snippet); } return TRUE; diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 974e70b16..94cc60622 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -251,7 +251,7 @@ meta_shaped_texture_dispose (GObject *object) g_clear_pointer (&stex->opaque_region, cairo_region_destroy); g_clear_pointer (&stex->clip_region, cairo_region_destroy); - g_clear_pointer (&stex->snippet, cogl_object_unref); + g_clear_pointer (&stex->snippet, g_object_unref); G_OBJECT_CLASS (meta_shaped_texture_parent_class)->dispose (object); } @@ -364,8 +364,8 @@ get_combined_pipeline (MetaShapedTexture *stex, cogl_pipeline_add_snippet (pipeline, fragment_globals_snippet); cogl_pipeline_add_snippet (pipeline, fragment_snippet); - cogl_clear_object (&fragment_globals_snippet); - cogl_clear_object (&fragment_snippet); + g_clear_object (&fragment_globals_snippet); + g_clear_object (&fragment_snippet); stex->combined_pipeline = pipeline; @@ -1159,9 +1159,9 @@ meta_shaped_texture_set_snippet (MetaShapedTexture *stex, meta_shaped_texture_reset_pipelines (stex); - g_clear_pointer (&stex->snippet, cogl_object_unref); + g_clear_pointer (&stex->snippet, g_object_unref); if (snippet) - stex->snippet = cogl_object_ref (snippet); + stex->snippet = g_object_ref (snippet); } /** diff --git a/src/compositor/meta-texture-mipmap.c b/src/compositor/meta-texture-mipmap.c index e3a127cd2..dfac02f18 100644 --- a/src/compositor/meta-texture-mipmap.c +++ b/src/compositor/meta-texture-mipmap.c @@ -232,8 +232,8 @@ ensure_mipmap_texture (MetaTextureMipmap *mipmap) cogl_pipeline_add_snippet (mipmap->pipeline, fragment_globals_snippet); cogl_pipeline_add_snippet (mipmap->pipeline, fragment_snippet); - cogl_clear_object (&fragment_globals_snippet); - cogl_clear_object (&fragment_snippet); + g_clear_object (&fragment_globals_snippet); + g_clear_object (&fragment_snippet); } for (i = 0; i < n_planes; i++) diff --git a/src/tests/cogl/conform/test-custom-attributes.c b/src/tests/cogl/conform/test-custom-attributes.c index 0dd32288d..f25a816a8 100644 --- a/src/tests/cogl/conform/test-custom-attributes.c +++ b/src/tests/cogl/conform/test-custom-attributes.c @@ -294,7 +294,7 @@ test_custom_attributes (void) paint (&state); cogl_object_unref (state.pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); if (cogl_test_verbose ()) g_print ("OK\n"); diff --git a/src/tests/cogl/conform/test-pipeline-shader-state.c b/src/tests/cogl/conform/test-pipeline-shader-state.c index c4cfe6fde..a639bf882 100644 --- a/src/tests/cogl/conform/test-pipeline-shader-state.c +++ b/src/tests/cogl/conform/test-pipeline-shader-state.c @@ -47,7 +47,7 @@ test_pipeline_shader_state (void) NULL, /* declarations */ "cogl_color_out = vec4 (0.0, 1.0, 0.1, 1.1);"); cogl_pipeline_add_snippet (draw_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, draw_pipeline, 0, 0, width, height); @@ -80,7 +80,7 @@ test_pipeline_shader_state (void) NULL, /* declarations */ "cogl_color_out = vec4 (0.0, 0.0, 1.1, 1.1);"); cogl_pipeline_add_snippet (draw_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, draw_pipeline, 0, 0, width, height); diff --git a/src/tests/cogl/conform/test-point-size-attribute.c b/src/tests/cogl/conform/test-point-size-attribute.c index c177bce62..457432e5c 100644 --- a/src/tests/cogl/conform/test-point-size-attribute.c +++ b/src/tests/cogl/conform/test-point-size-attribute.c @@ -157,7 +157,7 @@ setup_snippet (CoglPipeline *pipeline) "cogl_point_size_out = " "my_super_duper_point_size_attrib;\n"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); } static void diff --git a/src/tests/cogl/conform/test-point-sprite-known-failure.c b/src/tests/cogl/conform/test-point-sprite-known-failure.c index 39cb2ad08..efc4baca4 100644 --- a/src/tests/cogl/conform/test-point-sprite-known-failure.c +++ b/src/tests/cogl/conform/test-point-sprite-known-failure.c @@ -87,7 +87,7 @@ do_test (gboolean check_orientation, cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); } else { diff --git a/src/tests/cogl/conform/test-point-sprite.c b/src/tests/cogl/conform/test-point-sprite.c index 071d3e6f9..6b6f459e8 100644 --- a/src/tests/cogl/conform/test-point-sprite.c +++ b/src/tests/cogl/conform/test-point-sprite.c @@ -87,7 +87,7 @@ do_test (gboolean check_orientation, cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); } else { diff --git a/src/tests/cogl/conform/test-snippets.c b/src/tests/cogl/conform/test-snippets.c index 7c13ba5b2..8dceccc95 100644 --- a/src/tests/cogl/conform/test-snippets.c +++ b/src/tests/cogl/conform/test-snippets.c @@ -57,7 +57,7 @@ simple_fragment_snippet (TestState *state) NULL, /* declarations */ "cogl_color_out.g += 1.0;"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); @@ -81,7 +81,7 @@ simple_vertex_snippet (TestState *state) NULL, "cogl_color_out.b += 1.0;"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, 10, 0, 20, 10); @@ -110,12 +110,12 @@ shared_uniform (TestState *state) "uniform float a_value;", "cogl_color_out.b += a_value;"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, "uniform float a_value;", "cogl_color_out.b += a_value;"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, @@ -156,7 +156,7 @@ lots_snippets (TestState *state) declarations, code); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); g_free (code); g_free (uniform_name); @@ -187,7 +187,7 @@ shared_variable_pre_post (TestState *state) "cogl_color_out = redvec;"); cogl_snippet_set_pre (snippet, "vec4 redvec = vec4 (1.0, 0.0, 0.0, 1.0);"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, 40, 0, 50, 10); @@ -224,7 +224,7 @@ test_pipeline_caching (TestState *state) cogl_framebuffer_draw_rectangle (test_fb, pipeline, 60, 0, 70, 10); cogl_object_unref (pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); test_utils_check_pixel (test_fb, 55, 5, 0x00ff00ff); test_utils_check_pixel (test_fb, 65, 5, 0x00ff00ff); @@ -252,7 +252,7 @@ test_replace_string (TestState *state) cogl_framebuffer_draw_rectangle (test_fb, pipeline, 70, 0, 80, 10); cogl_object_unref (pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); test_utils_check_pixel (test_fb, 75, 5, 0x808000ff); } @@ -279,7 +279,7 @@ test_texture_lookup_hook (TestState *state) 0, 0, 0, 0); cogl_object_unref (pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); test_utils_check_pixel (test_fb, 85, 5, 0x00ffffff); } @@ -305,7 +305,7 @@ test_multiple_samples (TestState *state) cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); cogl_object_unref (pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); test_utils_check_pixel (test_fb, 5, 5, 0xffff00ff); } @@ -328,7 +328,7 @@ test_replace_lookup_hook (TestState *state) 0, 0, 0, 0); cogl_object_unref (pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); test_utils_check_pixel (test_fb, 95, 5, 0x0000ffff); } @@ -346,14 +346,14 @@ test_replace_snippet (TestState *state) NULL, "cogl_color_out = vec4 (0.5, 0.5, 0.5, 1.0);"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, NULL); cogl_snippet_set_pre (snippet, "cogl_color_out = vec4 (1.0, 1.0, 1.0, 1.0);"); cogl_snippet_set_replace (snippet, "cogl_color_out *= vec4 (1.0, 0.0, 0.0, 1.0);"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline, @@ -376,7 +376,7 @@ test_replace_fragment_layer (TestState *state) snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_LAYER_FRAGMENT, NULL, NULL); cogl_snippet_set_replace (snippet, "cogl_layer = vec4 (0.0, 0.0, 1.0, 1.0);"); cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); /* Add a second layer which samples from the texture in the first layer. The snippet override should cause the first layer not to @@ -414,7 +414,7 @@ test_modify_fragment_layer (TestState *state) "uniform float a_value;", "cogl_layer.g = a_value;"); cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline, @@ -443,7 +443,7 @@ test_modify_vertex_layer (TestState *state) NULL, "cogl_tex_coord.x = 1.0;"); cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline, @@ -473,7 +473,7 @@ test_replace_vertex_layer (TestState *state) NULL); cogl_snippet_set_replace (snippet, "cogl_tex_coord.x = 1.0;\n"); cogl_pipeline_add_layer_snippet (pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_textured_rectangle (test_fb, pipeline, @@ -508,7 +508,7 @@ test_vertex_transform_hook (TestState *state) cogl_snippet_set_replace (snippet, "cogl_position_out = " "pmat * cogl_position_in;"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); /* Copy the current projection matrix to a uniform */ cogl_framebuffer_get_projection_matrix (test_fb, &matrix); @@ -564,7 +564,7 @@ test_global_vertex_hook (TestState *state) "This string shouldn't be used so " "we can safely put garbage in here."); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX, NULL, /* declarations */ @@ -574,7 +574,7 @@ test_global_vertex_hook (TestState *state) "cogl_color_out.gba = vec3 (0.0, 0.0, 1.0);\n" "cogl_position_out = cogl_position_in;\n"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, @@ -617,7 +617,7 @@ test_global_fragment_hook (TestState *state) "This string shouldn't be used so " "we can safely put garbage in here."); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, /* declarations */ @@ -626,7 +626,7 @@ test_global_fragment_hook (TestState *state) "cogl_color_out.r = multiply_by_four (0.25);\n" "cogl_color_out.gba = vec3 (0.0, 0.0, 1.0);\n"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, @@ -660,14 +660,14 @@ test_snippet_order (TestState *state) cogl_snippet_set_pre (snippet, "cogl_color_out.r = 0.5;\n"); cogl_snippet_set_replace (snippet, "cogl_color_out.ba = vec2 (0.0, 1.0);"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT, NULL, "cogl_color_out.g = 1.0;\n"); cogl_snippet_set_pre (snippet, "cogl_color_out.r = 1.0;\n"); cogl_pipeline_add_snippet (pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_framebuffer_draw_rectangle (test_fb, pipeline, 160, 0, 170, 10); cogl_object_unref (pipeline); @@ -706,7 +706,7 @@ test_naming_texture_units (TestState *state) cogl_framebuffer_draw_rectangle (test_fb, pipeline, 0, 0, 10, 10); cogl_object_unref (pipeline); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_object_unref (tex1); cogl_object_unref (tex2); diff --git a/src/tests/cogl/unit/test-pipeline-cache.c b/src/tests/cogl/unit/test-pipeline-cache.c index 36b40f9ba..01e02be0c 100644 --- a/src/tests/cogl/unit/test-pipeline-cache.c +++ b/src/tests/cogl/unit/test-pipeline-cache.c @@ -27,7 +27,7 @@ create_pipelines (CoglPipeline **pipelines, pipelines[i] = cogl_pipeline_new (test_ctx); cogl_pipeline_add_snippet (pipelines[i], snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); } /* Test that drawing with them works. This should create the entries diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c index 34fd83ec3..df03748ea 100644 --- a/src/wayland/meta-wayland-actor-surface.c +++ b/src/wayland/meta-wayland-actor-surface.c @@ -200,7 +200,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor meta_shaped_texture_set_snippet (stex, snippet); meta_shaped_texture_set_is_y_inverted (stex, is_y_inverted); meta_shaped_texture_set_buffer_scale (stex, surface->scale); - cogl_clear_object (&snippet); + g_clear_object (&snippet); } else { diff --git a/src/wayland/meta-wayland-egl-stream.c b/src/wayland/meta-wayland-egl-stream.c index 7ffa9bd2a..36d977888 100644 --- a/src/wayland/meta-wayland-egl-stream.c +++ b/src/wayland/meta-wayland-egl-stream.c @@ -316,7 +316,7 @@ meta_wayland_egl_stream_create_snippet (MetaWaylandEglStream *stream) stream->snippet = snippet; } - return cogl_object_ref (stream->snippet); + return g_object_ref (stream->snippet); } gboolean @@ -361,7 +361,7 @@ meta_wayland_egl_stream_finalize (GObject *object) meta_egl_destroy_stream (egl, egl_display, stream->egl_stream, NULL); - cogl_clear_object (&stream->snippet); + g_clear_object (&stream->snippet); G_OBJECT_CLASS (meta_wayland_egl_stream_parent_class)->finalize (object); }