[mutter] clutter: Stop using cogl_offscreen_new_to_texture()
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] clutter: Stop using cogl_offscreen_new_to_texture()
- Date: Fri, 16 Oct 2020 16:25:59 +0000 (UTC)
commit b947dced40f8c6c6813c7c356aae28da43423298
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Oct 13 09:31:28 2020 +0200
clutter: Stop using cogl_offscreen_new_to_texture()
It's deprecated, drops errors silently, so change to the proper
function.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1496
clutter/clutter/clutter-offscreen-effect.c | 12 +++++++++---
clutter/clutter/clutter-paint-nodes.c | 12 +++++++++---
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/clutter/clutter/clutter-offscreen-effect.c b/clutter/clutter/clutter-offscreen-effect.c
index 2dae9039ae..af02460349 100644
--- a/clutter/clutter/clutter-offscreen-effect.c
+++ b/clutter/clutter/clutter-offscreen-effect.c
@@ -173,6 +173,8 @@ update_fbo (ClutterEffect *effect,
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
ClutterOffscreenEffectPrivate *priv = self->priv;
ClutterActor *stage_actor;
+ CoglOffscreen *offscreen;
+ g_autoptr (GError) error = NULL;
stage_actor = clutter_actor_get_stage (priv->actor);
if (stage_actor != priv->stage)
@@ -231,11 +233,13 @@ update_fbo (ClutterEffect *effect,
priv->target_width = target_width;
priv->target_height = target_height;
- priv->offscreen = cogl_offscreen_new_to_texture (priv->texture);
- if (priv->offscreen == NULL)
+ offscreen = cogl_offscreen_new_with_texture (priv->texture);
+ if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (offscreen), &error))
{
- g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
+ g_warning ("Failed to create offscreen effect framebuffer: %s",
+ error->message);
+ cogl_object_unref (offscreen);
cogl_object_unref (priv->pipeline);
priv->pipeline = NULL;
@@ -245,6 +249,8 @@ update_fbo (ClutterEffect *effect,
return FALSE;
}
+ priv->offscreen = offscreen;
+
return TRUE;
}
diff --git a/clutter/clutter/clutter-paint-nodes.c b/clutter/clutter/clutter-paint-nodes.c
index de2f3fdcc6..d44e1a8ab0 100644
--- a/clutter/clutter/clutter-paint-nodes.c
+++ b/clutter/clutter/clutter-paint-nodes.c
@@ -1415,6 +1415,8 @@ clutter_layer_node_new (const graphene_matrix_t *projection,
CoglTexture2D *tex_2d;
CoglTexture *texture;
CoglColor color;
+ CoglOffscreen *offscreen;
+ g_autoptr (GError) error = NULL;
res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE);
@@ -1433,13 +1435,17 @@ clutter_layer_node_new (const graphene_matrix_t *projection,
texture = COGL_TEXTURE (tex_2d);
cogl_texture_set_premultiplied (texture, TRUE);
- res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (texture));
- if (res->offscreen == NULL)
+ offscreen = cogl_offscreen_new_with_texture (texture);
+ if (!cogl_framebuffer_allocate (COGL_FRAMEBUFFER (offscreen), &error))
{
- g_critical ("%s: Unable to create an offscreen buffer", G_STRLOC);
+ g_warning ("Unable to create an allocate paint node offscreen: %s",
+ error->message);
+ cogl_object_unref (offscreen);
goto out;
}
+ res->offscreen = COGL_FRAMEBUFFER (offscreen);
+
cogl_color_init_from_4ub (&color, opacity, opacity, opacity, opacity);
/* the pipeline used to paint the texture; we use nearest
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]