mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 20:32:16 +00:00
compositor: Don't use deprecated Cogl-1.0 API
https://bugzilla.gnome.org/show_bug.cgi?id=694224
This commit is contained in:
parent
580feb0c85
commit
7f6a77232f
@ -21,6 +21,7 @@
|
||||
* 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include "cogl-utils.h"
|
||||
|
||||
/**
|
||||
@ -39,7 +40,7 @@
|
||||
*
|
||||
* Return value: (transfer full): a newly created Cogl texture
|
||||
*/
|
||||
CoglHandle
|
||||
CoglTexture *
|
||||
meta_create_color_texture_4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
@ -68,43 +69,45 @@ meta_create_color_texture_4ub (guint8 red,
|
||||
/* Based on gnome-shell/src/st/st-private.c:_st_create_texture_material.c */
|
||||
|
||||
/**
|
||||
* meta_create_texture_material:
|
||||
* meta_create_texture_pipeline:
|
||||
* @src_texture: (allow-none): texture to use initially for the layer
|
||||
*
|
||||
* Creates a material with a single layer. Using a common template
|
||||
* Creates a pipeline with a single layer. Using a common template
|
||||
* allows sharing a shader for different uses in Mutter. To share the same
|
||||
* shader with all other materials that are just texture plus opacity
|
||||
* shader with all other pipelines that are just texture plus opacity
|
||||
* would require Cogl fixes.
|
||||
* (See http://bugzilla.clutter-project.org/show_bug.cgi?id=2425)
|
||||
*
|
||||
* Return value: (transfer full): a newly created Cogl material
|
||||
* Return value: (transfer full): a newly created #CoglPipeline
|
||||
*/
|
||||
CoglHandle
|
||||
meta_create_texture_material (CoglHandle src_texture)
|
||||
CoglPipeline *
|
||||
meta_create_texture_pipeline (CoglTexture *src_texture)
|
||||
{
|
||||
static CoglHandle texture_material_template = COGL_INVALID_HANDLE;
|
||||
CoglHandle material;
|
||||
static CoglPipeline *texture_pipeline_template = NULL;
|
||||
CoglPipeline *pipeline;
|
||||
|
||||
/* We use a material that has a dummy texture as a base for all
|
||||
texture materials. The idea is that only the Cogl texture object
|
||||
/* We use a pipeline that has a dummy texture as a base for all
|
||||
texture pipelines. The idea is that only the Cogl texture object
|
||||
would be different in the children so it is likely that Cogl will
|
||||
be able to share GL programs between all the textures. */
|
||||
if (G_UNLIKELY (texture_material_template == COGL_INVALID_HANDLE))
|
||||
if (G_UNLIKELY (texture_pipeline_template == NULL))
|
||||
{
|
||||
CoglHandle dummy_texture;
|
||||
CoglTexture *dummy_texture;
|
||||
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
|
||||
dummy_texture = meta_create_color_texture_4ub (0xff, 0xff, 0xff, 0xff,
|
||||
COGL_TEXTURE_NONE);
|
||||
|
||||
texture_material_template = cogl_material_new ();
|
||||
cogl_material_set_layer (texture_material_template, 0, dummy_texture);
|
||||
cogl_handle_unref (dummy_texture);
|
||||
|
||||
texture_pipeline_template = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_layer_texture (texture_pipeline_template, 0, dummy_texture);
|
||||
cogl_object_unref (dummy_texture);
|
||||
}
|
||||
|
||||
material = cogl_material_copy (texture_material_template);
|
||||
pipeline = cogl_pipeline_copy (texture_pipeline_template);
|
||||
|
||||
if (src_texture != COGL_INVALID_HANDLE)
|
||||
cogl_material_set_layer (material, 0, src_texture);
|
||||
if (src_texture != NULL)
|
||||
cogl_pipeline_set_layer_texture (pipeline, 0, src_texture);
|
||||
|
||||
return material;
|
||||
return pipeline;
|
||||
}
|
||||
|
@ -25,11 +25,11 @@
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
|
||||
CoglHandle meta_create_color_texture_4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha,
|
||||
CoglTextureFlags flags);
|
||||
CoglHandle meta_create_texture_material (CoglHandle src_texture);
|
||||
CoglTexture * meta_create_color_texture_4ub (guint8 red,
|
||||
guint8 green,
|
||||
guint8 blue,
|
||||
guint8 alpha,
|
||||
CoglTextureFlags flags);
|
||||
CoglPipeline * meta_create_texture_pipeline (CoglTexture *texture);
|
||||
|
||||
#endif /* __META_COGL_UTILS_H__ */
|
||||
|
@ -462,7 +462,7 @@ static void
|
||||
ensure_pipeline (MetaBackground *self)
|
||||
{
|
||||
if (self->priv->pipeline == NULL)
|
||||
self->priv->pipeline = COGL_PIPELINE (meta_create_texture_material (NULL));
|
||||
self->priv->pipeline = COGL_PIPELINE (meta_create_texture_pipeline (NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -761,7 +761,7 @@ unset_texture (MetaBackground *self)
|
||||
|
||||
g_clear_pointer (&priv->texture,
|
||||
(GDestroyNotify)
|
||||
cogl_handle_unref);
|
||||
cogl_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -852,7 +852,7 @@ meta_background_load_still_frame (MetaBackground *self)
|
||||
MetaBackgroundPrivate *priv = self->priv;
|
||||
MetaDisplay *display = meta_screen_get_display (priv->screen);
|
||||
Pixmap still_frame;
|
||||
CoglHandle texture;
|
||||
CoglTexture *texture;
|
||||
CoglContext *context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
GError *error = NULL;
|
||||
|
||||
@ -865,7 +865,7 @@ meta_background_load_still_frame (MetaBackground *self)
|
||||
XSync (meta_display_get_xdisplay (display), False);
|
||||
|
||||
meta_error_trap_push (display);
|
||||
texture = cogl_texture_pixmap_x11_new (context, still_frame, FALSE, &error);
|
||||
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (context, still_frame, FALSE, &error));
|
||||
meta_error_trap_pop (display);
|
||||
|
||||
if (error != NULL)
|
||||
@ -876,7 +876,7 @@ meta_background_load_still_frame (MetaBackground *self)
|
||||
return;
|
||||
}
|
||||
|
||||
set_texture (self, COGL_TEXTURE (texture));
|
||||
set_texture (self, texture);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -897,7 +897,7 @@ meta_background_load_gradient (MetaBackground *self,
|
||||
ClutterColor *second_color)
|
||||
{
|
||||
MetaBackgroundPrivate *priv = self->priv;
|
||||
CoglHandle texture;
|
||||
CoglTexture *texture;
|
||||
guint width, height;
|
||||
uint8_t pixels[8];
|
||||
|
||||
@ -954,7 +954,7 @@ meta_background_load_color (MetaBackground *self,
|
||||
ClutterColor *color)
|
||||
{
|
||||
MetaBackgroundPrivate *priv = self->priv;
|
||||
CoglHandle texture;
|
||||
CoglTexture *texture;
|
||||
ClutterActor *stage = meta_get_stage_for_screen (priv->screen);
|
||||
ClutterColor stage_color;
|
||||
|
||||
|
@ -40,7 +40,7 @@ typedef struct _MetaShadow MetaShadow;
|
||||
|
||||
MetaShadow *meta_shadow_ref (MetaShadow *shadow);
|
||||
void meta_shadow_unref (MetaShadow *shadow);
|
||||
CoglHandle meta_shadow_get_texture (MetaShadow *shadow);
|
||||
CoglTexture*meta_shadow_get_texture (MetaShadow *shadow);
|
||||
void meta_shadow_paint (MetaShadow *shadow,
|
||||
int window_x,
|
||||
int window_y,
|
||||
|
@ -65,8 +65,8 @@ struct _MetaShadow
|
||||
|
||||
MetaShadowFactory *factory;
|
||||
MetaShadowCacheKey key;
|
||||
CoglHandle texture;
|
||||
CoglHandle material;
|
||||
CoglTexture *texture;
|
||||
CoglPipeline *pipeline;
|
||||
|
||||
/* The outer order is the distance the shadow extends outside the window
|
||||
* shape; the inner border is the unscaled portion inside the window
|
||||
@ -175,8 +175,8 @@ meta_shadow_unref (MetaShadow *shadow)
|
||||
}
|
||||
|
||||
meta_window_shape_unref (shadow->key.shape);
|
||||
cogl_handle_unref (shadow->texture);
|
||||
cogl_handle_unref (shadow->material);
|
||||
cogl_object_unref (shadow->texture);
|
||||
cogl_object_unref (shadow->pipeline);
|
||||
|
||||
g_slice_free (MetaShadow, shadow);
|
||||
}
|
||||
@ -218,10 +218,10 @@ meta_shadow_paint (MetaShadow *shadow,
|
||||
int dest_y[4];
|
||||
int n_x, n_y;
|
||||
|
||||
cogl_material_set_color4ub (shadow->material,
|
||||
cogl_pipeline_set_color4ub (shadow->pipeline,
|
||||
opacity, opacity, opacity, opacity);
|
||||
|
||||
cogl_set_source (shadow->material);
|
||||
cogl_set_source (shadow->pipeline);
|
||||
|
||||
if (shadow->scale_width)
|
||||
{
|
||||
@ -801,7 +801,7 @@ make_shadow (MetaShadow *shadow,
|
||||
cairo_region_destroy (column_convolve_region);
|
||||
g_free (buffer);
|
||||
|
||||
shadow->material = meta_create_texture_material (shadow->texture);
|
||||
shadow->pipeline = meta_create_texture_pipeline (shadow->texture);
|
||||
}
|
||||
|
||||
static MetaShadowParams *
|
||||
|
@ -64,10 +64,10 @@ struct _MetaShapedTexturePrivate
|
||||
{
|
||||
MetaTextureTower *paint_tower;
|
||||
Pixmap pixmap;
|
||||
CoglHandle texture;
|
||||
CoglHandle mask_texture;
|
||||
CoglHandle material;
|
||||
CoglHandle material_unshaped;
|
||||
CoglTexturePixmapX11 *texture;
|
||||
CoglTexture *mask_texture;
|
||||
CoglPipeline *pipeline;
|
||||
CoglPipeline *pipeline_unshaped;
|
||||
|
||||
cairo_region_t *clip_region;
|
||||
|
||||
@ -101,8 +101,8 @@ meta_shaped_texture_init (MetaShapedTexture *self)
|
||||
priv = self->priv = META_SHAPED_TEXTURE_GET_PRIVATE (self);
|
||||
|
||||
priv->paint_tower = meta_texture_tower_new ();
|
||||
priv->texture = COGL_INVALID_HANDLE;
|
||||
priv->mask_texture = COGL_INVALID_HANDLE;
|
||||
priv->texture = NULL;
|
||||
priv->mask_texture = NULL;
|
||||
priv->create_mipmaps = TRUE;
|
||||
}
|
||||
|
||||
@ -116,23 +116,11 @@ meta_shaped_texture_dispose (GObject *object)
|
||||
meta_texture_tower_free (priv->paint_tower);
|
||||
priv->paint_tower = NULL;
|
||||
|
||||
if (priv->material != COGL_INVALID_HANDLE)
|
||||
{
|
||||
cogl_handle_unref (priv->material);
|
||||
priv->material = COGL_INVALID_HANDLE;
|
||||
}
|
||||
if (priv->material_unshaped != COGL_INVALID_HANDLE)
|
||||
{
|
||||
cogl_handle_unref (priv->material_unshaped);
|
||||
priv->material_unshaped = COGL_INVALID_HANDLE;
|
||||
}
|
||||
if (priv->texture != COGL_INVALID_HANDLE)
|
||||
{
|
||||
cogl_handle_unref (priv->texture);
|
||||
priv->texture = COGL_INVALID_HANDLE;
|
||||
}
|
||||
g_clear_pointer (&priv->pipeline, cogl_object_unref);
|
||||
g_clear_pointer (&priv->pipeline_unshaped, cogl_object_unref);
|
||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||
|
||||
meta_shaped_texture_set_mask_texture (self, COGL_INVALID_HANDLE);
|
||||
meta_shaped_texture_set_mask_texture (self, NULL);
|
||||
meta_shaped_texture_set_clip_region (self, NULL);
|
||||
|
||||
G_OBJECT_CLASS (meta_shaped_texture_parent_class)->dispose (object);
|
||||
@ -143,14 +131,14 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
||||
{
|
||||
MetaShapedTexture *stex = (MetaShapedTexture *) actor;
|
||||
MetaShapedTexturePrivate *priv = stex->priv;
|
||||
CoglHandle paint_tex;
|
||||
CoglTexture *paint_tex;
|
||||
guint tex_width, tex_height;
|
||||
ClutterActorBox alloc;
|
||||
|
||||
static CoglHandle material_template = COGL_INVALID_HANDLE;
|
||||
static CoglHandle material_unshaped_template = COGL_INVALID_HANDLE;
|
||||
static CoglPipeline *pipeline_template = NULL;
|
||||
static CoglPipeline *pipeline_unshaped_template = NULL;
|
||||
|
||||
CoglHandle material;
|
||||
CoglPipeline *pipeline;
|
||||
|
||||
if (priv->clip_region && cairo_region_is_empty (priv->clip_region))
|
||||
return;
|
||||
@ -176,9 +164,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
||||
if (priv->create_mipmaps)
|
||||
paint_tex = meta_texture_tower_get_paint_texture (priv->paint_tower);
|
||||
else
|
||||
paint_tex = priv->texture;
|
||||
paint_tex = COGL_TEXTURE (priv->texture);
|
||||
|
||||
if (paint_tex == COGL_INVALID_HANDLE)
|
||||
if (paint_tex == NULL)
|
||||
return;
|
||||
|
||||
tex_width = priv->tex_width;
|
||||
@ -187,47 +175,51 @@ meta_shaped_texture_paint (ClutterActor *actor)
|
||||
if (tex_width == 0 || tex_height == 0) /* no contents yet */
|
||||
return;
|
||||
|
||||
if (priv->mask_texture == COGL_INVALID_HANDLE)
|
||||
if (priv->mask_texture == NULL)
|
||||
{
|
||||
/* Use a single-layer texture if we don't have a mask. */
|
||||
|
||||
if (priv->material_unshaped == COGL_INVALID_HANDLE)
|
||||
if (priv->pipeline_unshaped == NULL)
|
||||
{
|
||||
if (G_UNLIKELY (material_unshaped_template == COGL_INVALID_HANDLE))
|
||||
material_unshaped_template = cogl_material_new ();
|
||||
if (G_UNLIKELY (pipeline_unshaped_template == NULL))
|
||||
{
|
||||
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
pipeline_unshaped_template = cogl_pipeline_new (ctx);
|
||||
}
|
||||
|
||||
priv->material_unshaped = cogl_material_copy (material_unshaped_template);
|
||||
priv->pipeline_unshaped = cogl_pipeline_copy (pipeline_unshaped_template);
|
||||
}
|
||||
material = priv->material_unshaped;
|
||||
pipeline = priv->pipeline_unshaped;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (priv->material == COGL_INVALID_HANDLE)
|
||||
if (priv->pipeline == NULL)
|
||||
{
|
||||
if (G_UNLIKELY (material_template == COGL_INVALID_HANDLE))
|
||||
if (G_UNLIKELY (pipeline_template == NULL))
|
||||
{
|
||||
material_template = cogl_material_new ();
|
||||
cogl_material_set_layer_combine (material_template, 1,
|
||||
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||
pipeline_template = cogl_pipeline_new (ctx);
|
||||
cogl_pipeline_set_layer_combine (pipeline_template, 1,
|
||||
"RGBA = MODULATE (PREVIOUS, TEXTURE[A])",
|
||||
NULL);
|
||||
}
|
||||
priv->material = cogl_material_copy (material_template);
|
||||
priv->pipeline = cogl_pipeline_copy (pipeline_template);
|
||||
}
|
||||
material = priv->material;
|
||||
pipeline = priv->pipeline;
|
||||
|
||||
cogl_material_set_layer (material, 1, priv->mask_texture);
|
||||
cogl_pipeline_set_layer_texture (pipeline, 1, priv->mask_texture);
|
||||
}
|
||||
|
||||
cogl_material_set_layer (material, 0, paint_tex);
|
||||
cogl_pipeline_set_layer_texture (pipeline, 0, paint_tex);
|
||||
|
||||
{
|
||||
CoglColor color;
|
||||
guchar opacity = clutter_actor_get_paint_opacity (actor);
|
||||
cogl_color_set_from_4ub (&color, opacity, opacity, opacity, opacity);
|
||||
cogl_material_set_color (material, &color);
|
||||
cogl_pipeline_set_color (pipeline, &color);
|
||||
}
|
||||
|
||||
cogl_set_source (material);
|
||||
cogl_set_source (pipeline);
|
||||
|
||||
clutter_actor_get_allocation_box (actor, &alloc);
|
||||
|
||||
@ -292,18 +284,18 @@ meta_shaped_texture_pick (ClutterActor *actor,
|
||||
MetaShapedTexturePrivate *priv = stex->priv;
|
||||
|
||||
/* If there is no region then use the regular pick */
|
||||
if (priv->mask_texture == COGL_INVALID_HANDLE)
|
||||
if (priv->mask_texture == NULL)
|
||||
CLUTTER_ACTOR_CLASS (meta_shaped_texture_parent_class)
|
||||
->pick (actor, color);
|
||||
else if (clutter_actor_should_pick_paint (actor))
|
||||
{
|
||||
CoglHandle paint_tex;
|
||||
CoglTexture *paint_tex;
|
||||
ClutterActorBox alloc;
|
||||
guint tex_width, tex_height;
|
||||
|
||||
paint_tex = priv->texture;
|
||||
paint_tex = COGL_TEXTURE (priv->texture);
|
||||
|
||||
if (paint_tex == COGL_INVALID_HANDLE)
|
||||
if (paint_tex == NULL)
|
||||
return;
|
||||
|
||||
tex_width = cogl_texture_get_width (paint_tex);
|
||||
@ -393,17 +385,17 @@ meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
|
||||
|
||||
if (create_mipmaps != priv->create_mipmaps)
|
||||
{
|
||||
CoglHandle base_texture;
|
||||
CoglTexture *base_texture;
|
||||
priv->create_mipmaps = create_mipmaps;
|
||||
base_texture = create_mipmaps ?
|
||||
priv->texture : COGL_INVALID_HANDLE;
|
||||
COGL_TEXTURE (priv->texture) : NULL;
|
||||
meta_texture_tower_set_base_texture (priv->paint_tower, base_texture);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
|
||||
CoglHandle mask_texture)
|
||||
CoglTexture *mask_texture)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
|
||||
@ -411,16 +403,12 @@ meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
|
||||
|
||||
priv = stex->priv;
|
||||
|
||||
if (priv->mask_texture != COGL_INVALID_HANDLE)
|
||||
{
|
||||
cogl_handle_unref (priv->mask_texture);
|
||||
priv->mask_texture = COGL_INVALID_HANDLE;
|
||||
}
|
||||
g_clear_pointer (&priv->mask_texture, cogl_object_unref);
|
||||
|
||||
if (mask_texture != COGL_INVALID_HANDLE)
|
||||
if (mask_texture != NULL)
|
||||
{
|
||||
priv->mask_texture = mask_texture;
|
||||
cogl_handle_ref (priv->mask_texture);
|
||||
cogl_object_ref (priv->mask_texture);
|
||||
}
|
||||
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stex));
|
||||
@ -438,10 +426,11 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
|
||||
priv = stex->priv;
|
||||
|
||||
if (priv->texture == COGL_INVALID_HANDLE)
|
||||
if (priv->texture == NULL)
|
||||
return;
|
||||
|
||||
cogl_texture_pixmap_x11_update_area (priv->texture, x, y, width, height);
|
||||
cogl_texture_pixmap_x11_update_area (priv->texture,
|
||||
x, y, width, height);
|
||||
|
||||
meta_texture_tower_update_area (priv->paint_tower, x, y, width, height);
|
||||
|
||||
@ -449,8 +438,8 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
}
|
||||
|
||||
static void
|
||||
set_cogl_texture (MetaShapedTexture *stex,
|
||||
CoglHandle cogl_tex)
|
||||
set_cogl_texture (MetaShapedTexture *stex,
|
||||
CoglTexturePixmapX11 *cogl_tex)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
guint width, height;
|
||||
@ -459,21 +448,21 @@ set_cogl_texture (MetaShapedTexture *stex,
|
||||
|
||||
priv = stex->priv;
|
||||
|
||||
if (priv->texture != COGL_INVALID_HANDLE)
|
||||
cogl_handle_unref (priv->texture);
|
||||
if (priv->texture != NULL)
|
||||
cogl_object_unref (priv->texture);
|
||||
|
||||
priv->texture = cogl_tex;
|
||||
|
||||
if (priv->material != COGL_INVALID_HANDLE)
|
||||
cogl_material_set_layer (priv->material, 0, cogl_tex);
|
||||
if (priv->pipeline != NULL)
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline, 0, COGL_TEXTURE (cogl_tex));
|
||||
|
||||
if (priv->material_unshaped != COGL_INVALID_HANDLE)
|
||||
cogl_material_set_layer (priv->material_unshaped, 0, cogl_tex);
|
||||
if (priv->pipeline_unshaped != NULL)
|
||||
cogl_pipeline_set_layer_texture (priv->pipeline_unshaped, 0, COGL_TEXTURE (cogl_tex));
|
||||
|
||||
if (cogl_tex != COGL_INVALID_HANDLE)
|
||||
if (cogl_tex != NULL)
|
||||
{
|
||||
width = cogl_texture_get_width (cogl_tex);
|
||||
height = cogl_texture_get_height (cogl_tex);
|
||||
width = cogl_texture_get_width (COGL_TEXTURE (cogl_tex));
|
||||
height = cogl_texture_get_height (COGL_TEXTURE (cogl_tex));
|
||||
|
||||
if (width != priv->tex_width ||
|
||||
height != priv->tex_height)
|
||||
@ -486,7 +475,7 @@ set_cogl_texture (MetaShapedTexture *stex,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* size changed to 0 going to an invalid handle */
|
||||
/* size changed to 0 going to an inavlid texture */
|
||||
priv->tex_width = 0;
|
||||
priv->tex_height = 0;
|
||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (stex));
|
||||
@ -522,10 +511,11 @@ meta_shaped_texture_set_pixmap (MetaShapedTexture *stex,
|
||||
set_cogl_texture (stex, cogl_texture_pixmap_x11_new (ctx, pixmap, FALSE, NULL));
|
||||
}
|
||||
else
|
||||
set_cogl_texture (stex, COGL_INVALID_HANDLE);
|
||||
set_cogl_texture (stex, NULL);
|
||||
|
||||
if (priv->create_mipmaps)
|
||||
meta_texture_tower_set_base_texture (priv->paint_tower, priv->texture);
|
||||
meta_texture_tower_set_base_texture (priv->paint_tower,
|
||||
COGL_TEXTURE (priv->texture));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -534,11 +524,11 @@ meta_shaped_texture_set_pixmap (MetaShapedTexture *stex,
|
||||
*
|
||||
* Returns: (transfer none): the unshaped texture
|
||||
*/
|
||||
CoglHandle
|
||||
CoglTexture *
|
||||
meta_shaped_texture_get_texture (MetaShapedTexture *stex)
|
||||
{
|
||||
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), COGL_INVALID_HANDLE);
|
||||
return stex->priv->texture;
|
||||
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
|
||||
return COGL_TEXTURE (stex->priv->texture);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -595,13 +585,13 @@ cairo_surface_t *
|
||||
meta_shaped_texture_get_image (MetaShapedTexture *stex,
|
||||
cairo_rectangle_int_t *clip)
|
||||
{
|
||||
CoglHandle texture, mask_texture;
|
||||
CoglTexture *texture, *mask_texture;
|
||||
cairo_rectangle_int_t texture_rect = { 0, 0, 0, 0 };
|
||||
cairo_surface_t *surface;
|
||||
|
||||
g_return_val_if_fail (META_IS_SHAPED_TEXTURE (stex), NULL);
|
||||
|
||||
texture = stex->priv->texture;
|
||||
texture = COGL_TEXTURE (stex->priv->texture);
|
||||
|
||||
if (texture == NULL)
|
||||
return NULL;
|
||||
@ -638,7 +628,7 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
|
||||
cogl_object_unref (texture);
|
||||
|
||||
mask_texture = stex->priv->mask_texture;
|
||||
if (mask_texture != COGL_INVALID_HANDLE)
|
||||
if (mask_texture != NULL)
|
||||
{
|
||||
cairo_t *cr;
|
||||
cairo_surface_t *mask_surface;
|
||||
|
@ -59,8 +59,8 @@ typedef struct
|
||||
struct _MetaTextureTower
|
||||
{
|
||||
int n_levels;
|
||||
CoglHandle textures[MAX_TEXTURE_LEVELS];
|
||||
CoglHandle fbos[MAX_TEXTURE_LEVELS];
|
||||
CoglTexture *textures[MAX_TEXTURE_LEVELS];
|
||||
CoglOffscreen *fbos[MAX_TEXTURE_LEVELS];
|
||||
Box invalid[MAX_TEXTURE_LEVELS];
|
||||
};
|
||||
|
||||
@ -93,7 +93,7 @@ meta_texture_tower_free (MetaTextureTower *tower)
|
||||
{
|
||||
g_return_if_fail (tower != NULL);
|
||||
|
||||
meta_texture_tower_set_base_texture (tower, COGL_INVALID_HANDLE);
|
||||
meta_texture_tower_set_base_texture (tower, NULL);
|
||||
|
||||
g_slice_free (MetaTextureTower, tower);
|
||||
}
|
||||
@ -110,7 +110,7 @@ meta_texture_tower_free (MetaTextureTower *tower)
|
||||
*/
|
||||
void
|
||||
meta_texture_tower_set_base_texture (MetaTextureTower *tower,
|
||||
CoglHandle texture)
|
||||
CoglTexture *texture)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -119,33 +119,33 @@ meta_texture_tower_set_base_texture (MetaTextureTower *tower,
|
||||
if (texture == tower->textures[0])
|
||||
return;
|
||||
|
||||
if (tower->textures[0] != COGL_INVALID_HANDLE)
|
||||
if (tower->textures[0] != NULL)
|
||||
{
|
||||
for (i = 1; i < tower->n_levels; i++)
|
||||
{
|
||||
if (tower->textures[i] != COGL_INVALID_HANDLE)
|
||||
if (tower->textures[i] != NULL)
|
||||
{
|
||||
cogl_handle_unref (tower->textures[i]);
|
||||
tower->textures[i] = COGL_INVALID_HANDLE;
|
||||
cogl_object_unref (tower->textures[i]);
|
||||
tower->textures[i] = NULL;
|
||||
}
|
||||
|
||||
if (tower->fbos[i] != COGL_INVALID_HANDLE)
|
||||
if (tower->fbos[i] != NULL)
|
||||
{
|
||||
cogl_handle_unref (tower->fbos[i]);
|
||||
tower->fbos[i] = COGL_INVALID_HANDLE;
|
||||
cogl_object_unref (tower->fbos[i]);
|
||||
tower->fbos[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
cogl_handle_unref (tower->textures[0]);
|
||||
cogl_object_unref (tower->textures[0]);
|
||||
}
|
||||
|
||||
tower->textures[0] = texture;
|
||||
|
||||
if (tower->textures[0] != COGL_INVALID_HANDLE)
|
||||
if (tower->textures[0] != NULL)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
cogl_handle_ref (tower->textures[0]);
|
||||
cogl_object_ref (tower->textures[0]);
|
||||
|
||||
width = cogl_texture_get_width (tower->textures[0]);
|
||||
height = cogl_texture_get_height (tower->textures[0]);
|
||||
@ -186,7 +186,7 @@ meta_texture_tower_update_area (MetaTextureTower *tower,
|
||||
|
||||
g_return_if_fail (tower != NULL);
|
||||
|
||||
if (tower->textures[0] == COGL_INVALID_HANDLE)
|
||||
if (tower->textures[0] == NULL)
|
||||
return;
|
||||
|
||||
texture_width = cogl_texture_get_width (tower->textures[0]);
|
||||
@ -387,22 +387,22 @@ static gboolean
|
||||
texture_tower_revalidate_fbo (MetaTextureTower *tower,
|
||||
int level)
|
||||
{
|
||||
CoglHandle source_texture = tower->textures[level - 1];
|
||||
CoglTexture *source_texture = tower->textures[level - 1];
|
||||
int source_texture_width = cogl_texture_get_width (source_texture);
|
||||
int source_texture_height = cogl_texture_get_height (source_texture);
|
||||
CoglHandle dest_texture = tower->textures[level];
|
||||
CoglTexture *dest_texture = tower->textures[level];
|
||||
int dest_texture_width = cogl_texture_get_width (dest_texture);
|
||||
int dest_texture_height = cogl_texture_get_height (dest_texture);
|
||||
Box *invalid = &tower->invalid[level];
|
||||
CoglMatrix modelview;
|
||||
|
||||
if (tower->fbos[level] == COGL_INVALID_HANDLE)
|
||||
if (tower->fbos[level] == NULL)
|
||||
tower->fbos[level] = cogl_offscreen_new_to_texture (dest_texture);
|
||||
|
||||
if (tower->fbos[level] == COGL_INVALID_HANDLE)
|
||||
if (tower->fbos[level] == NULL)
|
||||
return FALSE;
|
||||
|
||||
cogl_push_framebuffer (tower->fbos[level]);
|
||||
cogl_push_framebuffer (COGL_FRAMEBUFFER (tower->fbos[level]));
|
||||
|
||||
cogl_ortho (0, dest_texture_width, dest_texture_height, 0, -1., 1.);
|
||||
|
||||
@ -460,12 +460,12 @@ static void
|
||||
texture_tower_revalidate_client (MetaTextureTower *tower,
|
||||
int level)
|
||||
{
|
||||
CoglHandle source_texture = tower->textures[level - 1];
|
||||
CoglTexture *source_texture = tower->textures[level - 1];
|
||||
int source_texture_width = cogl_texture_get_width (source_texture);
|
||||
int source_texture_height = cogl_texture_get_height (source_texture);
|
||||
guint source_rowstride;
|
||||
guchar *source_data;
|
||||
CoglHandle dest_texture = tower->textures[level];
|
||||
CoglTexture *dest_texture = tower->textures[level];
|
||||
int dest_texture_width = cogl_texture_get_width (dest_texture);
|
||||
int dest_texture_height = cogl_texture_get_height (dest_texture);
|
||||
int dest_x = tower->invalid[level].x1;
|
||||
@ -575,28 +575,28 @@ texture_tower_revalidate (MetaTextureTower *tower,
|
||||
* rectangle (0, 0, 200, 200).
|
||||
*
|
||||
* Return value: the COGL texture handle to use for painting, or
|
||||
* %COGL_INVALID_HANDLE if no base texture has yet been set.
|
||||
* %NULL if no base texture has yet been set.
|
||||
*/
|
||||
CoglHandle
|
||||
CoglTexture *
|
||||
meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
|
||||
{
|
||||
int texture_width, texture_height;
|
||||
int level;
|
||||
|
||||
g_return_val_if_fail (tower != NULL, COGL_INVALID_HANDLE);
|
||||
g_return_val_if_fail (tower != NULL, NULL);
|
||||
|
||||
if (tower->textures[0] == COGL_INVALID_HANDLE)
|
||||
return COGL_INVALID_HANDLE;
|
||||
if (tower->textures[0] == NULL)
|
||||
return NULL;
|
||||
|
||||
texture_width = cogl_texture_get_width (tower->textures[0]);
|
||||
texture_height = cogl_texture_get_height (tower->textures[0]);
|
||||
|
||||
level = get_paint_level(texture_width, texture_height);
|
||||
if (level < 0) /* singular paint matrix, scaled to nothing */
|
||||
return COGL_INVALID_HANDLE;
|
||||
return NULL;
|
||||
level = MIN (level, tower->n_levels - 1);
|
||||
|
||||
if (tower->textures[level] == COGL_INVALID_HANDLE ||
|
||||
if (tower->textures[level] == NULL ||
|
||||
(tower->invalid[level].x2 != tower->invalid[level].x1 &&
|
||||
tower->invalid[level].y2 != tower->invalid[level].y1))
|
||||
{
|
||||
@ -608,7 +608,7 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
|
||||
texture_width = MAX (1, texture_width / 2);
|
||||
texture_height = MAX (1, texture_height / 2);
|
||||
|
||||
if (tower->textures[i] == COGL_INVALID_HANDLE)
|
||||
if (tower->textures[i] == NULL)
|
||||
texture_tower_create_texture (tower, i, texture_width, texture_height);
|
||||
}
|
||||
|
||||
|
@ -56,13 +56,13 @@ typedef struct _MetaTextureTower MetaTextureTower;
|
||||
MetaTextureTower *meta_texture_tower_new (void);
|
||||
void meta_texture_tower_free (MetaTextureTower *tower);
|
||||
void meta_texture_tower_set_base_texture (MetaTextureTower *tower,
|
||||
CoglHandle texture);
|
||||
CoglTexture *texture);
|
||||
void meta_texture_tower_update_area (MetaTextureTower *tower,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
CoglHandle meta_texture_tower_get_paint_texture (MetaTextureTower *tower);
|
||||
CoglTexture *meta_texture_tower_get_paint_texture (MetaTextureTower *tower);
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
@ -917,7 +917,7 @@ static void
|
||||
meta_window_actor_damage_all (MetaWindowActor *self)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
CoglHandle texture;
|
||||
CoglTexture *texture;
|
||||
|
||||
if (!priv->needs_damage_all)
|
||||
return;
|
||||
@ -1778,7 +1778,7 @@ check_needs_pixmap (MetaWindowActor *self)
|
||||
|
||||
if (priv->back_pixmap == None)
|
||||
{
|
||||
CoglHandle texture;
|
||||
CoglTexture *texture;
|
||||
|
||||
meta_error_trap_push (display);
|
||||
|
||||
@ -1816,7 +1816,7 @@ check_needs_pixmap (MetaWindowActor *self)
|
||||
* do it here.
|
||||
* See: http://bugzilla.clutter-project.org/show_bug.cgi?id=2236
|
||||
*/
|
||||
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (texture)))
|
||||
if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
|
||||
g_warning ("NOTE: Not using GLX TFP!\n");
|
||||
|
||||
/* ::size-changed is supposed to refer to meta_window_get_outer_rect().
|
||||
@ -2090,13 +2090,13 @@ build_and_scan_frame_mask (MetaWindowActor *self,
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
guchar *mask_data;
|
||||
guint tex_width, tex_height;
|
||||
CoglHandle paint_tex, mask_texture;
|
||||
CoglTexture *paint_tex, *mask_texture;
|
||||
int stride;
|
||||
cairo_t *cr;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
paint_tex = meta_shaped_texture_get_texture (META_SHAPED_TEXTURE (priv->actor));
|
||||
if (paint_tex == COGL_INVALID_HANDLE)
|
||||
if (paint_tex == NULL)
|
||||
return;
|
||||
|
||||
tex_width = cogl_texture_get_width (paint_tex);
|
||||
@ -2165,7 +2165,7 @@ build_and_scan_frame_mask (MetaWindowActor *self,
|
||||
|
||||
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor),
|
||||
mask_texture);
|
||||
cogl_handle_unref (mask_texture);
|
||||
cogl_object_unref (mask_texture);
|
||||
|
||||
g_free (mask_data);
|
||||
}
|
||||
@ -2200,7 +2200,7 @@ check_needs_reshape (MetaWindowActor *self)
|
||||
client_area.width = priv->window->rect.width;
|
||||
client_area.height = priv->window->rect.height;
|
||||
|
||||
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor), COGL_INVALID_HANDLE);
|
||||
meta_shaped_texture_set_mask_texture (META_SHAPED_TEXTURE (priv->actor), NULL);
|
||||
g_clear_pointer (&priv->shape_region, cairo_region_destroy);
|
||||
|
||||
#ifdef HAVE_SHAPE
|
||||
|
@ -70,10 +70,10 @@ void meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
void meta_shaped_texture_set_pixmap (MetaShapedTexture *stex,
|
||||
Pixmap pixmap);
|
||||
|
||||
CoglHandle meta_shaped_texture_get_texture (MetaShapedTexture *stex);
|
||||
CoglTexture * meta_shaped_texture_get_texture (MetaShapedTexture *stex);
|
||||
|
||||
void meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex,
|
||||
CoglHandle mask_texture);
|
||||
CoglTexture *mask_texture);
|
||||
|
||||
/* Assumes ownership of clip_region */
|
||||
void meta_shaped_texture_set_clip_region (MetaShapedTexture *stex,
|
||||
|
Loading…
Reference in New Issue
Block a user