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, void *datap,
GError **error) GError **error)
{ {
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
CreateFadedIconData *data = datap; CreateFadedIconData *data = datap;
ShellApp *app; ShellApp *app;
GdkPixbuf *pixbuf; GdkPixbuf *pixbuf;
@ -333,13 +335,11 @@ shell_app_create_faded_icon_cpu (StTextureCache *cache,
} }
} }
texture = cogl_texture_new_from_data (width, texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
height, have_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
COGL_TEXTURE_NONE, rowstride,
have_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888, pixels,
COGL_PIXEL_FORMAT_ANY, NULL));
rowstride,
pixels);
g_free (pixels); g_free (pixels);
g_object_unref (pixbuf); g_object_unref (pixbuf);

View File

@ -343,6 +343,9 @@ CoglHandle
_st_create_shadow_material (StShadow *shadow_spec, _st_create_shadow_material (StShadow *shadow_spec,
CoglHandle src_texture) 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; static CoglHandle shadow_material_template = COGL_INVALID_HANDLE;
CoglHandle material; CoglHandle material;
@ -369,13 +372,11 @@ _st_create_shadow_material (StShadow *shadow_spec,
&width_out, &height_out, &rowstride_out); &width_out, &height_out, &rowstride_out);
g_free (pixels_in); g_free (pixels_in);
texture = cogl_texture_new_from_data (width_out, texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width_out, height_out,
height_out, COGL_PIXEL_FORMAT_A_8,
COGL_TEXTURE_NONE, rowstride_out,
COGL_PIXEL_FORMAT_A_8, pixels_out,
COGL_PIXEL_FORMAT_A_8, NULL));
rowstride_out,
pixels_out);
g_free (pixels_out); g_free (pixels_out);

View File

@ -69,6 +69,8 @@ elliptical_arc (cairo_t *cr,
static CoglHandle static CoglHandle
create_corner_material (StCornerSpec *corner) create_corner_material (StCornerSpec *corner)
{ {
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
CoglHandle texture; CoglHandle texture;
cairo_t *cr; cairo_t *cr;
cairo_surface_t *surface; cairo_surface_t *surface;
@ -166,12 +168,11 @@ create_corner_material (StCornerSpec *corner)
cairo_surface_destroy (surface); cairo_surface_destroy (surface);
texture = cogl_texture_new_from_data (size, size, texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, size, size,
COGL_TEXTURE_NONE, CLUTTER_CAIRO_FORMAT_ARGB32,
CLUTTER_CAIRO_FORMAT_ARGB32, rowstride,
COGL_PIXEL_FORMAT_ANY, data,
rowstride, NULL));
data);
g_free (data); g_free (data);
g_assert (texture != COGL_INVALID_HANDLE); g_assert (texture != COGL_INVALID_HANDLE);
@ -941,6 +942,8 @@ st_theme_node_prerender_background (StThemeNode *node,
float actor_width, float actor_width,
float actor_height) float actor_height)
{ {
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
StBorderImage *border_image; StBorderImage *border_image;
CoglHandle texture; CoglHandle texture;
guint radius[4]; guint radius[4];
@ -1256,12 +1259,11 @@ st_theme_node_prerender_background (StThemeNode *node,
if (interior_path != NULL) if (interior_path != NULL)
cairo_path_destroy (interior_path); cairo_path_destroy (interior_path);
texture = cogl_texture_new_from_data (width, height, texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
COGL_TEXTURE_NONE, CLUTTER_CAIRO_FORMAT_ARGB32,
CLUTTER_CAIRO_FORMAT_ARGB32, rowstride,
COGL_PIXEL_FORMAT_ANY, data,
rowstride, NULL));
data);
cairo_destroy (cr); cairo_destroy (cr);
cairo_surface_destroy (surface); cairo_surface_destroy (surface);