Port to cogl_texture_2d_new_from_data

This commit is contained in:
Jasper St. Pierre 2014-08-07 14:46:07 -04:00
parent 6f00d81abf
commit 0810ab62db
3 changed files with 29 additions and 26 deletions

View File

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

View File

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

View File

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