[mutter/gbsneto/explicit-framebuffer-preparations: 9/14] clutter-actor: Remove cogl_rectangle from pick()
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/explicit-framebuffer-preparations: 9/14] clutter-actor: Remove cogl_rectangle from pick()
- Date: Sat, 10 Nov 2018 01:30:55 +0000 (UTC)
commit a90de42bd4ca2e4fe9d268978e16028896ab7409
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Nov 8 19:54:11 2018 -0200
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.
clutter/clutter/clutter-actor.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter/clutter-actor.c b/clutter/clutter/clutter-actor.c
index b5eed5234..5486dceca 100644
--- a/clutter/clutter/clutter-actor.c
+++ b/clutter/clutter/clutter-actor.c
@@ -2227,25 +2227,43 @@ static void
clutter_actor_real_pick (ClutterActor *self,
const ClutterColor *color)
{
+ CoglFramebuffer *framebuffer = cogl_get_draw_framebuffer ();
+
/* the default implementation is just to paint a rectangle
* with the same size of the actor using the passed color
*/
if (clutter_actor_should_pick_paint (self))
{
+ static CoglPipeline *color_pipeline = NULL;
ClutterActorBox box = { 0, };
+ CoglColor cogl_color;
float width, height;
+ if (G_UNLIKELY (color_pipeline == NULL))
+ {
+ CoglContext *ctx =
+ clutter_backend_get_cogl_context (clutter_get_default_backend ());
+
+ color_pipeline = cogl_pipeline_new (ctx);
+ }
+
clutter_actor_get_allocation_box (self, &box);
width = box.x2 - box.x1;
height = box.y2 - box.y1;
- cogl_set_source_color4ub (color->red,
+ cogl_color_init_from_4ub (&cogl_color,
+ color->red,
color->green,
color->blue,
color->alpha);
+ cogl_color_premultiply (&cogl_color);
+ cogl_pipeline_set_color (color_pipeline, &cogl_color);
- cogl_rectangle (0, 0, width, height);
+ cogl_framebuffer_draw_rectangle (framebuffer,
+ color_pipeline,
+ 0, 0,
+ width, height);
}
/* XXX - this thoroughly sucks, but we need to maintain compatibility
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]