[gnome-shell/gbsneto/remove-cogl-texture-new] st: Remove deprecated cogl_texture_new()



commit 361cc6cf921c91a9b505b7f1abbe59d5f69edb95
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Sat Nov 10 22:41:28 2018 -0200

    st: Remove deprecated cogl_texture_new()
    
    cogl_texture_new() is used in a few places in GNOME Shell, but
    it's a deprecated Cogl function. The replacement is the less
    verbose cogl_texture_2d_new_with_size(), that is very much a
    straightforward replacement.
    
    Remove the few places where this function is used, replacing
    it by the CoglTexture2d counterpart.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/287

 src/st/st-private.c               |  7 +++----
 src/st/st-scroll-view-fade.c      |  8 ++++----
 src/st/st-theme-node-drawing.c    | 10 ++++++----
 src/st/st-theme-node-transition.c | 10 ++++------
 4 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/st/st-private.c b/src/st/st-private.c
index 512fbba45..1068a74ee 100644
--- a/src/st/st-private.c
+++ b/src/st/st-private.c
@@ -455,14 +455,13 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
       CoglTexture *buffer;
       CoglOffscreen *offscreen;
       CoglFramebuffer *fb;
+      CoglContext *ctx;
       CoglColor clear_color;
       CoglError *catch_error = NULL;
       float x, y;
 
-      buffer = cogl_texture_new_with_size (width,
-                                           height,
-                                           COGL_TEXTURE_NO_SLICING,
-                                           COGL_PIXEL_FORMAT_ANY);
+      ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+      buffer = cogl_texture_2d_new_with_size (ctx, width, height);
 
       if (buffer == NULL)
         return NULL;
diff --git a/src/st/st-scroll-view-fade.c b/src/st/st-scroll-view-fade.c
index 1753afaa5..8282ddc5b 100644
--- a/src/st/st-scroll-view-fade.c
+++ b/src/st/st-scroll-view-fade.c
@@ -66,10 +66,10 @@ st_scroll_view_fade_create_texture (ClutterOffscreenEffect *effect,
                                     gfloat                  min_width,
                                     gfloat                  min_height)
 {
-  return cogl_texture_new_with_size (min_width,
-                                     min_height,
-                                     COGL_TEXTURE_NO_SLICING,
-                                     COGL_PIXEL_FORMAT_RGBA_8888_PRE);
+  CoglContext *ctx =
+    clutter_backend_get_cogl_context (clutter_get_default_backend ());
+
+  return cogl_texture_2d_new_with_size (ctx, min_width, min_height);
 }
 
 static char *
diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c
index 2123cc487..f59065aef 100644
--- a/src/st/st-theme-node-drawing.c
+++ b/src/st/st-theme-node-drawing.c
@@ -2220,12 +2220,15 @@ static void
 st_theme_node_prerender_shadow (StThemeNodePaintState *state)
 {
   StThemeNode *node = state->node;
+  CoglContext *ctx;
   guint border_radius[4];
   int max_borders[4];
   int center_radius, corner_id;
   CoglHandle buffer, offscreen = COGL_INVALID_HANDLE;
   CoglError *error = NULL;
 
+  ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+
   /* Get infos from the node */
   if (state->alloc_width < node->box_shadow_min_width ||
       state->alloc_height < node->box_shadow_min_height)
@@ -2261,10 +2264,9 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
     }
 
   /* Render offscreen */
-  buffer = cogl_texture_new_with_size (state->box_shadow_width,
-                                       state->box_shadow_height,
-                                       COGL_TEXTURE_NO_SLICING,
-                                       COGL_PIXEL_FORMAT_ANY);
+  buffer = cogl_texture_2d_new_with_size (ctx,
+                                          state->box_shadow_width,
+                                          state->box_shadow_height);
   if (buffer == NULL)
     return;
 
diff --git a/src/st/st-theme-node-transition.c b/src/st/st-theme-node-transition.c
index afde97769..608c49cab 100644
--- a/src/st/st-theme-node-transition.c
+++ b/src/st/st-theme-node-transition.c
@@ -240,12 +240,14 @@ setup_framebuffers (StThemeNodeTransition *transition,
                     const ClutterActorBox *allocation)
 {
   StThemeNodeTransitionPrivate *priv = transition->priv;
+  CoglContext *ctx;
   guint width, height;
   CoglError *catch_error = NULL;
 
   /* template material to avoid unnecessary shader compilation */
   static CoglHandle material_template = COGL_INVALID_HANDLE;
 
+  ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
   width  = priv->offscreen_box.x2 - priv->offscreen_box.x1;
   height = priv->offscreen_box.y2 - priv->offscreen_box.y1;
 
@@ -254,15 +256,11 @@ setup_framebuffers (StThemeNodeTransition *transition,
 
   if (priv->old_texture)
     cogl_handle_unref (priv->old_texture);
-  priv->old_texture = cogl_texture_new_with_size (width, height,
-                                                  COGL_TEXTURE_NO_SLICING,
-                                                  COGL_PIXEL_FORMAT_ANY);
+  priv->old_texture = cogl_texture_2d_new_with_size (ctx, width, height);
 
   if (priv->new_texture)
     cogl_handle_unref (priv->new_texture);
-  priv->new_texture = cogl_texture_new_with_size (width, height,
-                                                  COGL_TEXTURE_NO_SLICING,
-                                                  COGL_PIXEL_FORMAT_ANY);
+  priv->new_texture = cogl_texture_2d_new_with_size (ctx, width, height);
 
   if (priv->old_texture == COGL_INVALID_HANDLE)
     return FALSE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]