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
This commit is contained in:
Georges Basile Stavracas Neto 2018-11-10 22:41:28 -02:00
parent 5fb8d4f730
commit 361cc6cf92
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
4 changed files with 17 additions and 18 deletions

View File

@ -455,14 +455,13 @@ _st_create_shadow_pipeline_from_actor (StShadow *shadow_spec,
CoglTexture *buffer; CoglTexture *buffer;
CoglOffscreen *offscreen; CoglOffscreen *offscreen;
CoglFramebuffer *fb; CoglFramebuffer *fb;
CoglContext *ctx;
CoglColor clear_color; CoglColor clear_color;
CoglError *catch_error = NULL; CoglError *catch_error = NULL;
float x, y; float x, y;
buffer = cogl_texture_new_with_size (width, ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
height, buffer = cogl_texture_2d_new_with_size (ctx, width, height);
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
if (buffer == NULL) if (buffer == NULL)
return NULL; return NULL;

View File

@ -66,10 +66,10 @@ st_scroll_view_fade_create_texture (ClutterOffscreenEffect *effect,
gfloat min_width, gfloat min_width,
gfloat min_height) gfloat min_height)
{ {
return cogl_texture_new_with_size (min_width, CoglContext *ctx =
min_height, clutter_backend_get_cogl_context (clutter_get_default_backend ());
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888_PRE); return cogl_texture_2d_new_with_size (ctx, min_width, min_height);
} }
static char * static char *

View File

@ -2220,12 +2220,15 @@ static void
st_theme_node_prerender_shadow (StThemeNodePaintState *state) st_theme_node_prerender_shadow (StThemeNodePaintState *state)
{ {
StThemeNode *node = state->node; StThemeNode *node = state->node;
CoglContext *ctx;
guint border_radius[4]; guint border_radius[4];
int max_borders[4]; int max_borders[4];
int center_radius, corner_id; int center_radius, corner_id;
CoglHandle buffer, offscreen = COGL_INVALID_HANDLE; CoglHandle buffer, offscreen = COGL_INVALID_HANDLE;
CoglError *error = NULL; CoglError *error = NULL;
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
/* Get infos from the node */ /* Get infos from the node */
if (state->alloc_width < node->box_shadow_min_width || if (state->alloc_width < node->box_shadow_min_width ||
state->alloc_height < node->box_shadow_min_height) state->alloc_height < node->box_shadow_min_height)
@ -2261,10 +2264,9 @@ st_theme_node_prerender_shadow (StThemeNodePaintState *state)
} }
/* Render offscreen */ /* Render offscreen */
buffer = cogl_texture_new_with_size (state->box_shadow_width, buffer = cogl_texture_2d_new_with_size (ctx,
state->box_shadow_height, state->box_shadow_width,
COGL_TEXTURE_NO_SLICING, state->box_shadow_height);
COGL_PIXEL_FORMAT_ANY);
if (buffer == NULL) if (buffer == NULL)
return; return;

View File

@ -240,12 +240,14 @@ setup_framebuffers (StThemeNodeTransition *transition,
const ClutterActorBox *allocation) const ClutterActorBox *allocation)
{ {
StThemeNodeTransitionPrivate *priv = transition->priv; StThemeNodeTransitionPrivate *priv = transition->priv;
CoglContext *ctx;
guint width, height; guint width, height;
CoglError *catch_error = NULL; CoglError *catch_error = NULL;
/* template material to avoid unnecessary shader compilation */ /* template material to avoid unnecessary shader compilation */
static CoglHandle material_template = COGL_INVALID_HANDLE; 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; width = priv->offscreen_box.x2 - priv->offscreen_box.x1;
height = priv->offscreen_box.y2 - priv->offscreen_box.y1; height = priv->offscreen_box.y2 - priv->offscreen_box.y1;
@ -254,15 +256,11 @@ setup_framebuffers (StThemeNodeTransition *transition,
if (priv->old_texture) if (priv->old_texture)
cogl_handle_unref (priv->old_texture); cogl_handle_unref (priv->old_texture);
priv->old_texture = cogl_texture_new_with_size (width, height, priv->old_texture = cogl_texture_2d_new_with_size (ctx, width, height);
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
if (priv->new_texture) if (priv->new_texture)
cogl_handle_unref (priv->new_texture); cogl_handle_unref (priv->new_texture);
priv->new_texture = cogl_texture_new_with_size (width, height, priv->new_texture = cogl_texture_2d_new_with_size (ctx, width, height);
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_ANY);
if (priv->old_texture == COGL_INVALID_HANDLE) if (priv->old_texture == COGL_INVALID_HANDLE)
return FALSE; return FALSE;