From 0810ab62dbd6a2b01f74b4adc5f72331098d5c86 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Thu, 7 Aug 2014 14:46:07 -0400 Subject: [PATCH] Port to cogl_texture_2d_new_from_data --- src/shell-app.c | 14 +++++++------- src/st/st-private.c | 15 ++++++++------- src/st/st-theme-node-drawing.c | 26 ++++++++++++++------------ 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/shell-app.c b/src/shell-app.c index 47146961b..dea610e7c 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -242,6 +242,8 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache, void *datap, GError **error) { + ClutterBackend *backend = clutter_get_default_backend (); + CoglContext *ctx = clutter_backend_get_cogl_context (backend); CreateFadedIconData *data = datap; ShellApp *app; GdkPixbuf *pixbuf; @@ -333,13 +335,11 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache, } } - texture = cogl_texture_new_from_data (width, - height, - COGL_TEXTURE_NONE, - have_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888, - COGL_PIXEL_FORMAT_ANY, - rowstride, - pixels); + texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height, + have_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888, + rowstride, + pixels, + NULL)); g_free (pixels); g_object_unref (pixbuf); diff --git a/src/st/st-private.c b/src/st/st-private.c index 7a846ddbb..6ba4295a3 100644 --- a/src/st/st-private.c +++ b/src/st/st-private.c @@ -343,6 +343,9 @@ CoglHandle _st_create_shadow_material (StShadow *shadow_spec, CoglHandle src_texture) { + ClutterBackend *backend = clutter_get_default_backend (); + CoglContext *ctx = clutter_backend_get_cogl_context (backend); + static CoglHandle shadow_material_template = COGL_INVALID_HANDLE; CoglHandle material; @@ -369,13 +372,11 @@ _st_create_shadow_material (StShadow *shadow_spec, &width_out, &height_out, &rowstride_out); g_free (pixels_in); - texture = cogl_texture_new_from_data (width_out, - height_out, - COGL_TEXTURE_NONE, - COGL_PIXEL_FORMAT_A_8, - COGL_PIXEL_FORMAT_A_8, - rowstride_out, - pixels_out); + texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width_out, height_out, + COGL_PIXEL_FORMAT_A_8, + rowstride_out, + pixels_out, + NULL)); g_free (pixels_out); diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c index aa7591cb0..c655219d8 100644 --- a/src/st/st-theme-node-drawing.c +++ b/src/st/st-theme-node-drawing.c @@ -69,6 +69,8 @@ elliptical_arc (cairo_t *cr, static CoglHandle create_corner_material (StCornerSpec *corner) { + ClutterBackend *backend = clutter_get_default_backend (); + CoglContext *ctx = clutter_backend_get_cogl_context (backend); CoglHandle texture; cairo_t *cr; cairo_surface_t *surface; @@ -166,12 +168,11 @@ create_corner_material (StCornerSpec *corner) cairo_surface_destroy (surface); - texture = cogl_texture_new_from_data (size, size, - COGL_TEXTURE_NONE, - CLUTTER_CAIRO_FORMAT_ARGB32, - COGL_PIXEL_FORMAT_ANY, - rowstride, - data); + texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, size, size, + CLUTTER_CAIRO_FORMAT_ARGB32, + rowstride, + data, + NULL)); g_free (data); g_assert (texture != COGL_INVALID_HANDLE); @@ -941,6 +942,8 @@ st_theme_node_prerender_background (StThemeNode *node, float actor_width, float actor_height) { + ClutterBackend *backend = clutter_get_default_backend (); + CoglContext *ctx = clutter_backend_get_cogl_context (backend); StBorderImage *border_image; CoglHandle texture; guint radius[4]; @@ -1256,12 +1259,11 @@ st_theme_node_prerender_background (StThemeNode *node, if (interior_path != NULL) cairo_path_destroy (interior_path); - texture = cogl_texture_new_from_data (width, height, - COGL_TEXTURE_NONE, - CLUTTER_CAIRO_FORMAT_ARGB32, - COGL_PIXEL_FORMAT_ANY, - rowstride, - data); + texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height, + CLUTTER_CAIRO_FORMAT_ARGB32, + rowstride, + data, + NULL)); cairo_destroy (cr); cairo_surface_destroy (surface);