Port to Mutter to Clutter 1.0 API

- Use float instead of ClutterUnit
- clutter_actor_get_size/position() return floats (remove some
  stray usage of these functions in the default plugin as well.)
- Adapt to cogl_texture_new_from_data() changes
- Use blend strings to set up multitexturing
- Remove CLUTTER_UNITS_TO_FLOAT() usage

http://bugzilla.gnome.org/show_bug.cgi?id=585016
This commit is contained in:
Owen W. Taylor 2009-06-06 13:14:34 -04:00
parent 2ed1bf05d1
commit fafb752827
4 changed files with 24 additions and 70 deletions

View File

@ -577,7 +577,7 @@ mutter_window_set_property (GObject *object,
} }
else if (!newv && !priv->shadow && mutter_window_has_shadow (mw)) else if (!newv && !priv->shadow && mutter_window_has_shadow (mw))
{ {
guint w, h; gfloat w, h;
MetaDisplay *display = meta_screen_get_display (priv->screen); MetaDisplay *display = meta_screen_get_display (priv->screen);
Mutter *compositor; Mutter *compositor;

View File

@ -227,7 +227,7 @@ mutter_shaped_texture_ensure_mask (MutterShapedTexture *stex)
} }
else else
priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height, priv->mask_texture = cogl_texture_new_from_data (tex_width, tex_height,
-1, FALSE, COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_A_8, COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_ANY, COGL_PIXEL_FORMAT_ANY,
tex_width, tex_width,
@ -282,30 +282,10 @@ mutter_shaped_texture_paint (ClutterActor *actor)
{ {
priv->material = cogl_material_new (); priv->material = cogl_material_new ();
/* Replace the RGB from layer 1 with the RGB from layer 0 */ cogl_material_set_layer_combine (priv->material, 1,
cogl_material_set_layer_combine_function "RGB = REPLACE (PREVIOUS)"
(priv->material, 1, "A = MODULATE (PREVIOUS, TEXTURE)",
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB, NULL);
COGL_MATERIAL_LAYER_COMBINE_FUNC_REPLACE);
cogl_material_set_layer_combine_arg_src
(priv->material, 1, 0,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB,
COGL_MATERIAL_LAYER_COMBINE_SRC_PREVIOUS);
/* Modulate the alpha in layer 1 with the alpha from the
previous layer */
cogl_material_set_layer_combine_function
(priv->material, 1,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
COGL_MATERIAL_LAYER_COMBINE_FUNC_MODULATE);
cogl_material_set_layer_combine_arg_src
(priv->material, 1, 0,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
COGL_MATERIAL_LAYER_COMBINE_SRC_PREVIOUS);
cogl_material_set_layer_combine_arg_src
(priv->material, 1, 1,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
COGL_MATERIAL_LAYER_COMBINE_SRC_TEXTURE);
} }
material = priv->material; material = priv->material;
@ -325,30 +305,10 @@ mutter_shaped_texture_paint (ClutterActor *actor)
{ {
material = priv->material_workaround = cogl_material_new (); material = priv->material_workaround = cogl_material_new ();
/* Replace the RGB from layer 1 with the RGB from layer 0 */ cogl_material_set_layer_combine (material, 1,
cogl_material_set_layer_combine_function "RGB = REPLACE (PREVIOUS)"
(material, 1, "A = MODULATE (PRIMARY, TEXTURE)",
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB, NULL);
COGL_MATERIAL_LAYER_COMBINE_FUNC_REPLACE);
cogl_material_set_layer_combine_arg_src
(material, 1, 0,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_RGB,
COGL_MATERIAL_LAYER_COMBINE_SRC_PREVIOUS);
/* Use the alpha from layer 1 modulated with the alpha from
the primary color */
cogl_material_set_layer_combine_function
(material, 1,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
COGL_MATERIAL_LAYER_COMBINE_FUNC_MODULATE);
cogl_material_set_layer_combine_arg_src
(material, 1, 0,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
COGL_MATERIAL_LAYER_COMBINE_SRC_PRIMARY_COLOR);
cogl_material_set_layer_combine_arg_src
(material, 1, 1,
COGL_MATERIAL_LAYER_COMBINE_CHANNELS_ALPHA,
COGL_MATERIAL_LAYER_COMBINE_SRC_TEXTURE);
} }
material = priv->material_workaround; material = priv->material_workaround;
@ -369,8 +329,8 @@ mutter_shaped_texture_paint (ClutterActor *actor)
clutter_actor_get_allocation_box (actor, &alloc); clutter_actor_get_allocation_box (actor, &alloc);
cogl_rectangle (0, 0, cogl_rectangle (0, 0,
CLUTTER_UNITS_TO_FLOAT (alloc.x2 - alloc.x1), alloc.x2 - alloc.x1,
CLUTTER_UNITS_TO_FLOAT (alloc.y2 - alloc.y1)); alloc.y2 - alloc.y1);
} }
static void static void
@ -411,8 +371,8 @@ mutter_shaped_texture_pick (ClutterActor *actor,
/* Paint the mask rectangle in the given color */ /* Paint the mask rectangle in the given color */
cogl_set_source_texture (priv->mask_texture); cogl_set_source_texture (priv->mask_texture);
cogl_rectangle_with_texture_coords (0, 0, cogl_rectangle_with_texture_coords (0, 0,
CLUTTER_UNITS_TO_FLOAT (alloc.x2 - alloc.x1), alloc.x2 - alloc.x1,
CLUTTER_UNITS_TO_FLOAT (alloc.y2 - alloc.y1), alloc.y2 - alloc.y1,
0, 0, 1, 1); 0, 0, 1, 1);
} }
} }

