diff --git a/src/compositor/cogl-utils.c b/src/compositor/cogl-utils.c index 095c5340b..0b9987a71 100644 --- a/src/compositor/cogl-utils.c +++ b/src/compositor/cogl-utils.c @@ -68,7 +68,8 @@ meta_create_texture_pipeline (CoglContext *cogl_context, * meta_create_texture: * @width: width of the texture to create * @height: height of the texture to create - * @components; components to store in the texture (color or alpha) + * @ctx: A #CoglContext + * @components: components to store in the texture (color or alpha) * @flags: flags that affect the allocation behavior * * Creates a texture of the given size with the specified components @@ -82,13 +83,12 @@ meta_create_texture_pipeline (CoglContext *cogl_context, * be as small as 2048x2048 on reasonably current systems. */ CoglTexture * -meta_create_texture (int width, - int height, - CoglTextureComponents components, - MetaTextureFlags flags) +meta_create_texture (int width, + int height, + CoglContext *ctx, + CoglTextureComponents components, + MetaTextureFlags flags) { - ClutterBackend *backend = clutter_get_default_backend (); - CoglContext *ctx = clutter_backend_get_cogl_context (backend); CoglTexture *texture; texture = cogl_texture_2d_new_with_size (ctx, width, height); diff --git a/src/compositor/cogl-utils.h b/src/compositor/cogl-utils.h index eec514960..19b9680d8 100644 --- a/src/compositor/cogl-utils.h +++ b/src/compositor/cogl-utils.h @@ -31,8 +31,9 @@ typedef enum META_TEXTURE_ALLOW_SLICING = 1 << 1 } MetaTextureFlags; -CoglTexture *meta_create_texture (int width, - int height, - CoglTextureComponents components, - MetaTextureFlags flags); +CoglTexture * meta_create_texture (int width, + int height, + CoglContext *cogl_context, + CoglTextureComponents components, + MetaTextureFlags flags); diff --git a/src/compositor/meta-background-image.c b/src/compositor/meta-background-image.c index 508a63440..59e43bd9a 100644 --- a/src/compositor/meta-background-image.c +++ b/src/compositor/meta-background-image.c @@ -157,6 +157,8 @@ file_loaded (GObject *source_object, GAsyncResult *result, gpointer user_data) { + ClutterBackend *backend = clutter_get_default_backend (); + CoglContext *ctx = clutter_backend_get_cogl_context (backend); MetaBackgroundImage *image = META_BACKGROUND_IMAGE (source_object); g_autoptr (GError) error = NULL; g_autoptr (GError) local_error = NULL; @@ -192,7 +194,7 @@ file_loaded (GObject *source_object, pixels = gdk_pixbuf_get_pixels (pixbuf); has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); - texture = meta_create_texture (width, height, + texture = meta_create_texture (width, height, ctx, has_alpha ? COGL_TEXTURE_COMPONENTS_RGBA : COGL_TEXTURE_COMPONENTS_RGB, META_TEXTURE_ALLOW_SLICING); diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index ef7d783da..37e61e4f9 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -671,7 +671,7 @@ ensure_wallpaper_texture (MetaBackground *self, GError *catch_error = NULL; CoglPipeline *pipeline; - self->wallpaper_texture = meta_create_texture (width, height, + self->wallpaper_texture = meta_create_texture (width, height, cogl_context, COGL_TEXTURE_COMPONENTS_RGBA, META_TEXTURE_FLAGS_NONE); offscreen = cogl_offscreen_new_with_texture (self->wallpaper_texture); @@ -830,6 +830,7 @@ meta_background_get_texture (MetaBackground *self, monitor->texture = meta_create_texture (texture_width, texture_height, + cogl_context, COGL_TEXTURE_COMPONENTS_RGBA, META_TEXTURE_FLAGS_NONE); offscreen = cogl_offscreen_new_with_texture (monitor->texture);