diff --git a/src/shell-blur-effect.c b/src/shell-blur-effect.c index a9ac9d37f..4f2acc4b9 100644 --- a/src/shell-blur-effect.c +++ b/src/shell-blur-effect.c @@ -138,7 +138,7 @@ create_brightness_pipeline (void) brightness_glsl_declarations, brightness_glsl); cogl_pipeline_add_snippet (brightness_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); } return cogl_pipeline_copy (brightness_pipeline); @@ -188,7 +188,7 @@ update_fbo (FramebufferData *data, CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); - g_clear_pointer (&data->texture, cogl_object_unref); + g_clear_object (&data->texture); g_clear_object (&data->framebuffer); float new_width = floorf (width / downscale_factor); @@ -269,7 +269,7 @@ update_background_fbo (ShellBlurEffect *self, static void clear_framebuffer_data (FramebufferData *fb_data) { - g_clear_pointer (&fb_data->texture, cogl_object_unref); + g_clear_object (&fb_data->texture); g_clear_object (&fb_data->framebuffer); } @@ -697,9 +697,9 @@ shell_blur_effect_finalize (GObject *object) clear_framebuffer_data (&self->background_fb); clear_framebuffer_data (&self->brightness_fb); - g_clear_pointer (&self->actor_fb.pipeline, cogl_object_unref); - g_clear_pointer (&self->background_fb.pipeline, cogl_object_unref); - g_clear_pointer (&self->brightness_fb.pipeline, cogl_object_unref); + g_clear_object (&self->actor_fb.pipeline); + g_clear_object (&self->background_fb.pipeline); + g_clear_object (&self->brightness_fb.pipeline); G_OBJECT_CLASS (shell_blur_effect_parent_class)->finalize (object); } diff --git a/src/shell-glsl-effect.c b/src/shell-glsl-effect.c index 6eb6e4278..7c0bcfa22 100644 --- a/src/shell-glsl-effect.c +++ b/src/shell-glsl-effect.c @@ -31,7 +31,7 @@ shell_glsl_effect_create_pipeline (ClutterOffscreenEffect *effect, cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture); - return cogl_object_ref (priv->pipeline); + return g_object_ref (priv->pipeline); } /** @@ -76,7 +76,7 @@ shell_glsl_effect_add_glsl_snippet (ShellGLSLEffect *effect, else cogl_pipeline_add_layer_snippet (klass->base_pipeline, 0, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); } static void @@ -87,7 +87,7 @@ shell_glsl_effect_dispose (GObject *gobject) priv = shell_glsl_effect_get_instance_private (self); - g_clear_pointer (&priv->pipeline, cogl_object_unref); + g_clear_object (&priv->pipeline); G_OBJECT_CLASS (shell_glsl_effect_parent_class)->dispose (gobject); } diff --git a/src/shell-invert-lightness-effect.c b/src/shell-invert-lightness-effect.c index f856ede61..897973293 100644 --- a/src/shell-invert-lightness-effect.c +++ b/src/shell-invert-lightness-effect.c @@ -80,7 +80,7 @@ shell_glsl_effect_create_pipeline (ClutterOffscreenEffect *effect, cogl_pipeline_set_layer_texture (self->pipeline, 0, texture); - return cogl_object_ref (self->pipeline); + return g_object_ref (self->pipeline); } static void @@ -88,11 +88,7 @@ shell_invert_lightness_effect_dispose (GObject *gobject) { ShellInvertLightnessEffect *self = SHELL_INVERT_LIGHTNESS_EFFECT (gobject); - if (self->pipeline != NULL) - { - cogl_object_unref (self->pipeline); - self->pipeline = NULL; - } + g_clear_object (&self->pipeline); G_OBJECT_CLASS (shell_invert_lightness_effect_parent_class)->dispose (gobject); } @@ -128,7 +124,7 @@ shell_invert_lightness_effect_init (ShellInvertLightnessEffect *self) NULL); cogl_snippet_set_replace (snippet, invert_lightness_source); 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/src/shell-screenshot.c b/src/shell-screenshot.c index 4c47eb076..2c384fcf6 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -525,7 +525,7 @@ grab_screenshot_content (ShellScreenshot *screenshot, unsigned int width, height; CoglContext *ctx; CoglPipeline *pipeline; - CoglTexture2D *texture; + CoglTexture *texture; CoglOffscreen *offscreen; ClutterStageView *view; @@ -548,12 +548,12 @@ grab_screenshot_content (ShellScreenshot *screenshot, pipeline, -1, 1, 1, -1, 0, 0, 1, 1); - cogl_object_unref (pipeline); + g_object_unref (pipeline); g_object_unref (offscreen); priv->cursor_content = clutter_texture_content_new_from_texture (texture, NULL); - cogl_object_unref (texture); + g_object_unref (texture); priv->cursor_scale = meta_cursor_tracker_get_scale (tracker); @@ -1313,7 +1313,7 @@ shell_screenshot_composite_to_stream (CoglTexture *texture, cairo_image_surface_get_data (surface)); cairo_surface_mark_dirty (surface); - cogl_object_unref (sub_texture); + g_object_unref (sub_texture); cairo_surface_set_device_scale (surface, scale, scale); diff --git a/src/st/st-entry.c b/src/st/st-entry.c index 0de195ebc..52fbdb7e2 100644 --- a/src/st/st-entry.c +++ b/src/st/st-entry.c @@ -216,7 +216,7 @@ st_entry_dispose (GObject *object) StEntry *entry = ST_ENTRY (object); StEntryPrivate *priv = ST_ENTRY_PRIV (entry); - cogl_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_material); G_OBJECT_CLASS (st_entry_parent_class)->dispose (object); } @@ -254,7 +254,7 @@ st_entry_style_changed (StWidget *self) if (!priv->shadow_spec || !shadow_spec || !st_shadow_equal (shadow_spec, priv->shadow_spec)) { - g_clear_pointer (&priv->text_shadow_material, cogl_object_unref); + g_clear_object (&priv->text_shadow_material); g_clear_pointer (&priv->shadow_spec, st_shadow_unref); if (shadow_spec) @@ -555,7 +555,7 @@ clutter_text_cursor_changed (ClutterText *text, st_entry_update_hint_visibility (entry); - g_clear_pointer (&priv->text_shadow_material, cogl_object_unref); + g_clear_object (&priv->text_shadow_material); } static void @@ -569,7 +569,7 @@ clutter_text_changed_cb (GObject *object, st_entry_update_hint_visibility (entry); /* Since the text changed, force a regen of the shadow texture */ - cogl_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_material); g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_TEXT]); } @@ -581,7 +581,7 @@ invalidate_shadow_pipeline (GObject *object, { StEntryPrivate *priv = ST_ENTRY_PRIV (entry); - g_clear_pointer (&priv->text_shadow_material, cogl_object_unref); + g_clear_object (&priv->text_shadow_material); } static void @@ -839,7 +839,7 @@ st_entry_paint (ClutterActor *actor, { CoglPipeline *material; - cogl_clear_object (&priv->text_shadow_material); + g_clear_object (&priv->text_shadow_material); material = _st_create_shadow_pipeline_from_actor (priv->shadow_spec, priv->entry); diff --git a/src/st/st-icon.c b/src/st/st-icon.c index 4f23090d0..aed688e07 100644 --- a/src/st/st-icon.c +++ b/src/st/st-icon.c @@ -173,7 +173,7 @@ st_icon_dispose (GObject *gobject) g_clear_object (&priv->gicon); g_clear_object (&priv->fallback_gicon); g_clear_pointer (&priv->colors, st_icon_colors_unref); - g_clear_pointer (&priv->shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->shadow_pipeline); g_clear_pointer (&priv->shadow_spec, st_shadow_unref); G_OBJECT_CLASS (st_icon_parent_class)->dispose (gobject); @@ -377,7 +377,7 @@ st_icon_clear_shadow_pipeline (StIcon *icon) { StIconPrivate *priv = icon->priv; - g_clear_pointer (&priv->shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->shadow_pipeline); graphene_size_init (&priv->shadow_size, 0, 0); } diff --git a/src/st/st-label.c b/src/st/st-label.c index fe77743c4..71cadb58d 100644 --- a/src/st/st-label.c +++ b/src/st/st-label.c @@ -130,7 +130,7 @@ st_label_style_changed (StWidget *self) if (!priv->shadow_spec || !shadow_spec || !st_shadow_equal (shadow_spec, priv->shadow_spec)) { - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->text_shadow_pipeline); g_clear_pointer (&priv->shadow_spec, st_shadow_unref); if (shadow_spec) @@ -199,7 +199,7 @@ st_label_dispose (GObject *object) StLabelPrivate *priv = ST_LABEL (object)->priv; priv->label = NULL; - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->text_shadow_pipeline); G_OBJECT_CLASS (st_label_parent_class)->dispose (object); } @@ -230,7 +230,7 @@ st_label_paint (ClutterActor *actor, width != priv->shadow_width || height != priv->shadow_height) { - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->text_shadow_pipeline); priv->shadow_width = width; priv->shadow_height = height; @@ -261,7 +261,7 @@ st_label_resource_scale_changed (ClutterActor *actor) { StLabelPrivate *priv = ST_LABEL (actor)->priv; - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->text_shadow_pipeline); if (CLUTTER_ACTOR_CLASS (st_label_parent_class)->resource_scale_changed) CLUTTER_ACTOR_CLASS (st_label_parent_class)->resource_scale_changed (actor); @@ -321,7 +321,7 @@ invalidate_shadow_pipeline (GObject *object, { StLabelPrivate *priv = st_label_get_instance_private (label); - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->text_shadow_pipeline); } static void @@ -416,7 +416,7 @@ st_label_set_text (StLabel *label, if (clutter_text_get_editable (ctext) || g_strcmp0 (clutter_text_get_text (ctext), text) != 0) { - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + g_clear_object (&priv->text_shadow_pipeline); clutter_text_set_text (ctext, text); diff --git a/src/st/st-private.c b/src/st/st-private.c index bb981516d..50a22f28d 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -420,7 +420,7 @@ _st_create_shadow_pipeline (StShadow *shadow_spec, fb = COGL_FRAMEBUFFER (offscreen); if (!cogl_framebuffer_allocate (fb, &error)) { - cogl_clear_object (&texture); + g_clear_object (&texture); return NULL; } @@ -450,7 +450,7 @@ _st_create_shadow_pipeline (StShadow *shadow_spec, texture_pipeline = cogl_pipeline_new (ctx); cogl_pipeline_add_snippet (texture_pipeline, snippet); - cogl_object_unref (snippet); + g_object_unref (snippet); cogl_context_set_named_pipeline (ctx, &texture_pipeline_key, @@ -493,7 +493,7 @@ _st_create_shadow_pipeline (StShadow *shadow_spec, pipeline = cogl_pipeline_copy (shadow_pipeline_template); cogl_pipeline_set_layer_texture (pipeline, 0, texture); - cogl_clear_object (&texture); + g_clear_object (&texture); return pipeline; } @@ -535,7 +535,7 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec, if (shadow_pipeline == NULL) { - CoglTexture *buffer; + g_autoptr(CoglTexture) buffer = NULL; CoglOffscreen *offscreen; CoglFramebuffer *fb; CoglContext *ctx; @@ -556,7 +556,6 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec, { g_error_free (catch_error); g_object_unref (offscreen); - cogl_object_unref (buffer); return NULL; } @@ -582,10 +581,9 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec, g_object_unref (fb); - shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, buffer, + shadow_pipeline = _st_create_shadow_pipeline (shadow_spec, + g_steal_pointer (&buffer), resource_scale); - - cogl_object_unref (buffer); } return shadow_pipeline; diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c index 77b1d0b12..440b712e7 100644 --- a/src/st/st-scroll-view-fade.c +++ b/src/st/st-scroll-view-fade.c @@ -74,7 +74,7 @@ st_scroll_view_fade_create_texture (ClutterOffscreenEffect *effect, CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ()); - return COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, min_width, min_height)); + return cogl_texture_2d_new_with_size (ctx, min_width, min_height); } static char * diff --git a/src/st/st-shadow.c b/src/st/st-shadow.c index 97edbe90c..a5a0a85d0 100644 --- a/src/st/st-shadow.c +++ b/src/st/st-shadow.c @@ -234,7 +234,7 @@ st_shadow_helper_update (StShadowHelper *helper, helper->height != height) { if (helper->pipeline) - cogl_object_unref (helper->pipeline); + g_object_unref (helper->pipeline); helper->pipeline = _st_create_shadow_pipeline_from_actor (helper->shadow, source); helper->width = width; @@ -256,7 +256,7 @@ st_shadow_helper_copy (StShadowHelper *helper) copy = g_new (StShadowHelper, 1); *copy = *helper; if (copy->pipeline) - cogl_object_ref (copy->pipeline); + g_object_ref (copy->pipeline); st_shadow_ref (copy->shadow); return copy; @@ -272,7 +272,7 @@ void st_shadow_helper_free (StShadowHelper *helper) { if (helper->pipeline) - cogl_object_unref (helper->pipeline); + g_object_unref (helper->pipeline); st_shadow_unref (helper->shadow); g_free (helper); diff --git a/src/st/st-texture-cache.c b/src/st/st-texture-cache.c index 7037c07d1..2986f5bb3 100644 --- a/src/st/st-texture-cache.c +++ b/src/st/st-texture-cache.c @@ -978,7 +978,7 @@ st_texture_cache_load (StTextureCache *cache, } if (texture && policy == ST_TEXTURE_CACHE_POLICY_FOREVER) - cogl_object_ref (texture); + g_object_ref (texture); return texture; } @@ -1604,7 +1604,7 @@ st_texture_cache_load_file_sync_to_cogl_texture (StTextureCache *cache, * clutter_image_set_data(), so it's safe to use the texture * of ClutterImage here. */ texdata = clutter_image_get_texture (CLUTTER_IMAGE (image)); - cogl_object_ref (texdata); + g_object_ref (texdata); ensure_monitor_for_file (cache, file); diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c index 13a6d93c3..ceb4c64fc 100644 --- a/src/st/st-theme-node-drawing.c +++ b/src/st/st-theme-node-drawing.c @@ -180,11 +180,11 @@ create_corner_material (StCornerSpec *corner) cairo_surface_destroy (surface); - texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, size, size, - COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, - rowstride, - data, - &error)); + texture = cogl_texture_2d_new_from_data (ctx, size, size, + COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, + rowstride, + data, + &error); if (error) { @@ -427,7 +427,7 @@ st_theme_node_lookup_corner (StThemeNode *node, if (texture) { material = _st_create_texture_pipeline (texture); - cogl_object_unref (texture); + g_object_unref (texture); } g_free (key); @@ -1341,13 +1341,13 @@ st_theme_node_prerender_background (StThemeNode *node, if (interior_path != NULL) cairo_path_destroy (interior_path); - texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, - texture_width, - texture_height, - COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, - rowstride, - data, - &error)); + texture = cogl_texture_2d_new_from_data (ctx, + texture_width, + texture_height, + COGL_PIXEL_FORMAT_CAIRO_ARGB32_COMPAT, + rowstride, + data, + &error); if (error) { @@ -1371,8 +1371,8 @@ static void st_theme_node_paint_borders (StThemeNodePaintState *state, void st_theme_node_invalidate_border_image (StThemeNode *node) { - cogl_clear_object (&node->border_slices_texture); - cogl_clear_object (&node->border_slices_pipeline); + g_clear_object (&node->border_slices_texture); + g_clear_object (&node->border_slices_pipeline); } static gboolean @@ -1407,9 +1407,9 @@ st_theme_node_load_border_image (StThemeNode *node, void st_theme_node_invalidate_background_image (StThemeNode *node) { - cogl_clear_object (&node->background_texture); - cogl_clear_object (&node->background_pipeline); - cogl_clear_object (&node->background_shadow_pipeline); + g_clear_object (&node->background_texture); + g_clear_object (&node->background_pipeline); + g_clear_object (&node->background_shadow_pipeline); } static gboolean @@ -1624,16 +1624,16 @@ st_theme_node_update_resources (StThemeNodePaintState *state, /* Free handles we can't reuse */ had_prerendered_texture = (state->prerendered_texture != NULL); - cogl_clear_object (&state->prerendered_texture); + g_clear_object (&state->prerendered_texture); if (state->prerendered_pipeline != NULL) { - cogl_clear_object (&state->prerendered_pipeline); + g_clear_object (&state->prerendered_pipeline); if (node->border_slices_texture == NULL && state->box_shadow_pipeline != NULL) { - cogl_clear_object (&state->box_shadow_pipeline); + g_clear_object (&state->box_shadow_pipeline); had_box_shadow = TRUE; } } @@ -2317,7 +2317,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state) /* Render offscreen */ fb_width = ceilf (state->box_shadow_width * state->resource_scale); fb_height = ceilf (state->box_shadow_height * state->resource_scale); - buffer = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, fb_width, fb_height)); + buffer = cogl_texture_2d_new_with_size (ctx, fb_width, fb_height); if (buffer == NULL) return; @@ -2343,7 +2343,7 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state) g_clear_error (&error); g_clear_object (&offscreen); - cogl_clear_object (&buffer); + g_clear_object (&buffer); } static void @@ -2754,12 +2754,12 @@ st_theme_node_paint_state_node_free_internal (StThemeNodePaintState *state, { int corner_id; - cogl_clear_object (&state->prerendered_texture); - cogl_clear_object (&state->prerendered_pipeline); - cogl_clear_object (&state->box_shadow_pipeline); + g_clear_object (&state->prerendered_texture); + g_clear_object (&state->prerendered_pipeline); + g_clear_object (&state->box_shadow_pipeline); for (corner_id = 0; corner_id < 4; corner_id++) - cogl_clear_object (&state->corner_material[corner_id]); + g_clear_object (&state->corner_material[corner_id]); if (unref_node) st_theme_node_paint_state_set_node (state, NULL); @@ -2831,14 +2831,14 @@ st_theme_node_paint_state_copy (StThemeNodePaintState *state, state->box_shadow_height = other->box_shadow_height; if (other->box_shadow_pipeline) - state->box_shadow_pipeline = cogl_object_ref (other->box_shadow_pipeline); + state->box_shadow_pipeline = g_object_ref (other->box_shadow_pipeline); if (other->prerendered_texture) - state->prerendered_texture = cogl_object_ref (other->prerendered_texture); + state->prerendered_texture = g_object_ref (other->prerendered_texture); if (other->prerendered_pipeline) - state->prerendered_pipeline = cogl_object_ref (other->prerendered_pipeline); + state->prerendered_pipeline = g_object_ref (other->prerendered_pipeline); for (corner_id = 0; corner_id < 4; corner_id++) if (other->corner_material[corner_id]) - state->corner_material[corner_id] = cogl_object_ref (other->corner_material[corner_id]); + state->corner_material[corner_id] = g_object_ref (other->corner_material[corner_id]); } void diff --git a/src/st/st-theme-node-transition.c b/src/st/st-theme-node-transition.c index 20b1476d2..0fab79617 100644 --- a/src/st/st-theme-node-transition.c +++ b/src/st/st-theme-node-transition.c @@ -262,11 +262,11 @@ setup_framebuffers (StThemeNodeTransition *transition, g_return_val_if_fail (width > 0, FALSE); g_return_val_if_fail (height > 0, FALSE); - cogl_clear_object (&priv->old_texture); - priv->old_texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height)); + g_clear_object (&priv->old_texture); + priv->old_texture = cogl_texture_2d_new_with_size (ctx, width, height); - cogl_clear_object (&priv->new_texture); - priv->new_texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height)); + g_clear_object (&priv->new_texture); + priv->new_texture = cogl_texture_2d_new_with_size (ctx, width, height); if (priv->old_texture == NULL) return FALSE; @@ -402,13 +402,13 @@ st_theme_node_transition_dispose (GObject *object) g_clear_object (&priv->old_theme_node); g_clear_object (&priv->new_theme_node); - cogl_clear_object (&priv->old_texture); - cogl_clear_object (&priv->new_texture); + g_clear_object (&priv->old_texture); + g_clear_object (&priv->new_texture); g_clear_object (&priv->old_offscreen); g_clear_object (&priv->new_offscreen); - cogl_clear_object (&priv->material); + g_clear_object (&priv->material); if (priv->timeline) { diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c index 6e09c3939..51e6d2174 100644 --- a/src/st/st-theme-node.c +++ b/src/st/st-theme-node.c @@ -127,12 +127,12 @@ st_theme_node_finalize (GObject *object) g_clear_object (&node->background_image); - cogl_clear_object (&node->background_texture); - cogl_clear_object (&node->background_pipeline); - cogl_clear_object (&node->background_shadow_pipeline); - cogl_clear_object (&node->border_slices_texture); - cogl_clear_object (&node->border_slices_pipeline); - cogl_clear_object (&node->color_pipeline); + g_clear_object (&node->background_texture); + g_clear_object (&node->background_pipeline); + g_clear_object (&node->background_shadow_pipeline); + g_clear_object (&node->border_slices_texture); + g_clear_object (&node->border_slices_pipeline); + g_clear_object (&node->color_pipeline); G_OBJECT_CLASS (st_theme_node_parent_class)->finalize (object); }