mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
clutter-actor: Remove cogl_rectangle from pick()
The default implementation of ClutterActor.pick() uses cogl_rectangle() to draw the rectangle with the color for picking. Replace that by cogl_framebuffer_draw_rectangle(). A static color pipeline had to be created in order to hold the pick color.
This commit is contained in:
parent
c1b6184e0a
commit
203725bfd3
@ -2227,25 +2227,46 @@ static void
|
|||||||
clutter_actor_real_pick (ClutterActor *self,
|
clutter_actor_real_pick (ClutterActor *self,
|
||||||
const ClutterColor *color)
|
const ClutterColor *color)
|
||||||
{
|
{
|
||||||
|
CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
|
||||||
|
|
||||||
/* the default implementation is just to paint a rectangle
|
/* the default implementation is just to paint a rectangle
|
||||||
* with the same size of the actor using the passed color
|
* with the same size of the actor using the passed color
|
||||||
*/
|
*/
|
||||||
if (clutter_actor_should_pick_paint (self))
|
if (clutter_actor_should_pick_paint (self))
|
||||||
{
|
{
|
||||||
|
static CoglPipeline *default_pick_pipeline = NULL;
|
||||||
ClutterActorBox box = { 0, };
|
ClutterActorBox box = { 0, };
|
||||||
|
CoglPipeline *pick_pipeline;
|
||||||
float width, height;
|
float width, height;
|
||||||
|
|
||||||
|
if (G_UNLIKELY (default_pick_pipeline == NULL))
|
||||||
|
{
|
||||||
|
CoglContext *ctx =
|
||||||
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
|
|
||||||
|
default_pick_pipeline = cogl_pipeline_new (ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_assert (default_pick_pipeline != NULL);
|
||||||
|
pick_pipeline = cogl_pipeline_copy (default_pick_pipeline);
|
||||||
|
|
||||||
clutter_actor_get_allocation_box (self, &box);
|
clutter_actor_get_allocation_box (self, &box);
|
||||||
|
|
||||||
width = box.x2 - box.x1;
|
width = box.x2 - box.x1;
|
||||||
height = box.y2 - box.y1;
|
height = box.y2 - box.y1;
|
||||||
|
|
||||||
cogl_set_source_color4ub (color->red,
|
cogl_pipeline_set_color4ub (pick_pipeline,
|
||||||
|
color->red,
|
||||||
color->green,
|
color->green,
|
||||||
color->blue,
|
color->blue,
|
||||||
color->alpha);
|
color->alpha);
|
||||||
|
|
||||||
cogl_rectangle (0, 0, width, height);
|
cogl_framebuffer_draw_rectangle (framebuffer,
|
||||||
|
pick_pipeline,
|
||||||
|
0, 0,
|
||||||
|
width, height);
|
||||||
|
|
||||||
|
cogl_object_unref (pick_pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX - this thoroughly sucks, but we need to maintain compatibility
|
/* XXX - this thoroughly sucks, but we need to maintain compatibility
|
||||||
|
Loading…
Reference in New Issue
Block a user