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;
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;

View File

@ -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 *

View File

@ -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;

View File

@ -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;