1
0
Fork 0

clutter: Get CoglContext from a CoglTexture where possible

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3977>
This commit is contained in:
Bilal Elmoussaoui 2024-08-20 22:35:15 +02:00
parent 5f5448b180
commit 62da8d7aac
3 changed files with 7 additions and 11 deletions

View file

@ -135,11 +135,9 @@ struct _ClutterBlur
};
static CoglPipeline*
create_blur_pipeline (void)
create_blur_pipeline (CoglContext *ctx)
{
static CoglPipelineKey blur_pipeline_key = "clutter-blur-pipeline-private";
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglPipeline *blur_pipeline;
blur_pipeline =
@ -225,10 +223,9 @@ update_blur_uniforms (ClutterBlur *blur,
static gboolean
create_fbo (ClutterBlur *blur,
CoglContext *ctx,
BlurPass *pass)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
float scaled_height;
float scaled_width;
float height;
@ -270,11 +267,12 @@ setup_blur_pass (ClutterBlur *blur,
int orientation,
CoglTexture *texture)
{
CoglContext *context = cogl_texture_get_context (texture);
pass->orientation = orientation;
pass->pipeline = create_blur_pipeline ();
pass->pipeline = create_blur_pipeline (context);
cogl_pipeline_set_layer_texture (pass->pipeline, 0, texture);
if (!create_fbo (blur, pass))
if (!create_fbo (blur, context, pass))
return FALSE;
update_blur_uniforms (blur, pass);

View file

@ -193,8 +193,7 @@ clutter_offscreen_effect_real_create_pipeline (ClutterOffscreenEffect *effect,
{
ClutterOffscreenEffectPrivate *priv =
clutter_offscreen_effect_get_instance_private (effect);
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglContext *ctx = cogl_texture_get_context (texture);
CoglPipeline *pipeline;
float resource_scale;

View file

@ -126,8 +126,7 @@ clutter_texture_content_new_from_texture (CoglTexture *texture,
MtkRectangle *clip)
{
ClutterTextureContent *texture_content;
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglContext *cogl_context = cogl_texture_get_context (texture);
g_return_val_if_fail (texture != NULL, NULL);