mirror of
https://github.com/brl/mutter.git
synced 2025-02-17 21:54:10 +00:00
clutter-rectangle: Remove cogl_rectangle()
A pretty regular removal.
This commit is contained in:
parent
fcd1ff9c56
commit
0304433b20
@ -81,7 +81,11 @@ static void
|
|||||||
clutter_rectangle_paint (ClutterActor *self)
|
clutter_rectangle_paint (ClutterActor *self)
|
||||||
{
|
{
|
||||||
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
|
ClutterRectanglePrivate *priv = CLUTTER_RECTANGLE (self)->priv;
|
||||||
|
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||||
|
static CoglPipeline *default_color_pipeline = NULL;
|
||||||
|
CoglPipeline *content_pipeline;
|
||||||
ClutterGeometry geom;
|
ClutterGeometry geom;
|
||||||
|
CoglColor color;
|
||||||
guint8 tmp_alpha;
|
guint8 tmp_alpha;
|
||||||
|
|
||||||
CLUTTER_NOTE (PAINT,
|
CLUTTER_NOTE (PAINT,
|
||||||
@ -90,58 +94,86 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
: "unknown");
|
: "unknown");
|
||||||
clutter_actor_get_allocation_geometry (self, &geom);
|
clutter_actor_get_allocation_geometry (self, &geom);
|
||||||
|
|
||||||
|
if (G_UNLIKELY (default_color_pipeline == NULL))
|
||||||
|
{
|
||||||
|
CoglContext *ctx =
|
||||||
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
|
default_color_pipeline = cogl_pipeline_new (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert (default_color_pipeline != NULL);
|
||||||
|
content_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
||||||
|
|
||||||
|
/* compute the composited opacity of the actor taking into
|
||||||
|
* account the opacity of the color set by the user
|
||||||
|
*/
|
||||||
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||||
|
* priv->color.alpha
|
||||||
|
/ 255;
|
||||||
|
|
||||||
|
cogl_color_init_from_4ub (&color,
|
||||||
|
priv->color.red,
|
||||||
|
priv->color.green,
|
||||||
|
priv->color.blue,
|
||||||
|
tmp_alpha);
|
||||||
|
cogl_color_premultiply (&color);
|
||||||
|
cogl_pipeline_set_color (content_pipeline, &color);
|
||||||
|
|
||||||
if (priv->has_border)
|
if (priv->has_border)
|
||||||
{
|
{
|
||||||
|
CoglPipeline *border_pipeline;
|
||||||
|
|
||||||
|
border_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
||||||
|
|
||||||
|
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
||||||
|
* priv->border_color.alpha
|
||||||
|
/ 255;
|
||||||
|
|
||||||
|
cogl_color_init_from_4ub (&color,
|
||||||
|
priv->border_color.red,
|
||||||
|
priv->border_color.green,
|
||||||
|
priv->border_color.blue,
|
||||||
|
tmp_alpha);
|
||||||
|
cogl_color_premultiply (&color);
|
||||||
|
cogl_pipeline_set_color (border_pipeline, &color);
|
||||||
|
|
||||||
/* We paint the border and the content only if the rectangle
|
/* We paint the border and the content only if the rectangle
|
||||||
* is big enough to show them
|
* is big enough to show them
|
||||||
*/
|
*/
|
||||||
if ((priv->border_width * 2) < geom.width &&
|
if ((priv->border_width * 2) < geom.width &&
|
||||||
(priv->border_width * 2) < geom.height)
|
(priv->border_width * 2) < geom.height)
|
||||||
{
|
{
|
||||||
/* compute the composited opacity of the actor taking into
|
/* paint the border. this sucks, but it's the only way to make a border */
|
||||||
* account the opacity of the color set by the user
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
*/
|
border_pipeline,
|
||||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
priv->border_width, 0,
|
||||||
* priv->border_color.alpha
|
geom.width,
|
||||||
/ 255;
|
priv->border_width);
|
||||||
|
|
||||||
/* paint the border */
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
cogl_set_source_color4ub (priv->border_color.red,
|
border_pipeline,
|
||||||
priv->border_color.green,
|
geom.width - priv->border_width,
|
||||||
priv->border_color.blue,
|
priv->border_width,
|
||||||
tmp_alpha);
|
geom.width, geom.height);
|
||||||
|
|
||||||
/* this sucks, but it's the only way to make a border */
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
cogl_rectangle (priv->border_width, 0,
|
border_pipeline,
|
||||||
geom.width,
|
0, geom.height - priv->border_width,
|
||||||
priv->border_width);
|
geom.width - priv->border_width,
|
||||||
|
geom.height);
|
||||||
|
|
||||||
cogl_rectangle (geom.width - priv->border_width,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
priv->border_width,
|
border_pipeline,
|
||||||
geom.width,
|
0, 0,
|
||||||
geom.height);
|
priv->border_width,
|
||||||
|
geom.height - priv->border_width);
|
||||||
cogl_rectangle (0, geom.height - priv->border_width,
|
|
||||||
geom.width - priv->border_width,
|
|
||||||
geom.height);
|
|
||||||
|
|
||||||
cogl_rectangle (0, 0,
|
|
||||||
priv->border_width,
|
|
||||||
geom.height - priv->border_width);
|
|
||||||
|
|
||||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
|
||||||
* priv->color.alpha
|
|
||||||
/ 255;
|
|
||||||
|
|
||||||
/* now paint the rectangle */
|
/* now paint the rectangle */
|
||||||
cogl_set_source_color4ub (priv->color.red,
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
priv->color.green,
|
content_pipeline,
|
||||||
priv->color.blue,
|
priv->border_width, priv->border_width,
|
||||||
tmp_alpha);
|
geom.width - priv->border_width,
|
||||||
|
geom.height - priv->border_width);
|
||||||
cogl_rectangle (priv->border_width, priv->border_width,
|
|
||||||
geom.width - priv->border_width,
|
|
||||||
geom.height - priv->border_width);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -149,34 +181,21 @@ clutter_rectangle_paint (ClutterActor *self)
|
|||||||
* as the border, since we can only fit that into the
|
* as the border, since we can only fit that into the
|
||||||
* allocation.
|
* allocation.
|
||||||
*/
|
*/
|
||||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
* priv->border_color.alpha
|
border_pipeline,
|
||||||
/ 255;
|
0, 0, geom.width, geom.height);
|
||||||
|
|
||||||
cogl_set_source_color4ub (priv->border_color.red,
|
|
||||||
priv->border_color.green,
|
|
||||||
priv->border_color.blue,
|
|
||||||
tmp_alpha);
|
|
||||||
|
|
||||||
cogl_rectangle (0, 0, geom.width, geom.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cogl_object_unref (border_pipeline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* compute the composited opacity of the actor taking into
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
* account the opacity of the color set by the user
|
content_pipeline,
|
||||||
*/
|
0, 0, geom.width, geom.height);
|
||||||
tmp_alpha = clutter_actor_get_paint_opacity (self)
|
|
||||||
* priv->color.alpha
|
|
||||||
/ 255;
|
|
||||||
|
|
||||||
cogl_set_source_color4ub (priv->color.red,
|
|
||||||
priv->color.green,
|
|
||||||
priv->color.blue,
|
|
||||||
tmp_alpha);
|
|
||||||
|
|
||||||
cogl_rectangle (0, 0, geom.width, geom.height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cogl_object_unref (content_pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
Loading…
x
Reference in New Issue
Block a user