View File

@ -375,12 +375,6 @@ switch_workspace (MutterPlugin *plugin,
if (win_workspace == to || win_workspace == from) if (win_workspace == to || win_workspace == from)
{ {
gint x, y;
guint w, h;
clutter_actor_get_position (window, &x, &y);
clutter_actor_get_size (window, &w, &h);
apriv->orig_parent = clutter_actor_get_parent (window); apriv->orig_parent = clutter_actor_get_parent (window);
clutter_actor_reparent (window, clutter_actor_reparent (window,
@ -548,8 +542,8 @@ maximize (MutterPlugin *plugin,
gdouble scale_x = 1.0; gdouble scale_x = 1.0;
gdouble scale_y = 1.0; gdouble scale_y = 1.0;
gint anchor_x = 0; gfloat anchor_x = 0;
gint anchor_y = 0; gfloat anchor_y = 0;
type = mutter_window_get_window_type (mc_window); type = mutter_window_get_window_type (mc_window);
@ -558,8 +552,8 @@ maximize (MutterPlugin *plugin,
ClutterAnimation *animation; ClutterAnimation *animation;
EffectCompleteData *data = g_new0 (EffectCompleteData, 1); EffectCompleteData *data = g_new0 (EffectCompleteData, 1);
ActorPrivate *apriv = get_actor_private (mc_window); ActorPrivate *apriv = get_actor_private (mc_window);
guint width, height; gfloat width, height;
gint x, y; gfloat x, y;
apriv->is_maximized = TRUE; apriv->is_maximized = TRUE;

View File

@ -68,9 +68,9 @@ struct _TidyTextureFramePrivate
static void static void
tidy_texture_frame_get_preferred_width (ClutterActor *self, tidy_texture_frame_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
TidyTextureFramePrivate *priv = TIDY_TEXTURE_FRAME (self)->priv; TidyTextureFramePrivate *priv = TIDY_TEXTURE_FRAME (self)->priv;
@ -101,9 +101,9 @@ tidy_texture_frame_get_preferred_width (ClutterActor *self,
static void static void
tidy_texture_frame_get_preferred_height (ClutterActor *self, tidy_texture_frame_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
TidyTextureFramePrivate *priv = TIDY_TEXTURE_FRAME (self)->priv; TidyTextureFramePrivate *priv = TIDY_TEXTURE_FRAME (self)->priv;