struct _ClutterRectanglePrivate
{
- ClutterColor primary_color;
- CoglHandle primary_material;
- ClutterColor border_color;
- CoglHandle border_material;
+ ClutterColor color;
+ ClutterColor border_color;
guint border_width;
ClutterRectanglePrivate *priv;
ClutterGeometry geom;
guint8 tmp_alpha;
- guint8 opacity;
rectangle = CLUTTER_RECTANGLE(self);
priv = rectangle->priv;
: "unknown");
clutter_actor_get_allocation_geometry (self, &geom);
- opacity = clutter_actor_get_paint_opacity (self);
-
/* parent paint call will have translated us into position so
* paint from 0, 0
*/
/* compute the composited opacity of the actor taking into
* account the opacity of the color set by the user
*/
- tmp_alpha = opacity * priv->border_color.alpha / 255;
+ tmp_alpha = clutter_actor_get_paint_opacity (self)
+ * priv->border_color.alpha
+ / 255;
/* paint the border */
-
- /* We are assuming this is a NOP when the color doesn't change.
- * This is important since we should aim to never modify
- * materials mid-scene. */
- cogl_material_set_color4ub (priv->border_material,
- priv->border_color.red,
- priv->border_color.green,
- priv->border_color.blue,
- tmp_alpha);
-
- cogl_set_source (priv->border_material);
-
- cogl_material_set_color4ub (priv->border_material,
- priv->border_color.red,
- priv->border_color.green,
- priv->border_color.blue,
- tmp_alpha);
+ cogl_set_source_color4ub (priv->border_color.red,
+ priv->border_color.green,
+ priv->border_color.blue,
+ tmp_alpha);
/* this sucks, but it's the only way to make a border */
cogl_rectangle (priv->border_width, 0,
priv->border_width,
geom.height - priv->border_width);
- tmp_alpha = opacity * priv->primary_color.alpha / 255;
+ tmp_alpha = clutter_actor_get_paint_opacity (self)
+ * priv->color.alpha
+ / 255;
/* now paint the rectangle */
- cogl_set_source (priv->primary_material);
-
- cogl_material_set_color4ub (priv->primary_material,
- priv->primary_color.red,
- priv->primary_color.green,
- priv->primary_color.blue,
- tmp_alpha);
+ cogl_set_source_color4ub (priv->color.red,
+ priv->color.green,
+ priv->color.blue,
+ tmp_alpha);
cogl_rectangle (priv->border_width, priv->border_width,
geom.width - priv->border_width,
/* compute the composited opacity of the actor taking into
* account the opacity of the color set by the user
*/
- tmp_alpha = opacity * priv->primary_color.alpha / 255;
-
- /* now paint the rectangle */
- cogl_set_source (priv->primary_material);
+ tmp_alpha = clutter_actor_get_paint_opacity (self)
+ * priv->color.alpha
+ / 255;
- cogl_material_set_color4ub (priv->primary_material,
- priv->primary_color.red,
- priv->primary_color.green,
- priv->primary_color.blue,
- tmp_alpha);
+ cogl_set_source_color4ub (priv->color.red,
+ priv->color.green,
+ priv->color.blue,
+ tmp_alpha);
cogl_rectangle (0, 0, geom.width, geom.height);
}
switch (prop_id)
{
case PROP_COLOR:
- clutter_value_set_color (value, &priv->primary_color);
+ clutter_value_set_color (value, &priv->color);
break;
case PROP_BORDER_COLOR:
clutter_value_set_color (value, &priv->border_color);
self->priv = priv = CLUTTER_RECTANGLE_GET_PRIVATE (self);
- priv->primary_color = default_color;
+ priv->color = default_color;
priv->border_color = default_border_color;
- priv->primary_material = cogl_material_new ();
- priv->border_material = cogl_material_new ();
priv->border_width = 0;
priv = rectangle->priv;
- color->red = priv->primary_color.red;
- color->green = priv->primary_color.green;
- color->blue = priv->primary_color.blue;
- color->alpha = priv->primary_color.alpha;
+ color->red = priv->color.red;
+ color->green = priv->color.green;
+ color->blue = priv->color.blue;
+ color->alpha = priv->color.alpha;
}
/**
priv = rectangle->priv;
- priv->primary_color.red = color->red;
- priv->primary_color.green = color->green;
- priv->primary_color.blue = color->blue;
- priv->primary_color.alpha = color->alpha;
+ priv->color.red = color->red;
+ priv->color.green = color->green;
+ priv->color.blue = color->blue;
+ priv->color.alpha = color->alpha;
#if 0
/* FIXME - appears to be causing border to always get drawn */
priv->border_color.blue = color->blue;
priv->border_color.alpha = color->alpha;
- if (clutter_color_equal (&priv->primary_color, &priv->border_color))
+ if (clutter_color_equal (&priv->color, &priv->border_color))
priv->has_border = FALSE;
else
priv->has_border = TRUE;